Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4371409

TEST_BUG: the test JColorChooser/JCC_setSelectionModel is invalid

XMLWordPrintable

      Name: dkC103137 Date: 09/15/2000


       The test libs_api_tests/common_2/javax_swing/JColorChooser/JCC_setSelectionModel case Test02 from
      testbase_ss is invalid. The testcase expects that SelectionModel will be not null after
      setSelectionModel invocation with null parameter:
      ----------------------------------------------------------------------------------
      try {
              JFrame jf = new JFrame("setSelectionModel test");

              jcc = new JColorChooser();

              jcc.setSelectionModel(null);

              ColorSelectionModel csm = jcc.getSelectionModel();
              System.out.println("getSelectionModel " + csm);

              //jcc.setColor(Color.blue);

              jf.getContentPane().add(jcc);
              jf.setLocation(200,200);
              jf.pack();
              jf.setVisible(true);

              if (csm != null) {
                 bReturn = true;
              } else {
                 bReturn = false;
                 System.out.println("Test 2 Failed");
              }
          } catch (Exception e) {
              bReturn = false;
              System.out.println ("Unexpected Exception thrown " + e.getMessage());
              e.printStackTrace();
          }
      ----------------------------------------------------------------------------------
      Probably the author of the test supposed that in this case the SelectionModel should be set to
      colorchooser.DefaultColorSelectionModel. But actual result is null in Linux Kestrel and Solaris
      Kestrel.

      Java2 SE v1.3 API Spec does not specify result of the method invocation in case of null parameter:
      ----------------------------------------------------------------------------------
      public void setSelectionModel(ColorSelectionModel newModel)

            Set the model containing the selected color.
            Parameters:
                  newModel - the new ColorSelectionModel object
      ----------------------------------------------------------------------------------

      ======================================================================

            malenkov Sergey Malenkov (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: