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

Specification of Taskbar::getIconImage doesn't mention that the returned image might not be equal to the Taskbar::setIconImage one. (eg on Mac OS)

    XMLWordPrintable

Details

    • 9
    • b04

    Description

      Specification of Taskbar::getIconImage doesn't mention that the returned image might not be equal to the one passed to Taskbar::setIconImage method (eg on Mac OS)

      Code Snap:
      public void testSetGetIconImage() {
              Image originalImage = new BufferedImage(100, 100, TYPE_INT_RGB);
              Taskbar taskbar = Taskbar.getTaskbar();
              taskbar.setIconImage(originalImage);
              Image newImage = taskbar.getIconImage();
              if (originalImage.equals(newImage)) {
                  System.out.println("OK. GetIconImage returned image equal to set one");
              } else {
                  System.out.println("FAILED: Expected equal to : "+ originalImage + ", was given:"+ newImage);
              }
      }

      Output:
      Expected equal to : "BufferedImage@424c0bc4: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 IntegerInterleavedRaster: width = 100 height = 100 #Bands = 3 xOff = 0 yOff = 0 dataOffset[0] 0", was given: "sun.awt.image.MultiResolutionCachedImage@66133adc"

      If the following specs in fact don't assume that set/get methods must work in sync (getter is not required to return image that is equal to the one given to setter) - this needs to be mentioned explicitly.

      public void setIconImage​(Image image)
      "Changes this application's icon to the provided image."
      public Image getIconImage()
      "Obtains an image of this application's icon.

      Attachments

        Issue Links

          Activity

            People

              azvegint Alexander Zvegintsev
              amadgundi Asha Madgundi (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: