< prev index next >

test/jdk/java/awt/BasicStroke/DashZeroWidth.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 27,60 **** import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; import java.awt.image.VolatileImage; import static java.awt.image.BufferedImage.TYPE_INT_ARGB; /** * @test ! * @bug 4779211 8019816 * @summary REGRESSION: 1.4 Dashed lines disappear if BasicStroke width=0.0 * @run main/othervm -Dsun.java2d.uiScale=1 DashZeroWidth */ public final class DashZeroWidth { public static void main(final String[] args) { BufferedImage img = new BufferedImage(200, 40, TYPE_INT_ARGB); draw(img); validate(img); - if (GraphicsEnvironment.isHeadless()) { - return; - } - GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice().getDefaultConfiguration(); VolatileImage vi = gc.createCompatibleVolatileImage(200, 40); BufferedImage snapshot; int attempt = 0; while (true) { --- 27,62 ---- import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.awt.Image; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; + import java.awt.image.IndexColorModel; import java.awt.image.VolatileImage; import static java.awt.image.BufferedImage.TYPE_INT_ARGB; /** * @test ! * @bug 4779211 8019816 8198411 ! * @key headful * @summary REGRESSION: 1.4 Dashed lines disappear if BasicStroke width=0.0 * @run main/othervm -Dsun.java2d.uiScale=1 DashZeroWidth */ public final class DashZeroWidth { public static void main(final String[] args) { BufferedImage img = new BufferedImage(200, 40, TYPE_INT_ARGB); draw(img); validate(img); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice().getDefaultConfiguration(); + if (gc.getColorModel() instanceof IndexColorModel) { + System.err.println("Skipping VolatileImage because of IndexColorModel"); + return; + } VolatileImage vi = gc.createCompatibleVolatileImage(200, 40); BufferedImage snapshot; int attempt = 0; while (true) {
< prev index next >