11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 8150724 8151303 27 * @author a.stepanov 28 * @summary Check that correct resolution variants are chosen for icons 29 * when multiresolution image is used for their construction. 30 * 31 * @requires (os.family != "mac") 32 * 33 * @library ../../../../lib/testlibrary/ 34 * @build ExtendedRobot 35 * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=1 MultiresolutionIconTest 36 * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=2 MultiresolutionIconTest 37 */ 38 39 40 // TODO: please remove the "@requires" tag after 8151303 fix 41 42 43 import java.awt.*; 44 import java.awt.event.InputEvent; 45 import java.awt.geom.AffineTransform; 46 import java.awt.image.BaseMultiResolutionImage; 47 import java.awt.image.BufferedImage; 48 import javax.swing.*; 49 50 public class MultiresolutionIconTest extends JFrame { 51 52 private final static int SZ = 100; 210 r.waitForIdle(); 211 } 212 213 int x0 = tabbedPane.getLocationOnScreen().x; 214 int x1 = x - ((N - 1) * w + w / 2); 215 int y0 = getLocationOnScreen().y; 216 int y1 = y0 + getHeight(); 217 curr = checkTabIcon(x0, x1, y0, y1, expected, unexpected); 218 219 System.out.println("JTabbedPane icon: " + (curr ? "ok" : "nok")); 220 ok = ok && curr; 221 222 if (!ok) { throw new RuntimeException("test failed"); } 223 224 r.waitForIdle(); 225 dispose(); 226 } 227 228 public static void main(String[] args) throws Exception { 229 230 // TODO: remove is2x() check after JDK-8150844 fix 231 if (is2x() != "2".equals(System.getProperty(SCALE))) { return; } 232 233 for (UIManager.LookAndFeelInfo LF: UIManager.getInstalledLookAndFeels()) { 234 System.out.println("\nL&F: " + LF.getName()); 235 (new MultiresolutionIconTest(LF)).doTest(); 236 } 237 } 238 } | 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 8150724 8151303 27 * @author a.stepanov 28 * @summary Check that correct resolution variants are chosen for icons 29 * when multiresolution image is used for their construction. 30 * 31 * @library ../../../../lib/testlibrary/ 32 * @build ExtendedRobot 33 * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=1 MultiresolutionIconTest 34 * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=2 MultiresolutionIconTest 35 */ 36 37 38 // TODO: please remove the "@requires" tag after 8151303 fix 39 40 41 import java.awt.*; 42 import java.awt.event.InputEvent; 43 import java.awt.geom.AffineTransform; 44 import java.awt.image.BaseMultiResolutionImage; 45 import java.awt.image.BufferedImage; 46 import javax.swing.*; 47 48 public class MultiresolutionIconTest extends JFrame { 49 50 private final static int SZ = 100; 208 r.waitForIdle(); 209 } 210 211 int x0 = tabbedPane.getLocationOnScreen().x; 212 int x1 = x - ((N - 1) * w + w / 2); 213 int y0 = getLocationOnScreen().y; 214 int y1 = y0 + getHeight(); 215 curr = checkTabIcon(x0, x1, y0, y1, expected, unexpected); 216 217 System.out.println("JTabbedPane icon: " + (curr ? "ok" : "nok")); 218 ok = ok && curr; 219 220 if (!ok) { throw new RuntimeException("test failed"); } 221 222 r.waitForIdle(); 223 dispose(); 224 } 225 226 public static void main(String[] args) throws Exception { 227 228 for (UIManager.LookAndFeelInfo LF: UIManager.getInstalledLookAndFeels()) { 229 System.out.println("\nL&F: " + LF.getName()); 230 (new MultiresolutionIconTest(LF)).doTest(); 231 } 232 } 233 } |