--- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Mar 12 17:00:54 2018 +0100
+++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Mar 12 09:37:49 2018 -0700
@@ -382,8 +382,6 @@
styleBits = SET(styleBits, RESIZABLE, resizable);
if (!resizable) {
styleBits = SET(styleBits, ZOOMABLE, false);
- } else {
- setCanFullscreen(true);
}
}
@@ -677,6 +675,15 @@
// Manage the extended state when showing
if (visible) {
+ /* Frame or Dialog should be set property WINDOW_FULLSCREENABLE to true if the
+ Frame or Dialog is resizable.
+ **/
+ final boolean resizable = (target instanceof Frame) ? ((Frame)target).isResizable() :
+ ((target instanceof Dialog) ? ((Dialog)target).isResizable() : false);
+ if (resizable) {
+ setCanFullscreen(true);
+ }
+
// Apply the extended state as expected in shared code
if (target instanceof Frame) {
if (!wasMaximized && isMaximized()) {
--- a/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java Mon Mar 12 17:00:54 2018 +0100
+++ b/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java Mon Mar 12 09:37:49 2018 -0700
@@ -145,7 +145,7 @@
*/
private void loadResourceBundle(String resourceBundleName,
Locale locale) {
- if (! table.contains(locale)) {
+ if (! table.containsKey(locale)) {
try {
Hashtable<String, Object> resourceTable = new Hashtable<>();
--- a/src/java.desktop/share/classes/javax/swing/JList.java Mon Mar 12 17:00:54 2018 +0100
+++ b/src/java.desktop/share/classes/javax/swing/JList.java Mon Mar 12 09:37:49 2018 -0700
@@ -2427,7 +2427,7 @@
* <p>
* If the model isn't empty, the width is the preferred size's width,
* typically the width of the widest list element. The height is the
- * {@code fixedCellHeight} multiplied by the {@code visibleRowCount},
+ * height of the cell with index 0 multiplied by the {@code visibleRowCount},
* plus the list's vertical insets.
* <p>
* <b>{@code VERTICAL_WRAP} or {@code HORIZONTAL_WRAP}:</b>
--- a/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Mon Mar 12 17:00:54 2018 +0100
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java Mon Mar 12 09:37:49 2018 -0700
@@ -1104,6 +1104,7 @@
}
if ((e instanceof MouseEvent) && comp.isEnabled() &&
+ comp.isFocusable() &&
(((comp instanceof TextComponent) &&
((TextComponent)comp).isEditable()) ||
((comp instanceof JTextComponent) &&
--- a/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp Mon Mar 12 17:00:54 2018 +0100
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Component.cpp Mon Mar 12 09:37:49 2018 -0700
@@ -1828,6 +1828,7 @@
"new = 0x%08X",
GetHWnd(), GetClassName(), (UINT)lParam);
mr = WmInputLangChange(static_cast<UINT>(wParam), reinterpret_cast<HKL>(lParam));
+ g_bUserHasChangedInputLang = TRUE;
CallProxyDefWindowProc(message, wParam, lParam, retValue, mr);
// should return non-zero if we process this message
retValue = 1;
--- a/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.cpp Mon Mar 12 17:00:54 2018 +0100
+++ b/src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.cpp Mon Mar 12 09:37:49 2018 -0700
@@ -196,15 +196,7 @@
// and the page size changes
posAfter = GetScrollPos(orient);
if (posBefore != posAfter) {
- if(max==0 && posAfter==0) {
- // Caller used nMin==nMax idiom to hide scrollbar.
- // On the new themes (Windows XP, Vista) this would reset
- // scroll position to zero ("just inside the range") (6404832).
- //
- PostScrollEvent(orient, SB_THUMBPOSITION, posBefore);
- }else{
- PostScrollEvent(orient, SB_THUMBPOSITION, posAfter);
- }
+ PostScrollEvent(orient, SB_THUMBPOSITION, posAfter);
}
}
@@ -263,8 +255,11 @@
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
env->DeleteLocalRef(hAdj);
} else {
- SetScrollInfo(SB_HORZ, 0, 0,
+ /* Set scroll info to imitate the behaviour and since we don't
+ need to display it, explicitly don't show the bar */
+ SetScrollInfo(SB_HORZ, childWidth - 1, parentWidth,
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
+ ::ShowScrollBar(GetHWnd(), SB_HORZ, false);
}
if (needsVert) {
@@ -275,8 +270,11 @@
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
env->DeleteLocalRef(vAdj);
} else {
- SetScrollInfo(SB_VERT, 0, 0,
+ /* Set scroll info to imitate the behaviour and since we don't
+ need to display it, explicitly don't show the bar */
+ SetScrollInfo(SB_VERT, childHeight - 1, parentHeight,
(policy == java_awt_ScrollPane_SCROLLBARS_ALWAYS));
+ ::ShowScrollBar(GetHWnd(), SB_VERT, false);
}
env->DeleteLocalRef(target);
--- a/test/jdk/ProblemList.txt Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/ProblemList.txt Mon Mar 12 09:37:49 2018 -0700
@@ -221,7 +221,7 @@
java/awt/Window/AlwaysOnTop/AutoTestOnTop.java 6847593 macosx-all
java/awt/Window/GrabSequence/GrabSequence.java 6848409 macosx-all
java/awt/font/TextLayout/CombiningPerf.java 8192931 generic-all
-java/awt/font/TextLayout/TextLayoutBounds.java 8169188 macosx-all
+java/awt/font/TextLayout/TextLayoutBounds.java 8169188 generic-all
java/awt/font/MonospacedGlyphWidth/MonospacedGlyphWidthTest.java 8198412 linux-all,solaris-all
java/awt/font/StyledMetrics/BoldSpace.java 8198422 linux-all
java/awt/FontMetrics/FontCrash.java 8198336 windows-all
@@ -247,17 +247,13 @@
sun/java2d/SunGraphics2D/SimplePrimQuality.java 7992007 generic-all
sun/java2d/SunGraphics2D/SourceClippingBlitTest/SourceClippingBlitTest.java 8196191 windows-all,macosx-all
sun/java2d/pipe/InterpolationQualityTest.java 8171303 windows-all,linux-all,macosx-all
-java/awt/FullScreen/BufferStrategyExceptionTest/BufferStrategyExceptionTest.java 8196186 windows-all
java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java 8169469 windows-all
-java/awt/FullScreen/NonExistentDisplayModeTest/NonExistentDisplayModeTest.java 8196187 windows-all
java/awt/Graphics/ClippedCopyAreaTest/ClippedCopyAreaTest.java 8196436 linux-all
-java/awt/Graphics/CopyScaledArea/CopyScaledAreaTest.java 8196189 windows-all
java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java 8197796 generic-all
-java/awt/GraphicsDevice/CloneConfigsTest.java 8196190 windows-all
java/awt/TextArea/TextAreaScrolling/TextAreaScrolling.java 8196300 windows-all
java/awt/print/PrinterJob/Margins.java 8196301 windows-all
-java/awt/print/PrinterJob/PSQuestionMark.java 7003378 windows-all
-java/awt/print/PrinterJob/GlyphPositions.java 7003378 windows-all
+java/awt/print/PrinterJob/PSQuestionMark.java 7003378 generic-all
+java/awt/print/PrinterJob/GlyphPositions.java 7003378 generic-all
java/awt/Choice/PopupPosTest/PopupPosTest.html 8192930 windows-all
java/awt/Choice/ChoiceKeyEventReaction/ChoiceKeyEventReaction.html 6849922 macosx-all
java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 7100044 macosx-all
@@ -402,7 +398,6 @@
java/awt/Modal/MultipleDialogs/MultipleDialogs3Test.java 8198665 macosx-all
java/awt/Modal/MultipleDialogs/MultipleDialogs4Test.java 8198665 macosx-all
java/awt/Modal/MultipleDialogs/MultipleDialogs5Test.java 8198665 macosx-all
-java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java 8196435 linux-all
java/awt/Mouse/EnterExitEvents/DragWindowOutOfFrameTest.java 8177326 macosx-all
java/awt/Mouse/EnterExitEvents/DragWindowTest.java 8023562 macosx-all
java/awt/Mouse/EnterExitEvents/ResizingFrameTest.java 8005021 macosx-all
@@ -429,17 +424,17 @@
java/awt/Modal/ToBack/ToBackDocModal2Test.java 8196441 linux-all,macosx-all
java/awt/Modal/ToBack/ToBackDocModal3Test.java 8196441 linux-all,macosx-all
java/awt/Modal/ToBack/ToBackDocModal4Test.java 8196441 linux-all,macosx-all
-java/awt/Modal/ToBack/ToBackDocModal5Test.java 8196441 linux-all,macosx-all
-java/awt/Modal/ToBack/ToBackModeless1Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackModeless2Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackModeless3Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackModeless4Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackModeless5Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackNonModal1Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackNonModal2Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackNonModal3Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackNonModal4Test.java 8196441 macosx-all
-java/awt/Modal/ToBack/ToBackNonModal5Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackDocModal5Test.java 8196441 linux-all,macosx-all
+java/awt/Modal/ToBack/ToBackModeless1Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackModeless2Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackModeless3Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackModeless4Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackModeless5Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackNonModal1Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackNonModal2Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackNonModal3Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackNonModal4Test.java 8196441 macosx-all
+java/awt/Modal/ToBack/ToBackNonModal5Test.java 8196441 macosx-all
java/awt/Modal/OnTop/OnTopAppModal1Test.java 8198666 macosx-all
java/awt/Modal/OnTop/OnTopAppModal2Test.java 8198666 macosx-all
java/awt/Modal/OnTop/OnTopAppModal3Test.java 8198666 macosx-all
@@ -474,7 +469,12 @@
java/awt/List/SingleModeDeselect/SingleModeDeselect.java 8196301 windows-all
java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java 8061235 macosx-all
javax/print/PrintSEUmlauts/PrintSEUmlauts.java 8135174 generic-all
-
+java/awt/font/GlyphVector/TestLayoutFlags.java 8176510 generic-all
+java/awt/font/TextLayout/LigatureCaretTest.java 8197821 generic-all
+java/awt/Graphics2D/DrawString/RotTransText.java 8197797 generic-all
+java/awt/image/VolatileImage/CustomCompositeTest.java 8199002 windows-all,linux-all
+java/awt/image/VolatileImage/GradientPaints.java 8199003 linux-all
+java/awt/JAWT/JAWT.sh 8197798 windows-all
############################################################################
@@ -627,18 +627,18 @@
javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucentSwing.java 8194128 macosx-all
javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedPerPixelTranslucentGradient.java 8198667 macosx-all
javax/swing/JWindow/ShapedAndTranslucentWindows/SetShapeAndClickSwing.java 8013450 macosx-all
-javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java 8190347 macosx-all
+javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java 8024627 macosx-all
# The next test below is an intermittent failure
javax/swing/JComboBox/8033069/bug8033069ScrollBar.java 8163367 generic-all
javax/swing/JColorChooser/Test6541987.java 8143021 windows-all,linux-all,macosx-all
javax/swing/JColorChooser/Test7194184.java 8194126 linux-all,macosx-all
javax/swing/JTable/7124218/SelectEditTableCell.java 8148958 linux-all
-javax/swing/JTable/4235420/bug4235420.java 8079127 linux-all,macosx-all
+javax/swing/JTable/4235420/bug4235420.java 8079127 generic-all
+javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all
javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all
javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all
javax/swing/JTree/8003400/Test8003400.java 8011259 macosx-all
javax/swing/JFileChooser/8041694/bug8041694.java 8196302 windows-all
-javax/swing/JInternalFrame/8069348/bug8069348.java 8196303 windows-all
javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all
javax/swing/Action/8133039/bug8133039.java 8196089 windows-all,macosx-all
javax/swing/JComboBox/6559152/bug6559152.java 8196090 windows-all,macosx-all
@@ -648,13 +648,11 @@
javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all
javax/swing/JComponent/4337267/bug4337267.java 8146451 windows-all
javax/swing/JEditorPane/5076514/bug5076514.java 8198321 generic-all
-javax/swing/JEditorPane/6917744/bug6917744.java 8194767 generic-all
javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all
javax/swing/JFileChooser/8002077/bug8002077.java 8196094 windows-all
javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.java 8196095 generic-all
javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8058231 macosx-all
javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8193942 generic-all
-javax/swing/JInternalFrame/8020708/bug8020708.java 8194943 windows-all
javax/swing/JList/6462008/bug6462008.java 7156347 generic-all
javax/swing/JPopupMenu/6580930/bug6580930.java 8196096 windows-all,macosx-all
javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all
@@ -684,14 +682,14 @@
javax/swing/MultiUIDefaults/Test6860438.java 8198391 generic-all
javax/swing/MultiUIDefaults/4300666/bug4300666.java 7105119 macosx-all
javax/swing/UITest/UITest.java 8198392 generic-all
-javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 linux-all,macosx-all
+javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 generic-all
javax/swing/plaf/metal/MetalLookAndFeel/Test8039750.java 8198395 generic-all
-javax/swing/text/DevanagariEditor.java 8198397 linux-all
-javax/swing/JColorChooser/Test6199676.java 8198398 linux-all,macosx-all
-javax/swing/JTable/6735286/bug6735286.java 8198398 linux-all,macosx-all
+javax/swing/text/DevanagariEditor.java 8198397 generic-all
+javax/swing/JColorChooser/Test6199676.java 8198398 generic-all
+javax/swing/JTable/6735286/bug6735286.java 8198398 generic-all
javax/swing/SpringLayout/4726194/bug4726194.java 8198399 generic-all
javax/swing/SwingUtilities/6797139/bug6797139.java 8198400 generic-all
-javax/swing/text/html/parser/Parser/6836089/bug6836089.java 8198401 linux-all,macosx-all
+javax/swing/text/html/parser/Parser/6836089/bug6836089.java 8198401 generic-all
javax/swing/JTable/8133919/DrawGridLinesTest.java 8198407 generic-all
javax/swing/text/html/StyleSheet/BackgroundImage/BackgroundImagePosition.java 8198409 generic-all
javax/swing/text/AbstractDocument/DocumentInsert/DocumentInsertAtWrongPositionTest.java 8198396 generic-all
@@ -699,6 +697,25 @@
javax/swing/SwingWorker/6493680/bug6493680.java 8198410 windows-all
javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java 8042383 macosx-all
javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java 8065099 macosx-all
+javax/swing/DataTransfer/8059739/bug8059739.java 8199074 generic-all
+javax/swing/GroupLayout/6613904/bug6613904.java 8199072 generic-all
+javax/swing/JCheckBox/8032667/bug8032667_image_diff.java 8199063 macosx-all
+javax/swing/JComboBox/7031551/bug7031551.java 8199056 generic-all
+javax/swing/JScrollBar/6924059/bug6924059.java 8199078 generic-all
+javax/swing/JTree/8003830/bug8003830.java 8199057 generic-all
+javax/swing/plaf/nimbus/ColorCustomizationTest.java 8199080 generic-all
+javax/swing/SwingWorker/6432565/bug6432565.java 8199077 generic-all
+javax/swing/SwingWorker/6880336/NestedWorkers.java 8199049 windows-all
+javax/swing/text/DefaultCaret/6938583/bug6938583.java 8199058 generic-all
+javax/swing/text/html/parser/Parser/6990651/bug6990651.java 8199060 generic-all
+javax/swing/text/html/parser/Parser/HtmlCommentTagParseTest/HtmlCommentTagParseTest.java 8199073 generic-all
+javax/swing/text/StyledEditorKit/8016833/bug8016833.java 8199055 generic-all
+javax/swing/text/Utilities/8134721/bug8134721.java 8199062 generic-all
+javax/swing/tree/DefaultTreeCellRenderer/7142955/bug7142955.java 8199076 generic-all
+javax/swing/UIDefaults/6302464/bug6302464.java 8199079 generic-all
+javax/swing/UIDefaults/8133926/InternalFrameIcon.java 8199075 generic-all
+javax/swing/UIDefaults/8149879/InternalResourceBundle.java 8199054 windows-all
+javax/swing/text/html/parser/Parser/8078268/bug8078268.java 8199092 generic-all
############################################################################
--- a/test/jdk/TEST.ROOT Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/TEST.ROOT Mon Mar 12 09:37:49 2018 -0700
@@ -17,7 +17,7 @@
keys=2d dnd headful i18n intermittent printer randomness
# Tests that must run in othervm mode
-othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d javax/xml/jaxp/testng/validation java/lang/ProcessHandle
+othervm.dirs=java/awt java/beans javax/accessibility javax/imageio javax/sound javax/swing javax/print javax/management com/sun/awt sun/awt sun/java2d javax/xml/jaxp/testng/validation java/lang/ProcessHandle
# Tests that cannot run concurrently
exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi java/util/stream java/util/Arrays/largeMemory java/util/BitSet/stream javax/rmi
--- a/test/jdk/java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -22,17 +22,14 @@
*/
/*
- @test
- @key headful
- @bug 4977491
- @summary State changes should always be reported as events
- @author anthony.petrov@...: area=awt.toplevel
- @library ../../regtesthelpers
- @build Util
- @run main MaximizedToIconified
-*/
+ * @test
+ * @key headful
+ * @bug 4977491 8160767
+ * @summary State changes should always be reported as events
+ * @run main MaximizedToIconified
+ */
-/**
+/*
* MaximizedToIconified.java
*
* summary: Invoking setExtendedState(ICONIFIED) on a maximized
@@ -40,395 +37,92 @@
* states in the newState of the state change event.
*/
-import java.awt.*;
-import java.awt.event.*;
-import java.util.*;
-import test.java.awt.regtesthelpers.Util;
-
+import java.awt.Frame;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowStateListener;
public class MaximizedToIconified
{
static volatile int lastFrameState = Frame.NORMAL;
static volatile boolean failed = false;
static volatile Toolkit myKit;
+ private static Robot robot;
- private static void checkState(Frame f, int state) {
- f.setExtendedState(state);
- Util.waitForIdle(null);
+ private static void checkState(Frame frame, int state) {
+ frame.setExtendedState(state);
+ robot.waitForIdle();
+ robot.delay(100);
- System.out.println("state = " + state + "; getExtendedState() = " + f.getExtendedState());
+ System.out.println("state = " + state + "; getExtendedState() = " + frame.getExtendedState());
if (failed) {
- MaximizedToIconified.fail("getOldState() != previous getNewState() in WINDOW_STATE_CHANGED event.");
- }
- if (lastFrameState != f.getExtendedState()) {
- MaximizedToIconified.fail("getExtendedState() != last getNewState() in WINDOW_STATE_CHANGED event.");
+ frame.dispose();
+ throw new RuntimeException("getOldState() != previous getNewState() in WINDOW_STATE_CHANGED event.");
}
- if (f.getExtendedState() != state) {
- MaximizedToIconified.fail("getExtendedState() != " + state + " as expected.");
+ if (lastFrameState != frame.getExtendedState()) {
+ frame.dispose();
+ throw new RuntimeException("getExtendedState() != last getNewState() in WINDOW_STATE_CHANGED event.");
}
- // Plain return means the check passed
+ if (frame.getExtendedState() != state) {
+ frame.dispose();
+ throw new RuntimeException("getExtendedState() != " + state + " as expected.");
+ }
}
- private static void examineStates(Frame f_arg, int states[]) {
- Frame f = f_arg;
+ private static void examineStates(int states[]) {
+
+ Frame frame = new Frame("test");
+ frame.setSize(200, 200);
+ frame.setVisible(true);
- if (f == null) {
- f = new Frame("test");
- f.setSize(200, 200);
- f.setVisible(true);
- }
+ robot.waitForIdle();
- Util.waitForIdle(null);
-
- f.addWindowStateListener(new WindowStateListener() {
+ frame.addWindowStateListener(new WindowStateListener() {
public void windowStateChanged(WindowEvent e) {
- System.out.println("last = " + lastFrameState + "; getOldState() = " + e.getOldState() + "; getNewState() = " + e.getNewState());
+ System.out.println("last = " + lastFrameState + "; getOldState() = " + e.getOldState() +
+ "; getNewState() = " + e.getNewState());
if (e.getOldState() == lastFrameState) {
lastFrameState = e.getNewState();
} else {
- System.out.println("Wrong getOldState(): expected = " + lastFrameState + "; received = " + e.getOldState());
+ System.out.println("Wrong getOldState(): expected = " + lastFrameState + "; received = " +
+ e.getOldState());
failed = true;
}
}
});
- for (int state: states) {
+ for (int state : states) {
if (myKit.isFrameStateSupported(state)) {
- checkState(f, state);
+ checkState(frame, state);
} else {
System.out.println("Frame state = " + state + " is NOT supported by the native system. The state is skipped.");
}
}
- if (f_arg == null) {
- f.dispose();
+ if (frame != null) {
+ frame.dispose();
}
}
- private static void init()
- {
- String[] instructions =
- {
- "This is an AUTOMATIC test, simply wait until it is done.",
- "The result (passed or failed) will be shown in the",
- "message window below."
- };
- Sysout.createDialog( );
- Sysout.printInstructions( instructions );
+ private static void doTest() {
myKit = Toolkit.getDefaultToolkit();
// NOTE! Compound states (like MAXIMIZED_BOTH | ICONIFIED) CANNOT be used,
// because Toolkit.isFrameStateSupported() method reports these states
// as not supported. And such states will simply be skipped.
- examineStates(null, new int[] {Frame.MAXIMIZED_BOTH, Frame.ICONIFIED, Frame.NORMAL});
- examineStates(null, new int[] {Frame.ICONIFIED, Frame.MAXIMIZED_BOTH, Frame.NORMAL});
-
-
- MaximizedToIconified.pass();
-
- }//End init()
-
-
-
- /*****************************************************
- * Standard Test Machinery Section
- * DO NOT modify anything in this section -- it's a
- * standard chunk of code which has all of the
- * synchronisation necessary for the test harness.
- * By keeping it the same in all tests, it is easier
- * to read and understand someone else's test, as
- * well as insuring that all tests behave correctly
- * with the test harness.
- * There is a section following this for test-
- * classes
- ******************************************************/
- private static boolean theTestPassed = false;
- private static boolean testGeneratedInterrupt = false;
- private static String failureMessage = "";
-
- private static Thread mainThread = null;
-
- private static int sleepTime = 300000;
-
- // Not sure about what happens if multiple of this test are
- // instantiated in the same VM. Being static (and using
- // static vars), it aint gonna work. Not worrying about
- // it for now.
- public static void main( String args[] ) throws InterruptedException
- {
- mainThread = Thread.currentThread();
- try
- {
- init();
- }
- catch( TestPassedException e )
- {
- //The test passed, so just return from main and harness will
- // interepret this return as a pass
- return;
- }
- //At this point, neither test pass nor test fail has been
- // called -- either would have thrown an exception and ended the
- // test, so we know we have multiple threads.
+ examineStates(new int[] {Frame.MAXIMIZED_BOTH, Frame.ICONIFIED, Frame.NORMAL});
+ examineStates(new int[] {Frame.ICONIFIED, Frame.MAXIMIZED_BOTH, Frame.NORMAL});
- //Test involves other threads, so sleep and wait for them to
- // called pass() or fail()
- try
- {
- Thread.sleep( sleepTime );
- //Timed out, so fail the test
- throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
- }
- catch (InterruptedException e)
- {
- //The test harness may have interrupted the test. If so, rethrow the exception
- // so that the harness gets it and deals with it.
- if( ! testGeneratedInterrupt ) throw e;
-
- //reset flag in case hit this code more than once for some reason (just safety)
- testGeneratedInterrupt = false;
-
- if ( theTestPassed == false )
- {
- throw new RuntimeException( failureMessage );
- }
- }
-
- }//main
-
- public static synchronized void setTimeoutTo( int seconds )
- {
- sleepTime = seconds * 1000;
- }
-
- public static synchronized void pass()
- {
- Sysout.println( "The test passed." );
- Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
- //first check if this is executing in main thread
- if ( mainThread == Thread.currentThread() )
- {
- //Still in the main thread, so set the flag just for kicks,
- // and throw a test passed exception which will be caught
- // and end the test.
- theTestPassed = true;
- throw new TestPassedException();
- }
- theTestPassed = true;
- testGeneratedInterrupt = true;
- mainThread.interrupt();
- }//pass()
-
- public static synchronized void fail()
- {
- //test writer didn't specify why test failed, so give generic
- fail( "it just plain failed! :-)" );
}
- public static synchronized void fail( String whyFailed )
+ public static void main( String args[] ) throws Exception
{
- Sysout.println( "The test failed: " + whyFailed );
- Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
- //check if this called from main thread
- if ( mainThread == Thread.currentThread() )
- {
- //If main thread, fail now 'cause not sleeping
- throw new RuntimeException( whyFailed );
- }
- theTestPassed = false;
- testGeneratedInterrupt = true;
- failureMessage = whyFailed;
- mainThread.interrupt();
- }//fail()
-
-}// class MaximizedToIconified
-
-//This exception is used to exit from any level of call nesting
-// when it's determined that the test has passed, and immediately
-// end the test.
-class TestPassedException extends RuntimeException
-{
-}
-
-//*********** End Standard Test Machinery Section **********
-
-
-//************ Begin classes defined for the test ****************
-
-// if want to make listeners, here is the recommended place for them, then instantiate
-// them in init()
-
-/* Example of a class which may be written as part of a test
-class NewClass implements anInterface
- {
- static int newVar = 0;
-
- public void eventDispatched(AWTEvent e)
- {
- //Counting events to see if we get enough
- eventCount++;
-
- if( eventCount == 20 )
- {
- //got enough events, so pass
+ robot = new Robot();
+ doTest();
- MaximizedToIconified.pass();
- }
- else if( tries == 20 )
- {
- //tried too many times without getting enough events so fail
-
- MaximizedToIconified.fail();
- }
-
- }// eventDispatched()
-
- }// NewClass class
-
-*/
-
-
-//************** End classes defined for the test *******************
-
-
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
- chunk of code whose purpose is to make user
- interaction uniform, and thereby make it simpler
- to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method. Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
- as standalone.
- */
-
-class Sysout
-{
- private static TestDialog dialog;
-
- public static void createDialogWithInstructions( String[] instructions )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- dialog.printInstructions( instructions );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
}
- public static void createDialog( )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- String[] defInstr = { "Instructions will appear here. ", "" } ;
- dialog.printInstructions( defInstr );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
-
- public static void printInstructions( String[] instructions )
- {
- dialog.printInstructions( instructions );
- }
-
-
- public static void println( String messageIn )
- {
- dialog.displayMessage( messageIn );
- System.out.println(messageIn);
- }
-
-}// Sysout class
-
-/**
- This is part of the standard test machinery. It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
-class TestDialog extends Dialog
-{
-
- TextArea instructionsText;
- TextArea messageText;
- int maxStringLength = 80;
-
- //DO NOT call this directly, go through Sysout
- public TestDialog( Frame frame, String name )
- {
- super( frame, name );
- int scrollBoth = TextArea.SCROLLBARS_BOTH;
- instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
- add( "North", instructionsText );
-
- messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
- add("Center", messageText);
-
- pack();
-
- setVisible(true);
- }// TestDialog()
-
- //DO NOT call this directly, go through Sysout
- public void printInstructions( String[] instructions )
- {
- //Clear out any current instructions
- instructionsText.setText( "" );
-
- //Go down array of instruction strings
-
- String printStr, remainingStr;
- for( int i=0; i < instructions.length; i++ )
- {
- //chop up each into pieces maxSringLength long
- remainingStr = instructions[ i ];
- while( remainingStr.length() > 0 )
- {
- //if longer than max then chop off first max chars to print
- if( remainingStr.length() >= maxStringLength )
- {
- //Try to chop on a word boundary
- int posOfSpace = remainingStr.
- lastIndexOf( ' ', maxStringLength - 1 );
-
- if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
- printStr = remainingStr.substring( 0, posOfSpace + 1 );
- remainingStr = remainingStr.substring( posOfSpace + 1 );
- }
- //else just print
- else
- {
- printStr = remainingStr;
- remainingStr = "";
- }
-
- instructionsText.append( printStr + "\n" );
-
- }// while
-
- }// for
-
- }//printInstructions()
-
- //DO NOT call this directly, go through Sysout
- public void displayMessage( String messageIn )
- {
- messageText.append( messageIn + "\n" );
- System.out.println(messageIn);
- }
-
-}// TestDialog class
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/FullScreen/AllFramesMaximize/AllFramesMaximize.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8190767
+ * @key headful
+ * @requires os.family == "mac"
+ * @summary If JFrame is maximized on OS X, all new JFrames will be maximized by default
+ * @compile AllFramesMaximize.java
+ * @run main/manual AllFramesMaximize
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JButton;
+import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class AllFramesMaximize {
+ private static JButton passButton;
+ private static JButton failButton;
+ private static JTextArea instructions;
+ private static JFrame mainFrame;
+ private static JFrame instructionFrame;
+ public static boolean isProgInterruption = false;
+ static Thread mainThread = null;
+ static int sleepTime = 300000;
+
+ public static void createAndShowJFrame() {
+ passButton = new JButton("Pass");
+ passButton.setEnabled(true);
+
+ failButton = new JButton("Fail");
+ failButton.setEnabled(true);
+
+ instructions = new JTextArea(8, 30);
+ instructions.setText(" This is a manual test\n\n" +
+ " 1) Click on the maximize button, JFrame will enter fullscreen\n" +
+ " 2) Click anywhere on the JFrame\n" +
+ " 3) Press Pass if new JFrame didn't open in fullscreen,\n" +
+ " 4) Press Fail if new JFrame opened in fullscreen");
+
+ instructionFrame = new JFrame("Test Instructions");
+ instructionFrame.setLocationRelativeTo(null);
+ instructionFrame.add(passButton);
+ instructionFrame.add(failButton);
+ instructionFrame.add(instructions);
+ instructionFrame.setSize(200,200);
+ instructionFrame.setLayout(new FlowLayout());
+ instructionFrame.pack();
+ instructionFrame.setVisible(true);
+
+ passButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent ae) {
+ dispose();
+ isProgInterruption = true;
+ mainThread.interrupt();
+ }
+ });
+
+ failButton.addActionListener(new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent ae) {
+ dispose();
+ isProgInterruption = true;
+ mainThread.interrupt();
+ throw new RuntimeException("New JFrame opened on a new window!");
+ }
+ });
+
+ mainFrame = new JFrame();
+ JButton button = new JButton("Open Frame");
+ mainFrame.getContentPane().add(button);
+ button.addActionListener(
+ new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ JFrame f = new JFrame();
+ f.setSize(400, 400);
+ f.setVisible(true);
+ }
+ });
+ mainFrame.setSize(500, 500);
+ mainFrame.setVisible(true);
+ }
+
+ private static void dispose() {
+ mainFrame.dispose();
+ instructionFrame.dispose();
+ }
+
+ public static void main(String[] args) throws Exception {
+ mainThread = Thread.currentThread();
+ SwingUtilities.invokeAndWait(AllFramesMaximize::createAndShowJFrame);
+
+ try {
+ mainThread.sleep(sleepTime);
+ } catch (InterruptedException e) {
+ if (!isProgInterruption) {
+ throw e;
+ }
+ } finally {
+ SwingUtilities.invokeAndWait(AllFramesMaximize::dispose);
+ }
+
+ if (!isProgInterruption) {
+ throw new RuntimeException("Timed out after " + sleepTime / 1000
+ + " seconds");
+ }
+ }
+}
+
--- a/test/jdk/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/FullScreen/AltTabCrashTest/AltTabCrashTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,14 +24,13 @@
/*
@test
@key headful
- @bug 6275887 6429971 6459792
+ @bug 6275887 6429971 6459792 8198613
@summary Test that we don't crash when alt+tabbing in and out of
fullscreen app
@author Dmitri.Trembovetski@sun.com: area=FullScreen
@run main/othervm/timeout=100 AltTabCrashTest -auto -changedm
@run main/othervm/timeout=100 -Dsun.java2d.d3d=True AltTabCrashTest -auto -changedm
@run main/othervm/timeout=100 -Dsun.java2d.d3d=True AltTabCrashTest -auto -usebs -changedm
- @run main/othervm/timeout=100 -Dsun.java2d.opengl=True AltTabCrashTest -auto
*/
import java.awt.AWTException;
--- a/test/jdk/java/awt/FullScreen/BufferStrategyExceptionTest/BufferStrategyExceptionTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/FullScreen/BufferStrategyExceptionTest/BufferStrategyExceptionTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -24,11 +24,10 @@
/**
* @test
* @key headful
- * @bug 6366813 6459844
+ * @bug 6366813 6459844 8198613
* @summary Tests that no exception is thrown if a frame is resized just
* before we create a bufferStrategy
* @author Dmitri.Trembovetski area=FullScreen/BufferStrategy
- * @run main/othervm -Dsun.java2d.opengl=true BufferStrategyExceptionTest
* @run main/othervm BufferStrategyExceptionTest
*/
--- a/test/jdk/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -24,12 +24,11 @@
/**
* @test
* @key headful
- * @bug 6366359
+ * @bug 6366359 8198613
* @summary Test that we don't crash when changing from 8 to 16/32 bit modes
* @author Dmitri.Trembovetski@Sun.COM area=FullScreen
* @run main/othervm/timeout=200 DisplayChangeVITest
* @run main/othervm/timeout=200 -Dsun.java2d.d3d=false DisplayChangeVITest
- * @run main/othervm/timeout=200 -Dsun.java2d.opengl=true DisplayChangeVITest
*/
import java.awt.Color;
--- a/test/jdk/java/awt/FullScreen/MultimonFullscreenTest/MultimonFullscreenTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/FullScreen/MultimonFullscreenTest/MultimonFullscreenTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -23,12 +23,7 @@
/**
* @test
- * @bug 5041219
- * @bug 5101561
- * @bug 5035272
- * @bug 5096011
- * @bug 5101712
- * @bug 5098624
+ * @bug 5041219 5101561 5035272 5096011 5101712 5098624 8198613
* @summary Here are a few assertions worth verification:
* - the fullscreen window is positioned at 0,0
* - the fs window appears on the correct screen
@@ -49,7 +44,7 @@
* @run main/manual/othervm -Dsun.java2d.pmoffscreen=false MultimonFullscreenTest
* @run main/manual/othervm -Dsun.java2d.d3d=True MultimonFullscreenTest
* @run main/manual/othervm -Dsun.java2d.noddraw=true MultimonFullscreenTest
- * @run main/manual/othervm -Dsun.java2d.opengl=True MultimonFullscreenTest
+ * @run main/manual/othervm MultimonFullscreenTest
*/
import java.awt.Button;
--- a/test/jdk/java/awt/FullScreen/NonExistentDisplayModeTest/NonExistentDisplayModeTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/FullScreen/NonExistentDisplayModeTest/NonExistentDisplayModeTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -32,12 +32,11 @@
/**
* @test
* @key headful
- * @bug 6430607
+ * @bug 6430607 8198613
* @summary Test that we throw an exception for incorrect display modes
* @author Dmitri.Trembovetski@Sun.COM area=FullScreen
* @run main/othervm NonExistentDisplayModeTest
* @run main/othervm -Dsun.java2d.noddraw=true NonExistentDisplayModeTest
- * @run main/othervm -Dsun.java2d.opengl=true NonExistentDisplayModeTest
*/
public class NonExistentDisplayModeTest {
--- a/test/jdk/java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/FullScreen/UninitializedDisplayModeChangeTest/UninitializedDisplayModeChangeTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -23,13 +23,12 @@
/**
* @test
- * @bug 6358034 6568560
+ * @bug 6358034 6568560 8198613
* @key headful
* @summary Tests that no exception is thrown when display mode is changed
* externally
* @compile UninitializedDisplayModeChangeTest.java DisplayModeChanger.java
* @run main/othervm UninitializedDisplayModeChangeTest
- * @run main/othervm -Dsun.java2d.opengl=true UninitializedDisplayModeChangeTest
*/
import java.awt.EventQueue;
--- a/test/jdk/java/awt/Graphics/CopyScaledArea/CopyScaledAreaTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/Graphics/CopyScaledArea/CopyScaledAreaTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,11 +29,10 @@
/**
* @test
* @key headful
- * @bug 8069348
+ * @bug 8069348 8198613
* @summary SunGraphics2D.copyArea() does not properly work for scaled graphics
* @modules java.desktop/sun.awt
* @run main/othervm -Dsun.java2d.uiScale=2 CopyScaledAreaTest
- * @run main/othervm -Dsun.java2d.opengl=true -Dsun.java2d.uiScale=2 CopyScaledAreaTest
* @run main/othervm -Dsun.java2d.d3d=true -Dsun.java2d.uiScale=2 CopyScaledAreaTest
* @run main/othervm -Dsun.java2d.d3d=false -Dsun.java2d.opengl=false
* -Dsun.java2d.uiScale=2 CopyScaledAreaTest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Graphics2D/CopyAreaOOB.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2015, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @key headful
+ * @bug 6430601 8198613
+ * @summary Verifies that copyArea() works properly when the
+ * destination parameters are outside the destination bounds.
+ * @run main/othervm CopyAreaOOB
+ * @author campbelc
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+public class CopyAreaOOB extends Canvas {
+
+ private static boolean done;
+
+ public void paint(Graphics g) {
+ synchronized (this) {
+ if (done) {
+ return;
+ }
+ }
+
+ int w = getWidth();
+ int h = getHeight();
+
+ Graphics2D g2d = (Graphics2D)g;
+ g2d.setColor(Color.black);
+ g2d.fillRect(0, 0, w, h);
+
+ g2d.setColor(Color.green);
+ g2d.fillRect(0, 0, w, 10);
+
+ g2d.setColor(Color.red);
+ g2d.fillRect(0, 10, 50, h-10);
+
+ // copy the region such that part of it goes below the bottom of the
+ // destination surface
+ g2d.copyArea(0, 10, 50, h-10, 60, 10);
+
+ Toolkit.getDefaultToolkit().sync();
+
+ synchronized (this) {
+ done = true;
+ notifyAll();
+ }
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(400, 400);
+ }
+
+ private static void testRegion(BufferedImage bi, String name,
+ int x1, int y1, int x2, int y2,
+ int expected)
+ {
+ for (int y = y1; y < y2; y++) {
+ for (int x = x1; x < x2; x++) {
+ int actual = bi.getRGB(x, y);
+ if (actual != expected) {
+ throw new RuntimeException("Test failed for " + name +
+ " region at x="+x+" y="+y+
+ " (expected="+
+ Integer.toHexString(expected) +
+ " actual="+
+ Integer.toHexString(actual) +
+ ")");
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ boolean show = (args.length == 1) && ("-show".equals(args[0]));
+
+ CopyAreaOOB test = new CopyAreaOOB();
+ Frame frame = new Frame();
+ frame.setUndecorated(true);
+ frame.add(test);
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+
+ // Wait until the component's been painted
+ synchronized (test) {
+ while (!done) {
+ try {
+ test.wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Failed: Interrupted");
+ }
+ }
+ }
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException ex) {}
+
+ // Grab the screen region
+ BufferedImage capture = null;
+ try {
+ Robot robot = new Robot();
+ Point pt1 = test.getLocationOnScreen();
+ Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400);
+ capture = robot.createScreenCapture(rect);
+ } catch (Exception e) {
+ throw new RuntimeException("Problems creating Robot");
+ } finally {
+ if (!show) {
+ frame.dispose();
+ }
+ }
+
+ // Test pixels
+ testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00);
+ testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000);
+ testRegion(capture, "background", 50, 10, 60, 400, 0xff000000);
+ testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000);
+ testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000);
+ testRegion(capture, "background", 110, 10, 400, 400, 0xff000000);
+ }
+}
--- a/test/jdk/java/awt/GraphicsDevice/CloneConfigsTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/GraphicsDevice/CloneConfigsTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, 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
@@ -24,14 +24,13 @@
/*
* @test
* @key headful
- * @bug 6822057 7124400 8059848
+ * @bug 6822057 7124400 8059848 8198613
*
* @summary Test verifies that list of supported graphics configurations
* can not be changed via modification of elements of an array
* returned by getConfiguration() method.
*
* @run main CloneConfigsTest
- * @run main/othervm -Dsun.java2d.opengl=True CloneConfigsTest
* @run main/othervm -Dsun.java2d.d3d=true CloneConfigsTest
* @run main/othervm -Dsun.java2d.noddraw=true CloneConfigsTest
*/
--- a/test/jdk/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/Mouse/GetMousePositionTest/GetMousePositionWithOverlay.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -21,89 +21,95 @@
* questions.
*/
-import test.java.awt.regtesthelpers.Util;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Rectangle;
-import javax.swing.*;
-import java.awt.*;
-import java.util.concurrent.atomic.AtomicReference;
-
-/**
+/*
* @test
* @key headful
- * @bug 8012026
+ * @bug 8012026 8196435
* @summary Component.getMousePosition() does not work in an applet on MacOS
- * @author Petr Pchelko
- * @library ../../regtesthelpers
- * @build Util
- * @compile GetMousePositionWithOverlay.java
- * @run main/othervm GetMousePositionWithOverlay
+ * @run main GetMousePositionWithOverlay
*/
public class GetMousePositionWithOverlay {
- static Frame backFrame;
- static Frame frontFrame;
+ private static Frame backFrame;
+ private static Frame frontFrame;
+ private static Robot robot;
public static void main(String[] args) throws Throwable {
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- constructTestUI();
- }
- });
- Util.waitForIdle(null);
-
- Robot r = new Robot();
- Util.pointOnComp(frontFrame, r);
- Util.waitForIdle(null);
-
- Point pos = getMousePosition(backFrame);
- if (pos != null) {
- throw new RuntimeException("Test failed. Mouse position should be null but was" + pos);
- }
+ robot = new Robot();
- pos = getMousePosition(frontFrame);
- if (pos == null) {
- throw new RuntimeException("Test failed. Mouse position should not be null");
- }
-
- r.mouseMove(189, 189);
- Util.waitForIdle(null);
+ try{
+ constructTestUI();
+ } catch (Exception e) {
+ dispose();
+ throw new RuntimeException("Unexpected Exception!");
+ }
- pos = getMousePosition(backFrame);
- if (pos == null) {
- throw new RuntimeException("Test failed. Mouse position should not be null");
- }
- } finally {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- backFrame.dispose();
- frontFrame.dispose();
- }
- });
- }
+ robot.waitForIdle();
+
+ doTest();
+ dispose();
}
- private static Point getMousePosition(final Component component) throws Exception {
- final AtomicReference<Point> pos = new AtomicReference<Point>();
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- pos.set(component.getMousePosition());
- }
- });
- return pos.get();
+ private static void doTest() {
+
+ frontFrame.toFront();
+ robot.waitForIdle();
+
+ Rectangle bounds = new Rectangle(frontFrame.getLocationOnScreen(), frontFrame.getSize());
+ robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
+ robot.waitForIdle();
+
+ Point pos = backFrame.getMousePosition();
+ if (pos != null) {
+ dispose();
+ throw new RuntimeException("Test failed. Mouse position should be null but was " + pos);
+ }
+
+ pos = frontFrame.getMousePosition();
+ if (pos == null) {
+ dispose();
+ throw new RuntimeException("Test failed. Mouse position should not be null");
+ }
+
+ robot.mouseMove(189, 189);
+ robot.waitForIdle();
+
+ pos = backFrame.getMousePosition();
+ if (pos == null) {
+ dispose();
+ throw new RuntimeException("Test failed. Mouse position should not be null");
+ }
+
+ }
+
+ private static void dispose() {
+
+ if (backFrame != null) {
+ backFrame.dispose();
+ }
+
+ if (frontFrame != null) {
+ frontFrame.dispose();
+ }
}
private static void constructTestUI() {
backFrame = new Frame();
backFrame.setBounds(100, 100, 100, 100);
+ backFrame.setResizable(false);
backFrame.setVisible(true);
frontFrame = new Frame();
frontFrame.setBounds(120, 120, 60, 60);
+ frontFrame.setResizable(false);
frontFrame.setVisible(true);
+
}
}
+
--- a/test/jdk/java/awt/Multiscreen/DeviceIdentificationTest/DeviceIdentificationTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/Multiscreen/DeviceIdentificationTest/DeviceIdentificationTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -22,7 +22,7 @@
*/
/**
* @test
- * @bug 6614214
+ * @bug 6614214 8198613
* @summary Verifies that we enter the fs mode on the correct screen.
* Here is how to test: start the test on on a multi-screen system.
* Verify that the display is correctly tracked by dragging the frame back
@@ -40,7 +40,6 @@
*
* @run main/manual/othervm DeviceIdentificationTest
* @run main/manual/othervm -Dsun.java2d.noddraw=true DeviceIdentificationTest
- * @run main/manual/othervm -Dsun.java2d.opengl=True DeviceIdentificationTest
*/
import java.awt.Button;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/ScrollPane/ScrollPaneValidateTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @key headful
+ * @bug 8195738
+ * @summary scroll position in ScrollPane is reset after calling validate()
+ * @run main ScrollPaneValidateTest
+ */
+
+import java.awt.ScrollPane;
+import java.awt.BorderLayout;
+import java.awt.GridLayout;
+import java.awt.Button;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.AWTException;
+
+public class ScrollPaneValidateTest extends Frame {
+ ScrollPane pane;
+
+ public ScrollPaneValidateTest() {
+ setBounds(300, 300, 300, 300);
+ pane = new ScrollPane(ScrollPane.SCROLLBARS_NEVER);
+ add(pane, BorderLayout.NORTH);
+ pane.add(new InnerPanel());
+ }
+
+ public static void main(String[] args) throws AWTException {
+ Robot robot = new Robot();
+ final ScrollPaneValidateTest obj = new ScrollPaneValidateTest();
+ obj.setVisible(true);
+
+ // set to some scroll position
+ obj.pane.setScrollPosition(600, 200);
+
+ // get the newly set position
+ Point scrollPosition = obj.pane.getScrollPosition();
+
+ // call validate multiple times
+ obj.pane.validate();
+ robot.delay(1000);
+ obj.pane.validate();
+ robot.delay(1000);
+
+ // compare position after calling the validate function
+ if(!scrollPosition.equals(obj.pane.getScrollPosition())) {
+ obj.dispose();
+ throw new RuntimeException("Scrolling position is changed in ScrollPane");
+ }
+
+ obj.dispose();
+ return;
+ }
+
+ class InnerPanel extends Panel {
+ public InnerPanel() {
+ this.setLayout(new GridLayout(2, 4));
+ for (int i = 1; i <= 8; i++) {
+ this.add(new Button("Button" + i));
+ }
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(980, 200);
+ }
+ }
+}
--- a/test/jdk/java/awt/Window/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/Window/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -23,14 +23,13 @@
/*
* @test %I% %E%
- * @bug 6655001 6670649 6687141
+ * @bug 6655001 6670649 6687141 8198613
* @summary Tests that hw acceleration doesn't affect translucent/shaped windows
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @compile -XDignore.symbol.file=true TranslucentShapedFrameTest.java
* @compile -XDignore.symbol.file=true TSFrame.java
* @run main/manual/othervm TranslucentShapedFrameTest
* @run main/manual/othervm -Dsun.java2d.noddraw=true TranslucentShapedFrameTest
- * @run main/manual/othervm -Dsun.java2d.opengl=True TranslucentShapedFrameTest
*/
import java.awt.Color;
import java.awt.Frame;
--- a/test/jdk/java/awt/font/TextLayout/TestAATMorxFont.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/font/TextLayout/TestAATMorxFont.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -23,17 +23,20 @@
*/
/* @test
- * @key headful
+ * @bug 8031462 8198406
+ * @requires (os.family == "mac")
* @summary verify rendering of MORX fonts on OS X.
- * @bug 8031462
*/
-import javax.swing.*;
-import javax.swing.border.LineBorder;
-import java.awt.*;
-import java.awt.event.ActionEvent;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
-public class TestAATMorxFont extends JComponent {
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+
+public class TestAATMorxFont {
public static void main(String[] args) {
String osName = System.getProperty("os.name");
System.out.println("OS is " + osName);
@@ -41,23 +44,13 @@
if (!osName.startsWith("mac")) {
return;
}
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- JFrame frame = new JFrame("Test Morx");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- TestAATMorxFont panel = new TestAATMorxFont();
- frame.add(panel);
- frame.pack();
- frame.setVisible(true);
- }
- });
+ BufferedImage bi = new BufferedImage(1200, 400, TYPE_INT_ARGB);
+ Graphics g = bi.getGraphics();
+ test(g);
+ g.dispose();
}
- public Dimension getPreferredSize() {
- return new Dimension(1200, 400);
- }
-
- public void paintComponent(Graphics g) {
+ private static void test(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/image/VolatileImage/CustomCompositeTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2012, 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @key headful
+ * @bug 7124347 8198613
+ * @summary Verifies that rendering with XOR composite, and arbitraty
+ * custom composite doesn not cause internal errors.
+ *
+ * @run main/othervm CustomCompositeTest
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.CompositeContext;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.ImageCapabilities;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DataBufferInt;
+import java.awt.image.Raster;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.VolatileImage;
+import java.awt.image.WritableRaster;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+public class CustomCompositeTest {
+
+ private static JFrame frame;
+ private static CountDownLatch paintLatch;
+ private static Throwable paintError;
+
+ public static void main(String[] args) {
+
+ paintLatch = new CountDownLatch(1);
+ paintError = null;
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ initGUI();
+ }
+ });
+
+ try {
+ paintLatch.await();
+ } catch (InterruptedException e) {
+ };
+ System.out.println("Paint is done!");
+ if (paintError != null) {
+ frame.dispose();
+ throw new RuntimeException("Test FAILED.", paintError);
+ }
+
+ System.out.println("Phase 1: PASSED.");
+
+ // now resise the frame in order to cause re-paint with accelerated
+ // source images.
+ paintError = null;
+ paintLatch = new CountDownLatch(1);
+
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ Dimension size = frame.getSize();
+ size.width += 50;
+ size.height += 50;
+
+ frame.setSize(size);
+ }
+ });
+
+ try {
+ paintLatch.await();
+ } catch (InterruptedException e) {
+ };
+ if (paintError != null) {
+ frame.dispose();
+ throw new RuntimeException("Resize test FAILED.", paintError);
+ }
+ frame.dispose();
+ System.out.println("Phase 2: PASSED.");
+
+ GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsConfiguration cfg = env.getDefaultScreenDevice().getDefaultConfiguration();
+ // test rendering to accelerated volatile image
+ testVolatileImage(cfg, true);
+ System.out.println("Phase 3: PASSED.");
+
+ // test rendering to unaccelerated volatile image
+ testVolatileImage(cfg, false);
+ System.out.println("Phase 4: PASSED.");
+ }
+
+ private static void testVolatileImage(GraphicsConfiguration cfg,
+ boolean accelerated)
+ {
+ VolatileImage dst = null;
+ try {
+ dst = cfg.createCompatibleVolatileImage(640, 480,
+ new ImageCapabilities(accelerated));
+ } catch (AWTException e) {
+ System.out.println("Unable to create volatile image, skip the test.");
+ return;
+ }
+ renderToVolatileImage(dst);
+ }
+
+ private static void renderToVolatileImage(VolatileImage dst) {
+ Graphics2D g = dst.createGraphics();
+ do {
+ System.out.println("Render to volatile image..");
+ try {
+ MyComp.renderTest(g, dst.getHeight(), dst.getHeight());
+ } catch (Throwable e) {
+ throw new RuntimeException("Test FAILED.", e);
+ }
+ } while (dst.contentsLost());
+ System.out.println("Done.");
+ }
+
+ private static void initGUI() {
+ frame = new JFrame("Silly composite");
+ frame.getContentPane().add(new MyComp());
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.pack();
+ frame.setVisible(true);
+ }
+
+ private static class MyComp extends JComponent {
+
+ private static BufferedImage theImage;
+
+ public MyComp() {
+ }
+
+ private static BufferedImage getTestImage() {
+ if (theImage == null) {
+ theImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
+ Graphics2D g2d = theImage.createGraphics();
+ g2d.setColor(Color.red);
+ g2d.fillRect(0, 0, 256, 256);
+
+ g2d.setPaint(new GradientPaint(0, 0, Color.red, 256, 256, Color.blue));
+ g2d.fillRect(0, 100, 256, 256);
+ g2d.dispose();
+ }
+ return theImage;
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(640, 375);
+ }
+
+ public void paintComponent(Graphics g) {
+
+
+ Graphics2D g2d = (Graphics2D) g;
+ try {
+ renderTest(g2d, getWidth(), getHeight());
+ } catch (Throwable e) {
+ paintError = e;
+ }
+ if (paintLatch != null) {
+ paintLatch.countDown();
+ }
+ }
+
+ public static void renderTest(Graphics2D g2d, int w, int h) {
+ g2d.setColor(Color.yellow);
+ g2d.fillRect(0, 0, w, h);
+
+ BufferedImage image = getTestImage();
+ // draw original image
+ g2d.drawRenderedImage(image, null);
+
+ // draw image with custom composite
+ g2d.translate(175, 25);
+ Composite currentComposite = g2d.getComposite();
+ g2d.setComposite(new TestComposite());
+ g2d.drawRenderedImage(image, null);
+ g2d.setComposite(currentComposite);
+
+ // draw image with XOR
+ g2d.translate(175, 25);
+ g2d.setXORMode(Color.red);
+ g2d.drawRenderedImage(image, null);
+
+
+ System.out.println("Painting is done...");
+ }
+ }
+
+ // A silly custom Composite to demonstrate the problem - just inverts the RGB
+ private static class TestComposite implements Composite {
+
+ public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) {
+ return new TestCompositeContext();
+ }
+ }
+
+ private static class TestCompositeContext implements CompositeContext {
+
+ public void dispose() {
+ }
+
+ public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
+ int w = src.getWidth();
+ int h = src.getHeight();
+
+ DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer();
+ DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer();
+ int srcRGB[] = srcDB.getBankData()[0];
+ int dstOutRGB[] = dstOutDB.getBankData()[0];
+ int srcOffset = srcDB.getOffset();
+ int dstOutOffset = dstOutDB.getOffset();
+ int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride();
+ int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride();
+ int srcAdjust = srcScanStride - w;
+ int dstOutAdjust = dstOutScanStride - w;
+
+ int si = srcOffset;
+ int doi = dstOutOffset;
+
+ for (int i = 0; i < h; i++) {
+ for (int j = 0; j < w; j++) {
+ dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff;
+ si++;
+ doi++;
+ }
+
+ si += srcAdjust;
+ doi += dstOutAdjust;
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/image/VolatileImage/DrawBufImgOp.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2007, 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @key headful
+ * @bug 6514990 8198613
+ * @summary Verifies that calling
+ * Graphics2D.drawImage(BufferedImage, BufferedImageOp, x, y) to an
+ * accelerated destination produces the same results when performed
+ * in software via BufferedImageOp.filter().
+ * @run main/othervm DrawBufImgOp -ignore
+ * @author campbelc
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+import java.io.File;
+import javax.imageio.ImageIO;
+
+/**
+ * REMIND: This testcase was originally intended to automatically compare
+ * the results of the software BufferedImageOp implementations against
+ * the OGL-accelerated codepaths. However, there are just too many open
+ * bugs in the mediaLib-based codepaths (see below), which means that
+ * creating the reference image may cause crashes or exceptions,
+ * and even if we work around those cases using the "-ignore" flag,
+ * the visual results of the reference image are often buggy as well
+ * (so the comparison will fail even though the OGL results are correct).
+ * Therefore, for now we will run the testcase with the "-ignore" flag
+ * but without the "-compare" flag, so at least it will be checking for
+ * any exceptions/crashes in the OGL code. When we fix all of the
+ * outstanding bugs with the software codepaths, we can remove the
+ * "-ignore" flag and maybe even restore the "-compare" flag. In the
+ * meantime, it stil functions well as a manual testcase (with either
+ * the "-show" or "-dump" options).
+ */
+public class DrawBufImgOp extends Canvas {
+
+ private static final int TESTW = 600;
+ private static final int TESTH = 500;
+ private static boolean done;
+
+ /*
+ * If true, skips tests that are known to trigger bugs (which in
+ * turn may cause crashes, exceptions, or other artifacts).
+ */
+ private static boolean ignore;
+
+ // Test both pow2 and non-pow2 sized images
+ private static final int[] srcSizes = { 32, 17 };
+ private static final int[] srcTypes = {
+ BufferedImage.TYPE_INT_RGB,
+ BufferedImage.TYPE_INT_ARGB,
+ BufferedImage.TYPE_INT_ARGB_PRE,
+ BufferedImage.TYPE_INT_BGR,
+ BufferedImage.TYPE_3BYTE_BGR,
+ BufferedImage.TYPE_4BYTE_ABGR,
+ BufferedImage.TYPE_USHORT_565_RGB,
+ BufferedImage.TYPE_BYTE_GRAY,
+ BufferedImage.TYPE_USHORT_GRAY,
+ };
+
+ private static final RescaleOp
+ rescale1band, rescale3band, rescale4band;
+ private static final LookupOp
+ lookup1bandbyte, lookup3bandbyte, lookup4bandbyte;
+ private static final LookupOp
+ lookup1bandshort, lookup3bandshort, lookup4bandshort;
+ private static final ConvolveOp
+ convolve3x3zero, convolve5x5zero, convolve7x7zero;
+ private static final ConvolveOp
+ convolve3x3noop, convolve5x5noop, convolve7x7noop;
+
+ static {
+ rescale1band = new RescaleOp(0.5f, 10.0f, null);
+ rescale3band = new RescaleOp(
+ new float[] { 0.6f, 0.4f, 0.6f },
+ new float[] { 10.0f, -3.0f, 5.0f },
+ null);
+ rescale4band = new RescaleOp(
+ new float[] { 0.6f, 0.4f, 0.6f, 0.9f },
+ new float[] { -1.0f, 5.0f, 3.0f, 1.0f },
+ null);
+
+ // REMIND: we should probably test non-zero offsets, but that
+ // would require massaging the source image data to avoid going
+ // outside the lookup table array bounds
+ int offset = 0;
+ {
+ byte invert[] = new byte[256];
+ byte halved[] = new byte[256];
+ for (int j = 0; j < 256 ; j++) {
+ invert[j] = (byte) (255-j);
+ halved[j] = (byte) (j / 2);
+ }
+ ByteLookupTable lut1 = new ByteLookupTable(offset, invert);
+ lookup1bandbyte = new LookupOp(lut1, null);
+ ByteLookupTable lut3 =
+ new ByteLookupTable(offset,
+ new byte[][] {invert, halved, invert});
+ lookup3bandbyte = new LookupOp(lut3, null);
+ ByteLookupTable lut4 =
+ new ByteLookupTable(offset,
+ new byte[][] {invert, halved, invert, halved});
+ lookup4bandbyte = new LookupOp(lut4, null);
+ }
+
+ {
+ short invert[] = new short[256];
+ short halved[] = new short[256];
+ for (int j = 0; j < 256 ; j++) {
+ invert[j] = (short) ((255-j) * 255);
+ halved[j] = (short) ((j / 2) * 255);
+ }
+ ShortLookupTable lut1 = new ShortLookupTable(offset, invert);
+ lookup1bandshort = new LookupOp(lut1, null);
+ ShortLookupTable lut3 =
+ new ShortLookupTable(offset,
+ new short[][] {invert, halved, invert});
+ lookup3bandshort = new LookupOp(lut3, null);
+ ShortLookupTable lut4 =
+ new ShortLookupTable(offset,
+ new short[][] {invert, halved, invert, halved});
+ lookup4bandshort = new LookupOp(lut4, null);
+ }
+
+ // 3x3 blur
+ float[] data3 = {
+ 0.1f, 0.1f, 0.1f,
+ 0.1f, 0.2f, 0.1f,
+ 0.1f, 0.1f, 0.1f,
+ };
+ Kernel k3 = new Kernel(3, 3, data3);
+
+ // 5x5 edge
+ float[] data5 = {
+ -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
+ -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
+ -1.0f, -1.0f, 24.0f, -1.0f, -1.0f,
+ -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
+ -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
+ };
+ Kernel k5 = new Kernel(5, 5, data5);
+
+ // 7x7 blur
+ float[] data7 = {
+ 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
+ 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
+ 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
+ 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
+ 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
+ 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
+ 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
+ };
+ Kernel k7 = new Kernel(7, 7, data7);
+
+ convolve3x3zero = new ConvolveOp(k3, ConvolveOp.EDGE_ZERO_FILL, null);
+ convolve5x5zero = new ConvolveOp(k5, ConvolveOp.EDGE_ZERO_FILL, null);
+ convolve7x7zero = new ConvolveOp(k7, ConvolveOp.EDGE_ZERO_FILL, null);
+
+ convolve3x3noop = new ConvolveOp(k3, ConvolveOp.EDGE_NO_OP, null);
+ convolve5x5noop = new ConvolveOp(k5, ConvolveOp.EDGE_NO_OP, null);
+ convolve7x7noop = new ConvolveOp(k7, ConvolveOp.EDGE_NO_OP, null);
+ }
+
+ public void paint(Graphics g) {
+ synchronized (this) {
+ if (done) {
+ return;
+ }
+ }
+
+ VolatileImage vimg = createVolatileImage(TESTW, TESTH);
+ vimg.validate(getGraphicsConfiguration());
+
+ Graphics2D g2d = vimg.createGraphics();
+ renderTest(g2d);
+ g2d.dispose();
+
+ g.drawImage(vimg, 0, 0, null);
+
+ Toolkit.getDefaultToolkit().sync();
+
+ synchronized (this) {
+ done = true;
+ notifyAll();
+ }
+ }
+
+ /*
+ * foreach source image size (once with pow2, once with non-pow2)
+ *
+ * foreach BufferedImage type
+ *
+ * RescaleOp (1 band)
+ * RescaleOp (3 bands, if src has 3 bands)
+ * RescaleOp (4 bands, if src has 4 bands)
+ *
+ * foreach LookupTable type (once with ByteLUT, once with ShortLUT)
+ * LookupOp (1 band)
+ * LookupOp (3 bands, if src has 3 bands)
+ * LookupOp (4 bands, if src has 4 bands)
+ *
+ * foreach edge condition (once with ZERO_FILL, once with EDGE_NO_OP)
+ * ConvolveOp (3x3)
+ * ConvolveOp (5x5)
+ * ConvolveOp (7x7)
+ */
+ private void renderTest(Graphics2D g2d) {
+ g2d.setColor(Color.white);
+ g2d.fillRect(0, 0, TESTW, TESTH);
+
+ int yorig = 2;
+ int xinc = 34;
+ int yinc = srcSizes[0] + srcSizes[1] + 2 + 2;
+
+ for (int srcType : srcTypes) {
+ int y = yorig;
+
+ for (int srcSize : srcSizes) {
+ int x = 2;
+ System.out.printf("type=%d size=%d\n", srcType, srcSize);
+
+ BufferedImage srcImg = makeSourceImage(srcSize, srcType);
+ ColorModel srcCM = srcImg.getColorModel();
+
+ // RescaleOp
+ g2d.drawImage(srcImg, rescale1band, x, y);
+ x += xinc;
+ // REMIND: 3-band RescaleOp.filter() throws IAE for images
+ // that contain an alpha channel (bug to be filed)
+ if (srcCM.getNumColorComponents() == 3 &&
+ !(ignore && srcCM.hasAlpha()))
+ {
+ g2d.drawImage(srcImg, rescale3band, x, y);
+ }
+ x += xinc;
+ if (srcCM.getNumComponents() == 4) {
+ g2d.drawImage(srcImg, rescale4band, x, y);
+ }
+ x += xinc;
+
+ // LookupOp
+ // REMIND: Our LUTs are only 256 elements long, so won't
+ // currently work with USHORT_GRAY data
+ if (srcType != BufferedImage.TYPE_USHORT_GRAY) {
+ g2d.drawImage(srcImg, lookup1bandbyte, x, y);
+ x += xinc;
+ if (srcCM.getNumColorComponents() == 3) {
+ g2d.drawImage(srcImg, lookup3bandbyte, x, y);
+ }
+ x += xinc;
+ if (srcCM.getNumComponents() == 4) {
+ g2d.drawImage(srcImg, lookup4bandbyte, x, y);
+ }
+ x += xinc;
+
+ // REMIND: LookupOp.createCompatibleDestImage() throws
+ // IAE for 3BYTE_BGR/4BYTE_ABGR (bug to be filed)
+ if (!(ignore &&
+ (srcType == BufferedImage.TYPE_3BYTE_BGR ||
+ srcType == BufferedImage.TYPE_4BYTE_ABGR)))
+ {
+ g2d.drawImage(srcImg, lookup1bandshort, x, y);
+ x += xinc;
+ // REMIND: 3-band LookupOp.filter() throws IAE for
+ // images that contain an alpha channel
+ // (bug to be filed)
+ if (srcCM.getNumColorComponents() == 3 &&
+ !(ignore && srcCM.hasAlpha()))
+ {
+ g2d.drawImage(srcImg, lookup3bandshort, x, y);
+ }
+ x += xinc;
+ if (srcCM.getNumComponents() == 4) {
+ g2d.drawImage(srcImg, lookup4bandshort, x, y);
+ }
+ x += xinc;
+ } else {
+ x += 3*xinc;
+ }
+ } else {
+ x += 6*xinc;
+ }
+
+ // ConvolveOp
+ // REMIND: ConvolveOp.filter() throws ImagingOpException
+ // for 3BYTE_BGR (see 4957775)
+ if (srcType != BufferedImage.TYPE_3BYTE_BGR) {
+ g2d.drawImage(srcImg, convolve3x3zero, x, y);
+ x += xinc;
+ g2d.drawImage(srcImg, convolve5x5zero, x, y);
+ x += xinc;
+ g2d.drawImage(srcImg, convolve7x7zero, x, y);
+ x += xinc;
+
+ g2d.drawImage(srcImg, convolve3x3noop, x, y);
+ x += xinc;
+ g2d.drawImage(srcImg, convolve5x5noop, x, y);
+ x += xinc;
+ g2d.drawImage(srcImg, convolve7x7noop, x, y);
+ x += xinc;
+ } else {
+ x += 6*xinc;
+ }
+
+ y += srcSize + 2;
+ }
+
+ yorig += yinc;
+ }
+ }
+
+ private BufferedImage makeSourceImage(int size, int type) {
+ int s2 = size/2;
+ BufferedImage img = new BufferedImage(size, size, type);
+ Graphics2D g2d = img.createGraphics();
+ g2d.setComposite(AlphaComposite.Src);
+ g2d.setColor(Color.orange);
+ g2d.fillRect(0, 0, size, size);
+ g2d.setColor(Color.red);
+ g2d.fillRect(0, 0, s2, s2);
+ g2d.setColor(Color.green);
+ g2d.fillRect(s2, 0, s2, s2);
+ g2d.setColor(Color.blue);
+ g2d.fillRect(0, s2, s2, s2);
+ g2d.setColor(new Color(255, 255, 0, 128));
+ g2d.fillRect(s2, s2, s2, s2);
+ g2d.setColor(Color.pink);
+ g2d.fillOval(s2-3, s2-3, 6, 6);
+ g2d.dispose();
+ return img;
+ }
+
+ public BufferedImage makeReferenceImage() {
+ BufferedImage img = new BufferedImage(TESTW, TESTH,
+ BufferedImage.TYPE_INT_RGB);
+ Graphics2D g2d = img.createGraphics();
+ renderTest(g2d);
+ g2d.dispose();
+ return img;
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(TESTW, TESTH);
+ }
+
+ private static void compareImages(BufferedImage refImg,
+ BufferedImage testImg,
+ int tolerance)
+ {
+ int x1 = 0;
+ int y1 = 0;
+ int x2 = refImg.getWidth();
+ int y2 = refImg.getHeight();
+
+ for (int y = y1; y < y2; y++) {
+ for (int x = x1; x < x2; x++) {
+ Color expected = new Color(refImg.getRGB(x, y));
+ Color actual = new Color(testImg.getRGB(x, y));
+ if (!isSameColor(expected, actual, tolerance)) {
+ throw new RuntimeException("Test failed at x="+x+" y="+y+
+ " (expected="+expected+
+ " actual="+actual+
+ ")");
+ }
+ }
+ }
+ }
+
+ private static boolean isSameColor(Color c1, Color c2, int e) {
+ int r1 = c1.getRed();
+ int g1 = c1.getGreen();
+ int b1 = c1.getBlue();
+ int r2 = c2.getRed();
+ int g2 = c2.getGreen();
+ int b2 = c2.getBlue();
+ int rmin = Math.max(r2-e, 0);
+ int gmin = Math.max(g2-e, 0);
+ int bmin = Math.max(b2-e, 0);
+ int rmax = Math.min(r2+e, 255);
+ int gmax = Math.min(g2+e, 255);
+ int bmax = Math.min(b2+e, 255);
+ if (r1 >= rmin && r1 <= rmax &&
+ g1 >= gmin && g1 <= gmax &&
+ b1 >= bmin && b1 <= bmax)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static void main(String[] args) throws Exception {
+ boolean show = false;
+ boolean dump = false;
+ boolean compare = false;
+
+ for (String arg : args) {
+ if (arg.equals("-show")) {
+ show = true;
+ } else if (arg.equals("-dump")) {
+ dump = true;
+ } else if (arg.equals("-compare")) {
+ compare = true;
+ } else if (arg.equals("-ignore")) {
+ ignore = true;
+ }
+ }
+
+ DrawBufImgOp test = new DrawBufImgOp();
+ Frame frame = new Frame();
+ frame.add(test);
+ frame.pack();
+ frame.setVisible(true);
+
+ // Wait until the component's been painted
+ synchronized (test) {
+ while (!done) {
+ try {
+ test.wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Failed: Interrupted");
+ }
+ }
+ }
+
+ GraphicsConfiguration gc = frame.getGraphicsConfiguration();
+ if (gc.getColorModel() instanceof IndexColorModel) {
+ System.out.println("IndexColorModel detected: " +
+ "test considered PASSED");
+ frame.dispose();
+ return;
+ }
+
+ // Grab the screen region
+ BufferedImage capture = null;
+ try {
+ Robot robot = new Robot();
+ Point pt1 = test.getLocationOnScreen();
+ Rectangle rect = new Rectangle(pt1.x, pt1.y, TESTW, TESTH);
+ capture = robot.createScreenCapture(rect);
+ } catch (Exception e) {
+ throw new RuntimeException("Problems creating Robot");
+ } finally {
+ if (!show) {
+ frame.dispose();
+ }
+ }
+
+ // Compare the images (allow for +/- 1 bit differences in color comps)
+ if (dump || compare) {
+ BufferedImage ref = test.makeReferenceImage();
+ if (dump) {
+ ImageIO.write(ref, "png",
+ new File("DrawBufImgOp.ref.png"));
+ ImageIO.write(capture, "png",
+ new File("DrawBufImgOp.cap.png"));
+ }
+ if (compare) {
+ test.compareImages(ref, capture, 1);
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/image/VolatileImage/DrawHugeImageTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * @test
+ * @key headful
+ * @bug 8040617 8198613
+ * @summary Test verifies that an attempt to get an accelerated copy of
+ * a huge buffered image does not result in an OOME.
+ *
+ * @run main DrawHugeImageTest
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+
+public class DrawHugeImageTest {
+ // we have to render the BI source several times in order
+ // to get an accelerated copy to be used.
+ static {
+ System.setProperty("sun.java2d.accthreshold", "1");
+ }
+ private static final int max_rendering_count = 5;
+
+ private static final Color srcColor = Color.red;
+ private static final Color dstColor = Color.blue;
+
+ public static void main(String[] args) {
+ BufferedImage src = createSrc();
+
+ VolatileImage dst = createDst();
+ System.out.println("Dst: " + dst);
+ boolean status;
+ int count = max_rendering_count;
+
+ do {
+ System.out.println("render image: " + (max_rendering_count - count));
+ status = render(src, dst);
+
+ } while (status && count-- > 0);
+
+ if (!status || count > 0) {
+ throw new RuntimeException("Test failed: " + count);
+ }
+ }
+
+ private static boolean render(BufferedImage src, VolatileImage dst) {
+ int cnt = 5;
+ do {
+ Graphics2D g = dst.createGraphics();
+ g.setColor(dstColor);
+ g.fillRect(0, 0, dst.getWidth(), dst.getHeight());
+ g.drawImage(src, 0, 0, null);
+ g.dispose();
+ } while (dst.contentsLost() && (--cnt > 0));
+
+ if (cnt == 0) {
+ System.err.println("Test failed: unable to render to volatile destination");
+ return false;
+ }
+
+ BufferedImage s = dst.getSnapshot();
+
+ return s.getRGB(1,1) == srcColor.getRGB();
+ }
+
+ private static BufferedImage createSrc() {
+ final int w = 20000;
+ final int h = 5;
+
+ BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
+ Graphics2D g = img.createGraphics();
+ g.setColor(srcColor);
+ g.fillRect(0, 0, w, h);
+ g.dispose();
+
+ return img;
+ }
+
+ private static VolatileImage createDst() {
+ GraphicsConfiguration gc =
+ GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
+
+ return gc.createCompatibleVolatileImage(200, 200);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/image/VolatileImage/GradientPaints.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,356 @@
+/*
+ * Copyright (c) 2007, 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @key headful
+ * @bug 6521533 6525997 7102282 8198613
+ * @summary Verifies that the accelerated codepaths for GradientPaint,
+ * LinearGradientPaint, and RadialGradientPaint produce results that are
+ * sufficiently close to those produced by the software codepaths.
+ * @run main/othervm -Dsun.java2d.uiScale=1 GradientPaints
+ * @author campbelc
+ */
+
+import java.awt.*;
+import java.awt.MultipleGradientPaint.ColorSpaceType;
+import java.awt.MultipleGradientPaint.CycleMethod;
+import java.awt.geom.*;
+import java.awt.image.*;
+import java.io.File;
+import java.util.Arrays;
+import javax.imageio.ImageIO;
+
+public class GradientPaints extends Canvas {
+
+ private static final int TESTW = 600;
+ private static final int TESTH = 500;
+
+ /*
+ * We expect slight differences in rendering between the OpenGL and
+ * software pipelines due to algorithmic and rounding differences.
+ * The purpose of this test is just to make sure that the OGL pipeline
+ * is producing results that are "reasonably" consistent with those
+ * produced in software, so we will allow +/-TOLERANCE differences
+ * in each component. When comparing the test and reference images,
+ * we add up the number of pixels that fall outside this tolerance
+ * range and if the sum is larger than some percentage of the total
+ * number of pixels.
+ *
+ * REMIND: Note that we have separate thresholds for linear and radial
+ * gradients because the visible differences between OGL and software
+ * are more apparent in the radial cases. In the future we should try
+ * to reduce the number of mismatches between the two approaches, but
+ * for now the visible differences are slight enough to not cause worry.
+ */
+ private static final int TOLERANCE = 5;
+ private static final int ALLOWED_MISMATCHES_LINEAR =
+ (int)(TESTW * TESTH * 0.18);
+ private static final int ALLOWED_MISMATCHES_RADIAL =
+ (int)(TESTW * TESTH * 0.45);
+
+ private static boolean done;
+ private static boolean verbose;
+
+ private static final Color[] COLORS = {
+ new Color(0, 0, 0),
+ new Color(128, 128, 128),
+ new Color(255, 0, 0),
+ new Color(255, 255, 0),
+ new Color(0, 255, 0),
+ new Color(0, 255, 255),
+ new Color(128, 0, 255),
+ new Color(128, 128, 128),
+ };
+
+ private static enum PaintType {BASIC, LINEAR, RADIAL};
+ private static enum XformType {IDENTITY, TRANSLATE, SCALE, SHEAR, ROTATE};
+ private static final int[] numStopsArray = {2, 4, 7};
+ private static final Object[] hints = {
+ RenderingHints.VALUE_ANTIALIAS_OFF,
+ RenderingHints.VALUE_ANTIALIAS_ON,
+ };
+
+ public void paint(Graphics g) {
+ synchronized (this) {
+ if (!done) {
+ done = true;
+ notifyAll();
+ }
+ }
+ }
+
+ private void testOne(BufferedImage refImg, VolatileImage testImg) {
+ Graphics2D gref = refImg.createGraphics();
+ Graphics2D gtest = testImg.createGraphics();
+ Paint paint =
+ makePaint(PaintType.RADIAL, CycleMethod.REPEAT,
+ ColorSpaceType.SRGB, XformType.IDENTITY, 7);
+ Object aahint = hints[0];
+ renderTest(gref, paint, aahint);
+ renderTest(gtest, paint, aahint);
+ Toolkit.getDefaultToolkit().sync();
+ compareImages(refImg, testImg.getSnapshot(),
+ TOLERANCE, 0, "");
+ gref.dispose();
+ gtest.dispose();
+ }
+
+ private void testAll(Graphics gscreen,
+ BufferedImage refImg, VolatileImage testImg)
+ {
+ Graphics2D gref = refImg.createGraphics();
+ Graphics2D gtest = testImg.createGraphics();
+ for (PaintType paintType : PaintType.values()) {
+ for (CycleMethod cycleMethod : CycleMethod.values()) {
+ for (ColorSpaceType colorSpace : ColorSpaceType.values()) {
+ for (XformType xform : XformType.values()) {
+ for (Object aahint : hints) {
+ for (int numStops : numStopsArray) {
+ Paint paint =
+ makePaint(paintType, cycleMethod,
+ colorSpace, xform, numStops);
+ String msg =
+ "type=" + paintType +
+ " cycleMethod=" + cycleMethod +
+ " colorSpace=" + colorSpace +
+ " xformType=" + xform +
+ " numStops=" + numStops +
+ " aa=" + aahint;
+ renderTest(gref, paint, aahint);
+ renderTest(gtest, paint, aahint);
+ gscreen.drawImage(testImg, 0, 0, null);
+ Toolkit.getDefaultToolkit().sync();
+ int allowedMismatches =
+ paintType == PaintType.RADIAL ?
+ ALLOWED_MISMATCHES_RADIAL :
+ ALLOWED_MISMATCHES_LINEAR;
+ compareImages(refImg, testImg.getSnapshot(),
+ TOLERANCE, allowedMismatches,
+ msg);
+ }
+ }
+ }
+ }
+ }
+ }
+ gref.dispose();
+ gtest.dispose();
+ }
+
+ private Paint makePaint(PaintType paintType,
+ CycleMethod cycleMethod,
+ ColorSpaceType colorSpace,
+ XformType xformType, int numStops)
+ {
+ int startX = TESTW/6;
+ int startY = TESTH/6;
+ int endX = TESTW/2;
+ int endY = TESTH/2;
+ int ctrX = TESTW/2;
+ int ctrY = TESTH/2;
+ int focusX = ctrX + 20;
+ int focusY = ctrY + 20;
+ float radius = 100.0f;
+ Paint paint;
+ AffineTransform transform;
+
+ Color[] colors = Arrays.copyOf(COLORS, numStops);
+ float[] fractions = new float[colors.length];
+ for (int i = 0; i < fractions.length; i++) {
+ fractions[i] = ((float)i) / (fractions.length-1);
+ }
+
+ switch (xformType) {
+ default:
+ case IDENTITY:
+ transform = new AffineTransform();
+ break;
+ case TRANSLATE:
+ transform = AffineTransform.getTranslateInstance(2, 2);
+ break;
+ case SCALE:
+ transform = AffineTransform.getScaleInstance(1.2, 1.4);
+ break;
+ case SHEAR:
+ transform = AffineTransform.getShearInstance(0.1, 0.1);
+ break;
+ case ROTATE:
+ transform = AffineTransform.getRotateInstance(Math.PI / 4,
+ getWidth()/2,
+ getHeight()/2);
+ break;
+ }
+
+ switch (paintType) {
+ case BASIC:
+ boolean cyclic = (cycleMethod != CycleMethod.NO_CYCLE);
+ paint =
+ new GradientPaint(startX, startY, Color.RED,
+ endX, endY, Color.BLUE, cyclic);
+ break;
+
+ default:
+ case LINEAR:
+ paint =
+ new LinearGradientPaint(new Point2D.Float(startX, startY),
+ new Point2D.Float(endX, endY),
+ fractions, colors,
+ cycleMethod, colorSpace,
+ transform);
+ break;
+
+ case RADIAL:
+ paint =
+ new RadialGradientPaint(new Point2D.Float(ctrX, ctrY),
+ radius,
+ new Point2D.Float(focusX, focusY),
+ fractions, colors,
+ cycleMethod, colorSpace,
+ transform);
+ break;
+ }
+
+ return paint;
+ }
+
+ private void renderTest(Graphics2D g2d, Paint p, Object aahint) {
+ g2d.setColor(Color.white);
+ g2d.fillRect(0, 0, TESTW, TESTH);
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aahint);
+ g2d.setPaint(p);
+ g2d.fillOval(0, 0, TESTW, TESTH);
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(TESTW, TESTH);
+ }
+
+ private static void compareImages(BufferedImage refImg,
+ BufferedImage testImg,
+ int tolerance, int allowedMismatches,
+ String msg)
+ {
+ int numMismatches = 0;
+ int x1 = 0;
+ int y1 = 0;
+ int x2 = refImg.getWidth();
+ int y2 = refImg.getHeight();
+
+ for (int y = y1; y < y2; y++) {
+ for (int x = x1; x < x2; x++) {
+ Color expected = new Color(refImg.getRGB(x, y));
+ Color actual = new Color(testImg.getRGB(x, y));
+ if (!isSameColor(expected, actual, tolerance)) {
+ numMismatches++;
+ }
+ }
+ }
+
+ if (verbose) {
+ System.out.println(msg);
+ }
+ if (numMismatches > allowedMismatches) {
+ try {
+ ImageIO.write(refImg, "png",
+ new File("GradientPaints.ref.png"));
+ ImageIO.write(testImg, "png",
+ new File("GradientPaints.cap.png"));
+ } catch (Exception e) {
+ }
+ if (!verbose) {
+ System.err.println(msg);
+ }
+ throw new RuntimeException("Test failed: Number of mismatches (" +
+ numMismatches +
+ ") exceeds limit (" +
+ allowedMismatches +
+ ") with tolerance=" +
+ tolerance);
+ }
+ }
+
+ private static boolean isSameColor(Color c1, Color c2, int e) {
+ int r1 = c1.getRed();
+ int g1 = c1.getGreen();
+ int b1 = c1.getBlue();
+ int r2 = c2.getRed();
+ int g2 = c2.getGreen();
+ int b2 = c2.getBlue();
+ int rmin = Math.max(r2-e, 0);
+ int gmin = Math.max(g2-e, 0);
+ int bmin = Math.max(b2-e, 0);
+ int rmax = Math.min(r2+e, 255);
+ int gmax = Math.min(g2+e, 255);
+ int bmax = Math.min(b2+e, 255);
+ if (r1 >= rmin && r1 <= rmax &&
+ g1 >= gmin && g1 <= gmax &&
+ b1 >= bmin && b1 <= bmax)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static void main(String[] args) {
+ if (args.length == 1 && args[0].equals("-verbose")) {
+ verbose = true;
+ }
+
+ GradientPaints test = new GradientPaints();
+ Frame frame = new Frame();
+ frame.add(test);
+ frame.pack();
+ frame.setVisible(true);
+
+ // Wait until the component's been painted
+ synchronized (test) {
+ while (!done) {
+ try {
+ test.wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Failed: Interrupted");
+ }
+ }
+ }
+
+ GraphicsConfiguration gc = frame.getGraphicsConfiguration();
+ if (gc.getColorModel() instanceof IndexColorModel) {
+ System.out.println("IndexColorModel detected: " +
+ "test considered PASSED");
+ frame.dispose();
+ return;
+ }
+
+ BufferedImage refImg =
+ new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_RGB);
+ VolatileImage testImg = frame.createVolatileImage(TESTW, TESTH);
+ testImg.validate(gc);
+
+ try {
+ test.testAll(test.getGraphics(), refImg, testImg);
+ } finally {
+ frame.dispose();
+ }
+ }
+}
--- a/test/jdk/java/awt/image/VolatileImage/TransparentVImage.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/java/awt/image/VolatileImage/TransparentVImage.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -23,14 +23,12 @@
/*
* @test
- * @bug 4881082 4916294 5002129 8158524
+ * @bug 4881082 4916294 5002129 8158524 8198613
* @summary The test verifies whether the rendering operations on transparent
* and translucent VolatileImage objects generate identical output
* as generated with transparent and translucent BufferedImages.
* @key headful
* @run main/othervm -Dsun.java2d.uiScale=1 TransparentVImage
- * @run main/othervm -Dsun.java2d.uiScale=1 -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false TransparentVImage
- * @run main/othervm -Dsun.java2d.uiScale=1 -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true TransparentVImage
*/
import java.awt.GraphicsConfiguration;
import java.awt.Graphics;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/image/VolatileImage/bug7181438.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012, 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+
+/**
+ * @test
+ * @key headful
+ * @bug 7181438 8198613
+ * @summary Verifies that we get correct alpha, when we draw opaque
+ * BufferedImage to non opaque VolatileImage via intermediate opaque texture.
+ * @author Sergey Bylokhov
+ * @run main/othervm -Dsun.java2d.accthreshold=0 bug7181438
+ */
+public final class bug7181438 {
+
+ private static final int SIZE = 500;
+
+ public static void main(final String[] args) {
+
+ final BufferedImage bi = createBufferedImage();
+ final VolatileImage vi = createVolatileImage();
+ final Graphics s2dVi = vi.getGraphics();
+
+ //sw->texture->surface blit
+ s2dVi.drawImage(bi, 0, 0, null);
+
+ final BufferedImage results = vi.getSnapshot();
+ for (int i = 0; i < SIZE; ++i) {
+ for (int j = 0; j < SIZE; ++j) {
+ //Image should be opaque: (black color and alpha = 255)
+ if (results.getRGB(i, j) != 0xFF000000) {
+ throw new RuntimeException("Failed: Wrong alpha");
+ }
+ }
+ }
+ System.out.println("Passed");
+ }
+
+
+ private static VolatileImage createVolatileImage() {
+ final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
+ return gc.createCompatibleVolatileImage(SIZE, SIZE,
+ Transparency.TRANSLUCENT);
+ }
+
+ private static BufferedImage createBufferedImage() {
+ final BufferedImage bi = new BufferedImage(SIZE, SIZE,
+ BufferedImage.TYPE_INT_RGB);
+ final Graphics bg = bi.getGraphics();
+ //Black color and alpha = 0
+ bg.setColor(new Color(0, 0, 0, 0));
+ bg.fillRect(0, 0, SIZE, SIZE);
+ bg.dispose();
+ return bi;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/accessibility/8197785/AccessibilityBundleMemoryLeakTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/**
+ * @test
+ * @bug 8197785
+ * @summary Tests if AccessibleBundle will reload the ResourceBundle for every
+ * call to toDisplayString.
+ * @run main AccessibilityBundleMemoryLeakTest
+ */
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+import java.util.Locale;
+
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleBundle;
+
+public class AccessibilityBundleMemoryLeakTest extends AccessibleRole {
+ public AccessibilityBundleMemoryLeakTest() {
+ super("");
+ }
+
+ public static void main(String... args) throws Exception {
+ AccessibilityBundleMemoryLeakTest role = new AccessibilityBundleMemoryLeakTest();
+
+ Field field = AccessibleBundle.class.getDeclaredField("table");
+ field.setAccessible(true);
+
+ final Hashtable table = (Hashtable)field.get(role);
+ Locale locale = Locale.getDefault();
+
+ role.toDisplayString();
+ Object obj = table.get(locale);
+
+ role.toDisplayString();
+ Object obj1 = table.get(locale);
+
+ if (obj != obj1) {
+ throw new RuntimeException("Test case failed: AccessibleBundle allocates new value for existing key!");
+ }
+
+ System.out.println("Test passed.");
+
+ }
+}
--- a/test/jdk/javax/swing/JEditorPane/6917744/bug6917744.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/javax/swing/JEditorPane/6917744/bug6917744.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -24,13 +24,14 @@
/*
* @test
* @key headful
- * @bug 6917744
+ * @bug 6917744 8194767
* @summary JScrollPane Page Up/Down keys do not handle correctly html tables with different cells contents
* @author Pavel Porvatov
* @run main bug6917744
*/
import java.awt.*;
+import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.IOException;
import javax.swing.*;
@@ -44,6 +45,23 @@
private static Robot robot;
+ private static Point p = null;
+
+ static void blockTillDisplayed(JComponent comp) throws Exception {
+ while (p == null) {
+ try {
+ SwingUtilities.invokeAndWait(() -> {
+ p = comp.getLocationOnScreen();
+ });
+ } catch (IllegalStateException e) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException ie) {
+ }
+ }
+ }
+ }
+
public static void main(String[] args) throws Exception {
robot = new Robot();
@@ -58,6 +76,7 @@
try {
editorPane.setPage(bug6917744.class.getResource("/test.html"));
} catch (IOException e) {
+ frame.dispose();
throw new RuntimeException("HTML resource not found", e);
}
@@ -69,6 +88,12 @@
}
});
+ blockTillDisplayed(editorPane);
+ robot.mouseMove(p.x+50, p.y+50);
+ robot.waitForIdle();
+ robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+ robot.waitForIdle();
+ robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
robot.waitForIdle();
for (int i = 0; i < 50; i++) {
@@ -84,6 +109,7 @@
BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
if (model.getValue() + model.getExtent() != model.getMaximum()) {
+ frame.dispose();
throw new RuntimeException("Invalid HTML position");
}
}
@@ -104,6 +130,7 @@
BoundedRangeModel model = scrollPane.getVerticalScrollBar().getModel();
if (model.getValue() != model.getMinimum()) {
+ frame.dispose();
throw new RuntimeException("Invalid HTML position");
}
--- a/test/jdk/javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, 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
@@ -31,11 +31,10 @@
/**
* @test
* @key headful
- * @bug 8175301
+ * @bug 8175301 8198613
* @summary Java GUI hangs on Windows when Display set to 125%
* @run main/othervm -Dsun.java2d.uiScale=2 ScaledFrameBackgroundTest
* @run main/othervm -Dsun.java2d.uiScale=2 -Dsun.java2d.d3d=true ScaledFrameBackgroundTest
- * @run main/othervm -Dsun.java2d.uiScale=2 -Dsun.java2d.opengl=true ScaledFrameBackgroundTest
*/
public class ScaledFrameBackgroundTest {
--- a/test/jdk/javax/swing/JInternalFrame/8020708/bug8020708.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/javax/swing/JInternalFrame/8020708/bug8020708.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, 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
@@ -36,7 +36,7 @@
/**
* @test
* @key headful
- * @bug 8020708 8032568
+ * @bug 8020708 8032568 8194943
* @author Alexander Scherbatiy
* @summary NLS: mnemonics missing in SwingSet2/JInternalFrame demo
* @library ../../regtesthelpers
@@ -110,7 +110,7 @@
robot.mouseRelease(InputEvent.BUTTON1_MASK);
robot.waitForIdle();
- Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_SPACE);
+ Util.hitKeys(robot, KeyEvent.VK_SHIFT, KeyEvent.VK_ESCAPE);
robot.waitForIdle();
int keyCode = KeyEvent.VK_C;
String mnemonic = UIManager
--- a/test/jdk/javax/swing/JInternalFrame/8069348/bug8069348.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/javax/swing/JInternalFrame/8069348/bug8069348.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -37,12 +37,11 @@
/**
* @test
* @key headful
- * @bug 8069348 8159902
+ * @bug 8069348 8159902 8198613
* @summary SunGraphics2D.copyArea() does not properly work for scaled graphics
* @author Alexandr Scherbatiy
* @modules java.desktop/sun.awt
* @run main/othervm -Dsun.java2d.uiScale=2 bug8069348
- * @run main/othervm -Dsun.java2d.opengl=true -Dsun.java2d.uiScale=2 bug8069348
* @run main/othervm -Dsun.java2d.d3d=true -Dsun.java2d.uiScale=2 bug8069348
*/
public class bug8069348 {
--- a/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -21,15 +21,10 @@
* questions.
*/
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-
/*
* @test
* @key headful
- * @bug 8024627
+ * @bug 8024627 8190347
* @summary Check if a JComboBox present in a window set with opacity less than
* 1.0 shows a translucent drop down
* Test Description: Check if TRANSLUCENT translucency type is supported on the
@@ -46,6 +41,24 @@
* @run main TranslucentJComboBox
*/
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.RootPaneContainer;
+import javax.swing.JList;
+import javax.swing.JComboBox;
+import javax.swing.JPopupMenu;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+import java.awt.GraphicsDevice;
+import java.awt.Container;
+import java.awt.BorderLayout;
+import java.awt.Point;
+import java.awt.Color;
+import java.awt.Window;
+import java.awt.EventQueue;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
public class TranslucentJComboBox extends Common {
JComponent south;
@@ -53,6 +66,8 @@
JPanel north;
volatile boolean southClicked = false;
+ JPopupMenu popup = null;
+
public static void main(String[] args) throws Exception {
if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.TRANSLUCENT))
for (Class<Window> windowClass: WINDOWS_TO_TEST)
@@ -84,6 +99,24 @@
jComboBox.addItem("item " + i);
}
south = jComboBox;
+ jComboBox.addPopupMenuListener(new PopupMenuListener() {
+
+ @Override
+ public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
+ popup = (JPopupMenu) jComboBox.getAccessibleContext()
+ .getAccessibleChild(0);
+ }
+
+ @Override
+ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
+
+ }
+
+ @Override
+ public void popupMenuCanceled(PopupMenuEvent e) {
+
+ }
+ });
south.addMouseListener(new MouseAdapter() {
@Override
@@ -142,12 +175,19 @@
". Before click: " + c1 + ", after click: " + c1b +
", expected is " + south.getBackground());
- if (!c2.equals(c2b) && !south.getBackground().equals(c2b))
+ //This following check is only valid if the popup was created below the
+ // JComboBox and will be opaque or it is created above the JComboBox
+ // and it can not fit inside the JWindow along with JComboBox and will
+ // be opaque
+ if ( !c2.equals(c2b) && !south.getBackground().equals(c2b) &&
+ (popup.getLocationOnScreen().y > ls.y ||
+ window.getHeight() < popup.getHeight() + south.getHeight()))
throw new RuntimeException(
"Check for opaque drop down failed at point " + p2 +
". Before click: " + c2 + ", after click: " + c2b +
", expected is " + south.getBackground());
+ popup = null;
EventQueue.invokeAndWait(this::dispose);
}
}
--- a/test/jdk/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -83,6 +83,12 @@
private void checkButton(JFrameOperator jfo, int i, Robot rob) {
JButtonOperator button = new JButtonOperator(jfo, i);
+
+ //additional instrumentation for JDK-8198920. To be removed after the bug is fixed
+ java.util.concurrent.atomic.AtomicBoolean actionListenerCalled = new java.util.concurrent.atomic.AtomicBoolean(false);
+ button.addActionListener(e -> actionListenerCalled.set(true));
+ //end of instrumentation for JDK-8198920
+
button.moveMouse(button.getCenterX(), button.getCenterY());
BufferedImage initialButtonImage = capture(rob, button);
@@ -92,8 +98,14 @@
BufferedImage[] pressedImage = new BufferedImage[1];
button.pressMouse();
+ //additional instrumentation for JDK-8198920. To be removed after the bug is fixed
+ button.getOutput().printTrace("JDK-8198920: Button pressed at " + System.currentTimeMillis());
+ //end of instrumentation for JDK-8198920
try {
waitPressed(button);
+ //additional instrumentation for JDK-8198920. To be removed after the bug is fixed
+ button.getOutput().printTrace("JDK-8198920: Button press confirmed by " + System.currentTimeMillis());
+ //end of instrumentation for JDK-8198920
button.waitState(new ComponentChooser() {
public boolean checkComponent(Component c) {
pressedImage[0] = capture(rob, button);
@@ -107,6 +119,15 @@
} finally {
if(pressedImage[0] != null) save(pressedImage[0], "button" + i + "_pressed.png");
button.releaseMouse();
+ //additional instrumentation for JDK-8198920. To be removed after the bug is fixed
+ button.getOutput().printTrace("JDK-8198920: Button released at " + System.currentTimeMillis());
+ try {
+ button.waitState(comp -> actionListenerCalled.get());
+ button.getOutput().printTrace("JDK-8198920: Action listener was called by " + System.currentTimeMillis());
+ } catch(org.netbeans.jemmy.TimeoutExpiredException e) {
+ button.getOutput().printTrace("JDK-8198920: Action listener was not called by " + System.currentTimeMillis());
+ }
+ //end of instrumentation for JDK-8198920
}
}
}
--- a/test/jdk/sun/java2d/DirectX/AccelPaintsTest/AccelPaintsTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/AccelPaintsTest/AccelPaintsTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -24,12 +24,11 @@
/*
* @test
* @key headful
- * @bug 6659345
+ * @bug 6659345 8198613
* @summary Tests that various paints work correctly when preceeded by a
* textured operaiton.
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @run main/othervm AccelPaintsTest
- * @run main/othervm -Dsun.java2d.opengl=True AccelPaintsTest
*/
import java.awt.Color;
--- a/test/jdk/sun/java2d/DirectX/AcceleratedScaleTest/AcceleratedScaleTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/AcceleratedScaleTest/AcceleratedScaleTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, 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
@@ -38,13 +38,11 @@
/**
* @test
* @key headful
- * @bug 6429665
- * @bug 6588884
+ * @bug 6429665 6588884 8198613
* @summary Tests that the transform is correctly handled
* @author Dmitri.Trembovetski area=Graphics
* @run main AcceleratedScaleTest
* @run main/othervm -Dsun.java2d.d3d=true AcceleratedScaleTest
- * @run main/othervm -Dsun.java2d.opengl=true AcceleratedScaleTest
*/
public class AcceleratedScaleTest {
private static final int IMAGE_SIZE = 200;
--- a/test/jdk/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/NonOpaqueDestLCDAATest/NonOpaqueDestLCDAATest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, 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
@@ -23,13 +23,12 @@
/*
* @test
- * @bug 6728834 6749060
+ * @bug 6728834 6749060 8198613
* @summary Tests that LCD AA text rendering works properly with destinations
* being VolatileImage of all transparency types
* @author Dmitri.Trembovetski: area=Graphics
* @run main/manual/othervm -Dsun.java2d.d3d=false NonOpaqueDestLCDAATest
* @run main/manual/othervm NonOpaqueDestLCDAATest
- * @run main/manual/othervm -Dsun.java2d.opengl=True NonOpaqueDestLCDAATest
*/
import java.awt.AlphaComposite;
--- a/test/jdk/sun/java2d/DirectX/OpaqueImageToSurfaceBlitTest/OpaqueImageToSurfaceBlitTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/OpaqueImageToSurfaceBlitTest/OpaqueImageToSurfaceBlitTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -24,13 +24,12 @@
/*
* @test
* @key headful
- * @bug 6764257
+ * @bug 6764257 8198613
* @summary Tests that the alpha in opaque images doesn't affect result of alpha
* compositing
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @run main/othervm OpaqueImageToSurfaceBlitTest
* @run main/othervm -Dsun.java2d.noddraw=true OpaqueImageToSurfaceBlitTest
- * @run main/othervm -Dsun.java2d.opengl=True OpaqueImageToSurfaceBlitTest
*/
import java.awt.AlphaComposite;
--- a/test/jdk/sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/OverriddenInsetsTest/OverriddenInsetsTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -24,11 +24,10 @@
/*
* @test
* @key headful
- * @bug 6694230
+ * @bug 6694230 8198613
* @summary Tests that components overriding getInsets paint correctly
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @run main/othervm OverriddenInsetsTest
- * @run main/othervm -Dsun.java2d.opengl=True OverriddenInsetsTest
*/
import java.awt.Color;
--- a/test/jdk/sun/java2d/DirectX/StrikeDisposalCrashTest/StrikeDisposalCrashTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/StrikeDisposalCrashTest/StrikeDisposalCrashTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -24,13 +24,12 @@
/**
* @test
* @key headful
- * @bug 6705443
+ * @bug 6705443 8198613
* @summary tests that we don't crash during exit if font strikes were disposed
* during the lifetime of the application
*
* @run main/othervm -Dsun.java2d.font.reftype=weak StrikeDisposalCrashTest
* @run main/othervm -Dsun.java2d.font.reftype=weak -Dsun.java2d.noddraw=true StrikeDisposalCrashTest
- * @run main/othervm -Dsun.java2d.font.reftype=weak -Dsun.java2d.opengl=True StrikeDisposalCrashTest
*/
import java.awt.Font;
--- a/test/jdk/sun/java2d/DirectX/SwingOnScreenScrollingTest/SwingOnScreenScrollingTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/SwingOnScreenScrollingTest/SwingOnScreenScrollingTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -23,12 +23,11 @@
/*
* @test
* @key headful
- * @bug 6630702
+ * @bug 6630702 8198613
* @summary Tests that scrolling after paint() is performed correctly.
* This is really only applicable to Vista
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @run main/othervm SwingOnScreenScrollingTest
- * run main/othervm -Dsun.java2d.opengl=True SwingOnScreenScrollingTest
*/
import java.awt.AWTException;
--- a/test/jdk/sun/java2d/DirectX/TransformedPaintTest/TransformedPaintTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/DirectX/TransformedPaintTest/TransformedPaintTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -24,11 +24,10 @@
/*
* @test
* @key headful
- * @bug 6689025 8023483
+ * @bug 6689025 8023483 8198613
* @summary Tests that transformed Paints are rendered correctly
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @run main/othervm TransformedPaintTest
- * @run main/othervm -Dsun.java2d.opengl=True TransformedPaintTest
*/
import java.awt.Color;
--- a/test/jdk/sun/java2d/OpenGL/CopyAreaOOB.java Mon Mar 12 17:00:54 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2015, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @key headful
- * @bug 6430601
- * @summary Verifies that copyArea() works properly when the
- * destination parameters are outside the destination bounds.
- * @run main/othervm CopyAreaOOB
- * @run main/othervm -Dsun.java2d.opengl=True CopyAreaOOB
- * @author campbelc
- */
-
-import java.awt.*;
-import java.awt.image.*;
-
-public class CopyAreaOOB extends Canvas {
-
- private static boolean done;
-
- public void paint(Graphics g) {
- synchronized (this) {
- if (done) {
- return;
- }
- }
-
- int w = getWidth();
- int h = getHeight();
-
- Graphics2D g2d = (Graphics2D)g;
- g2d.setColor(Color.black);
- g2d.fillRect(0, 0, w, h);
-
- g2d.setColor(Color.green);
- g2d.fillRect(0, 0, w, 10);
-
- g2d.setColor(Color.red);
- g2d.fillRect(0, 10, 50, h-10);
-
- // copy the region such that part of it goes below the bottom of the
- // destination surface
- g2d.copyArea(0, 10, 50, h-10, 60, 10);
-
- Toolkit.getDefaultToolkit().sync();
-
- synchronized (this) {
- done = true;
- notifyAll();
- }
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(400, 400);
- }
-
- private static void testRegion(BufferedImage bi, String name,
- int x1, int y1, int x2, int y2,
- int expected)
- {
- for (int y = y1; y < y2; y++) {
- for (int x = x1; x < x2; x++) {
- int actual = bi.getRGB(x, y);
- if (actual != expected) {
- throw new RuntimeException("Test failed for " + name +
- " region at x="+x+" y="+y+
- " (expected="+
- Integer.toHexString(expected) +
- " actual="+
- Integer.toHexString(actual) +
- ")");
- }
- }
- }
- }
-
- public static void main(String[] args) {
- boolean show = (args.length == 1) && ("-show".equals(args[0]));
-
- CopyAreaOOB test = new CopyAreaOOB();
- Frame frame = new Frame();
- frame.setUndecorated(true);
- frame.add(test);
- frame.pack();
- frame.setLocationRelativeTo(null);
- frame.setVisible(true);
-
- // Wait until the component's been painted
- synchronized (test) {
- while (!done) {
- try {
- test.wait();
- } catch (InterruptedException e) {
- throw new RuntimeException("Failed: Interrupted");
- }
- }
- }
-
- try {
- Thread.sleep(2000);
- } catch (InterruptedException ex) {}
-
- // Grab the screen region
- BufferedImage capture = null;
- try {
- Robot robot = new Robot();
- Point pt1 = test.getLocationOnScreen();
- Rectangle rect = new Rectangle(pt1.x, pt1.y, 400, 400);
- capture = robot.createScreenCapture(rect);
- } catch (Exception e) {
- throw new RuntimeException("Problems creating Robot");
- } finally {
- if (!show) {
- frame.dispose();
- }
- }
-
- // Test pixels
- testRegion(capture, "green", 0, 0, 400, 10, 0xff00ff00);
- testRegion(capture, "original red", 0, 10, 50, 400, 0xffff0000);
- testRegion(capture, "background", 50, 10, 60, 400, 0xff000000);
- testRegion(capture, "in-between", 60, 10, 110, 20, 0xff000000);
- testRegion(capture, "copied red", 60, 20, 110, 400, 0xffff0000);
- testRegion(capture, "background", 110, 10, 400, 400, 0xff000000);
- }
-}
--- a/test/jdk/sun/java2d/OpenGL/CustomCompositeTest.java Mon Mar 12 17:00:54 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,267 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @key headful
- * @bug 7124347
- * @summary Verifies that rendering with XOR composite, and arbitraty
- * custom composite doesn not cause internal errors.
- *
- * @run main/othervm -Dsun.java2d.opengl=True CustomCompositeTest
- */
-
-import java.awt.AWTException;
-import java.awt.Color;
-import java.awt.Composite;
-import java.awt.CompositeContext;
-import java.awt.Dimension;
-import java.awt.GradientPaint;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsEnvironment;
-import java.awt.ImageCapabilities;
-import java.awt.RenderingHints;
-import java.awt.image.BufferedImage;
-import java.awt.image.ColorModel;
-import java.awt.image.DataBufferInt;
-import java.awt.image.Raster;
-import java.awt.image.SinglePixelPackedSampleModel;
-import java.awt.image.VolatileImage;
-import java.awt.image.WritableRaster;
-import java.util.concurrent.CountDownLatch;
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-import javax.swing.SwingUtilities;
-
-public class CustomCompositeTest {
-
- private static JFrame frame;
- private static CountDownLatch paintLatch;
- private static Throwable paintError;
-
- public static void main(String[] args) {
-
- paintLatch = new CountDownLatch(1);
- paintError = null;
-
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- initGUI();
- }
- });
-
- try {
- paintLatch.await();
- } catch (InterruptedException e) {
- };
- System.out.println("Paint is done!");
- if (paintError != null) {
- frame.dispose();
- throw new RuntimeException("Test FAILED.", paintError);
- }
-
- System.out.println("Phase 1: PASSED.");
-
- // now resise the frame in order to cause re-paint with accelerated
- // source images.
- paintError = null;
- paintLatch = new CountDownLatch(1);
-
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- Dimension size = frame.getSize();
- size.width += 50;
- size.height += 50;
-
- frame.setSize(size);
- }
- });
-
- try {
- paintLatch.await();
- } catch (InterruptedException e) {
- };
- if (paintError != null) {
- frame.dispose();
- throw new RuntimeException("Resize test FAILED.", paintError);
- }
- frame.dispose();
- System.out.println("Phase 2: PASSED.");
-
- GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
- GraphicsConfiguration cfg = env.getDefaultScreenDevice().getDefaultConfiguration();
- // test rendering to accelerated volatile image
- testVolatileImage(cfg, true);
- System.out.println("Phase 3: PASSED.");
-
- // test rendering to unaccelerated volatile image
- testVolatileImage(cfg, false);
- System.out.println("Phase 4: PASSED.");
- }
-
- private static void testVolatileImage(GraphicsConfiguration cfg,
- boolean accelerated)
- {
- VolatileImage dst = null;
- try {
- dst = cfg.createCompatibleVolatileImage(640, 480,
- new ImageCapabilities(accelerated));
- } catch (AWTException e) {
- System.out.println("Unable to create volatile image, skip the test.");
- return;
- }
- renderToVolatileImage(dst);
- }
-
- private static void renderToVolatileImage(VolatileImage dst) {
- Graphics2D g = dst.createGraphics();
- do {
- System.out.println("Render to volatile image..");
- try {
- MyComp.renderTest(g, dst.getHeight(), dst.getHeight());
- } catch (Throwable e) {
- throw new RuntimeException("Test FAILED.", e);
- }
- } while (dst.contentsLost());
- System.out.println("Done.");
- }
-
- private static void initGUI() {
- frame = new JFrame("Silly composite");
- frame.getContentPane().add(new MyComp());
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.pack();
- frame.setVisible(true);
- }
-
- private static class MyComp extends JComponent {
-
- private static BufferedImage theImage;
-
- public MyComp() {
- }
-
- private static BufferedImage getTestImage() {
- if (theImage == null) {
- theImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
- Graphics2D g2d = theImage.createGraphics();
- g2d.setColor(Color.red);
- g2d.fillRect(0, 0, 256, 256);
-
- g2d.setPaint(new GradientPaint(0, 0, Color.red, 256, 256, Color.blue));
- g2d.fillRect(0, 100, 256, 256);
- g2d.dispose();
- }
- return theImage;
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(640, 375);
- }
-
- public void paintComponent(Graphics g) {
-
-
- Graphics2D g2d = (Graphics2D) g;
- try {
- renderTest(g2d, getWidth(), getHeight());
- } catch (Throwable e) {
- paintError = e;
- }
- if (paintLatch != null) {
- paintLatch.countDown();
- }
- }
-
- public static void renderTest(Graphics2D g2d, int w, int h) {
- g2d.setColor(Color.yellow);
- g2d.fillRect(0, 0, w, h);
-
- BufferedImage image = getTestImage();
- // draw original image
- g2d.drawRenderedImage(image, null);
-
- // draw image with custom composite
- g2d.translate(175, 25);
- Composite currentComposite = g2d.getComposite();
- g2d.setComposite(new TestComposite());
- g2d.drawRenderedImage(image, null);
- g2d.setComposite(currentComposite);
-
- // draw image with XOR
- g2d.translate(175, 25);
- g2d.setXORMode(Color.red);
- g2d.drawRenderedImage(image, null);
-
-
- System.out.println("Painting is done...");
- }
- }
-
- // A silly custom Composite to demonstrate the problem - just inverts the RGB
- private static class TestComposite implements Composite {
-
- public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel, RenderingHints hints) {
- return new TestCompositeContext();
- }
- }
-
- private static class TestCompositeContext implements CompositeContext {
-
- public void dispose() {
- }
-
- public void compose(Raster src, Raster dstIn, WritableRaster dstOut) {
- int w = src.getWidth();
- int h = src.getHeight();
-
- DataBufferInt srcDB = (DataBufferInt) src.getDataBuffer();
- DataBufferInt dstOutDB = (DataBufferInt) dstOut.getDataBuffer();
- int srcRGB[] = srcDB.getBankData()[0];
- int dstOutRGB[] = dstOutDB.getBankData()[0];
- int srcOffset = srcDB.getOffset();
- int dstOutOffset = dstOutDB.getOffset();
- int srcScanStride = ((SinglePixelPackedSampleModel) src.getSampleModel()).getScanlineStride();
- int dstOutScanStride = ((SinglePixelPackedSampleModel) dstOut.getSampleModel()).getScanlineStride();
- int srcAdjust = srcScanStride - w;
- int dstOutAdjust = dstOutScanStride - w;
-
- int si = srcOffset;
- int doi = dstOutOffset;
-
- for (int i = 0; i < h; i++) {
- for (int j = 0; j < w; j++) {
- dstOutRGB[doi] = srcRGB[si] ^ 0x00ffffff;
- si++;
- doi++;
- }
-
- si += srcAdjust;
- doi += dstOutAdjust;
- }
- }
- }
-}
--- a/test/jdk/sun/java2d/OpenGL/DrawBufImgOp.java Mon Mar 12 17:00:54 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,484 +0,0 @@
-/*
- * Copyright (c) 2007, 2016, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * @test
- * @key headful
- * @bug 6514990
- * @summary Verifies that calling
- * Graphics2D.drawImage(BufferedImage, BufferedImageOp, x, y) to an
- * OpenGL-accelerated destination produces the same results when performed
- * in software via BufferedImageOp.filter().
- * @run main/othervm -Dsun.java2d.opengl=True DrawBufImgOp -ignore
- * @author campbelc
- */
-
-import java.awt.*;
-import java.awt.image.*;
-import java.io.File;
-import javax.imageio.ImageIO;
-
-/**
- * REMIND: This testcase was originally intended to automatically compare
- * the results of the software BufferedImageOp implementations against
- * the OGL-accelerated codepaths. However, there are just too many open
- * bugs in the mediaLib-based codepaths (see below), which means that
- * creating the reference image may cause crashes or exceptions,
- * and even if we work around those cases using the "-ignore" flag,
- * the visual results of the reference image are often buggy as well
- * (so the comparison will fail even though the OGL results are correct).
- * Therefore, for now we will run the testcase with the "-ignore" flag
- * but without the "-compare" flag, so at least it will be checking for
- * any exceptions/crashes in the OGL code. When we fix all of the
- * outstanding bugs with the software codepaths, we can remove the
- * "-ignore" flag and maybe even restore the "-compare" flag. In the
- * meantime, it stil functions well as a manual testcase (with either
- * the "-show" or "-dump" options).
- */
-public class DrawBufImgOp extends Canvas {
-
- private static final int TESTW = 600;
- private static final int TESTH = 500;
- private static boolean done;
-
- /*
- * If true, skips tests that are known to trigger bugs (which in
- * turn may cause crashes, exceptions, or other artifacts).
- */
- private static boolean ignore;
-
- // Test both pow2 and non-pow2 sized images
- private static final int[] srcSizes = { 32, 17 };
- private static final int[] srcTypes = {
- BufferedImage.TYPE_INT_RGB,
- BufferedImage.TYPE_INT_ARGB,
- BufferedImage.TYPE_INT_ARGB_PRE,
- BufferedImage.TYPE_INT_BGR,
- BufferedImage.TYPE_3BYTE_BGR,
- BufferedImage.TYPE_4BYTE_ABGR,
- BufferedImage.TYPE_USHORT_565_RGB,
- BufferedImage.TYPE_BYTE_GRAY,
- BufferedImage.TYPE_USHORT_GRAY,
- };
-
- private static final RescaleOp
- rescale1band, rescale3band, rescale4band;
- private static final LookupOp
- lookup1bandbyte, lookup3bandbyte, lookup4bandbyte;
- private static final LookupOp
- lookup1bandshort, lookup3bandshort, lookup4bandshort;
- private static final ConvolveOp
- convolve3x3zero, convolve5x5zero, convolve7x7zero;
- private static final ConvolveOp
- convolve3x3noop, convolve5x5noop, convolve7x7noop;
-
- static {
- rescale1band = new RescaleOp(0.5f, 10.0f, null);
- rescale3band = new RescaleOp(
- new float[] { 0.6f, 0.4f, 0.6f },
- new float[] { 10.0f, -3.0f, 5.0f },
- null);
- rescale4band = new RescaleOp(
- new float[] { 0.6f, 0.4f, 0.6f, 0.9f },
- new float[] { -1.0f, 5.0f, 3.0f, 1.0f },
- null);
-
- // REMIND: we should probably test non-zero offsets, but that
- // would require massaging the source image data to avoid going
- // outside the lookup table array bounds
- int offset = 0;
- {
- byte invert[] = new byte[256];
- byte halved[] = new byte[256];
- for (int j = 0; j < 256 ; j++) {
- invert[j] = (byte) (255-j);
- halved[j] = (byte) (j / 2);
- }
- ByteLookupTable lut1 = new ByteLookupTable(offset, invert);
- lookup1bandbyte = new LookupOp(lut1, null);
- ByteLookupTable lut3 =
- new ByteLookupTable(offset,
- new byte[][] {invert, halved, invert});
- lookup3bandbyte = new LookupOp(lut3, null);
- ByteLookupTable lut4 =
- new ByteLookupTable(offset,
- new byte[][] {invert, halved, invert, halved});
- lookup4bandbyte = new LookupOp(lut4, null);
- }
-
- {
- short invert[] = new short[256];
- short halved[] = new short[256];
- for (int j = 0; j < 256 ; j++) {
- invert[j] = (short) ((255-j) * 255);
- halved[j] = (short) ((j / 2) * 255);
- }
- ShortLookupTable lut1 = new ShortLookupTable(offset, invert);
- lookup1bandshort = new LookupOp(lut1, null);
- ShortLookupTable lut3 =
- new ShortLookupTable(offset,
- new short[][] {invert, halved, invert});
- lookup3bandshort = new LookupOp(lut3, null);
- ShortLookupTable lut4 =
- new ShortLookupTable(offset,
- new short[][] {invert, halved, invert, halved});
- lookup4bandshort = new LookupOp(lut4, null);
- }
-
- // 3x3 blur
- float[] data3 = {
- 0.1f, 0.1f, 0.1f,
- 0.1f, 0.2f, 0.1f,
- 0.1f, 0.1f, 0.1f,
- };
- Kernel k3 = new Kernel(3, 3, data3);
-
- // 5x5 edge
- float[] data5 = {
- -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, 24.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
- -1.0f, -1.0f, -1.0f, -1.0f, -1.0f,
- };
- Kernel k5 = new Kernel(5, 5, data5);
-
- // 7x7 blur
- float[] data7 = {
- 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
- 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
- 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
- 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
- 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
- 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
- 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f, 0.02f,
- };
- Kernel k7 = new Kernel(7, 7, data7);
-
- convolve3x3zero = new ConvolveOp(k3, ConvolveOp.EDGE_ZERO_FILL, null);
- convolve5x5zero = new ConvolveOp(k5, ConvolveOp.EDGE_ZERO_FILL, null);
- convolve7x7zero = new ConvolveOp(k7, ConvolveOp.EDGE_ZERO_FILL, null);
-
- convolve3x3noop = new ConvolveOp(k3, ConvolveOp.EDGE_NO_OP, null);
- convolve5x5noop = new ConvolveOp(k5, ConvolveOp.EDGE_NO_OP, null);
- convolve7x7noop = new ConvolveOp(k7, ConvolveOp.EDGE_NO_OP, null);
- }
-
- public void paint(Graphics g) {
- synchronized (this) {
- if (done) {
- return;
- }
- }
-
- VolatileImage vimg = createVolatileImage(TESTW, TESTH);
- vimg.validate(getGraphicsConfiguration());
-
- Graphics2D g2d = vimg.createGraphics();
- renderTest(g2d);
- g2d.dispose();
-
- g.drawImage(vimg, 0, 0, null);
-
- Toolkit.getDefaultToolkit().sync();
-
- synchronized (this) {
- done = true;
- notifyAll();
- }
- }
-
- /*
- * foreach source image size (once with pow2, once with non-pow2)
- *
- * foreach BufferedImage type
- *
- * RescaleOp (1 band)
- * RescaleOp (3 bands, if src has 3 bands)
- * RescaleOp (4 bands, if src has 4 bands)
- *
- * foreach LookupTable type (once with ByteLUT, once with ShortLUT)
- * LookupOp (1 band)
- * LookupOp (3 bands, if src has 3 bands)
- * LookupOp (4 bands, if src has 4 bands)
- *
- * foreach edge condition (once with ZERO_FILL, once with EDGE_NO_OP)
- * ConvolveOp (3x3)
- * ConvolveOp (5x5)
- * ConvolveOp (7x7)
- */
- private void renderTest(Graphics2D g2d) {
- g2d.setColor(Color.white);
- g2d.fillRect(0, 0, TESTW, TESTH);
-
- int yorig = 2;
- int xinc = 34;
- int yinc = srcSizes[0] + srcSizes[1] + 2 + 2;
-
- for (int srcType : srcTypes) {
- int y = yorig;
-
- for (int srcSize : srcSizes) {
- int x = 2;
- System.out.printf("type=%d size=%d\n", srcType, srcSize);
-
- BufferedImage srcImg = makeSourceImage(srcSize, srcType);
- ColorModel srcCM = srcImg.getColorModel();
-
- // RescaleOp
- g2d.drawImage(srcImg, rescale1band, x, y);
- x += xinc;
- // REMIND: 3-band RescaleOp.filter() throws IAE for images
- // that contain an alpha channel (bug to be filed)
- if (srcCM.getNumColorComponents() == 3 &&
- !(ignore && srcCM.hasAlpha()))
- {
- g2d.drawImage(srcImg, rescale3band, x, y);
- }
- x += xinc;
- if (srcCM.getNumComponents() == 4) {
- g2d.drawImage(srcImg, rescale4band, x, y);
- }
- x += xinc;
-
- // LookupOp
- // REMIND: Our LUTs are only 256 elements long, so won't
- // currently work with USHORT_GRAY data
- if (srcType != BufferedImage.TYPE_USHORT_GRAY) {
- g2d.drawImage(srcImg, lookup1bandbyte, x, y);
- x += xinc;
- if (srcCM.getNumColorComponents() == 3) {
- g2d.drawImage(srcImg, lookup3bandbyte, x, y);
- }
- x += xinc;
- if (srcCM.getNumComponents() == 4) {
- g2d.drawImage(srcImg, lookup4bandbyte, x, y);
- }
- x += xinc;
-
- // REMIND: LookupOp.createCompatibleDestImage() throws
- // IAE for 3BYTE_BGR/4BYTE_ABGR (bug to be filed)
- if (!(ignore &&
- (srcType == BufferedImage.TYPE_3BYTE_BGR ||
- srcType == BufferedImage.TYPE_4BYTE_ABGR)))
- {
- g2d.drawImage(srcImg, lookup1bandshort, x, y);
- x += xinc;
- // REMIND: 3-band LookupOp.filter() throws IAE for
- // images that contain an alpha channel
- // (bug to be filed)
- if (srcCM.getNumColorComponents() == 3 &&
- !(ignore && srcCM.hasAlpha()))
- {
- g2d.drawImage(srcImg, lookup3bandshort, x, y);
- }
- x += xinc;
- if (srcCM.getNumComponents() == 4) {
- g2d.drawImage(srcImg, lookup4bandshort, x, y);
- }
- x += xinc;
- } else {
- x += 3*xinc;
- }
- } else {
- x += 6*xinc;
- }
-
- // ConvolveOp
- // REMIND: ConvolveOp.filter() throws ImagingOpException
- // for 3BYTE_BGR (see 4957775)
- if (srcType != BufferedImage.TYPE_3BYTE_BGR) {
- g2d.drawImage(srcImg, convolve3x3zero, x, y);
- x += xinc;
- g2d.drawImage(srcImg, convolve5x5zero, x, y);
- x += xinc;
- g2d.drawImage(srcImg, convolve7x7zero, x, y);
- x += xinc;
-
- g2d.drawImage(srcImg, convolve3x3noop, x, y);
- x += xinc;
- g2d.drawImage(srcImg, convolve5x5noop, x, y);
- x += xinc;
- g2d.drawImage(srcImg, convolve7x7noop, x, y);
- x += xinc;
- } else {
- x += 6*xinc;
- }
-
- y += srcSize + 2;
- }
-
- yorig += yinc;
- }
- }
-
- private BufferedImage makeSourceImage(int size, int type) {
- int s2 = size/2;
- BufferedImage img = new BufferedImage(size, size, type);
- Graphics2D g2d = img.createGraphics();
- g2d.setComposite(AlphaComposite.Src);
- g2d.setColor(Color.orange);
- g2d.fillRect(0, 0, size, size);
- g2d.setColor(Color.red);
- g2d.fillRect(0, 0, s2, s2);
- g2d.setColor(Color.green);
- g2d.fillRect(s2, 0, s2, s2);
- g2d.setColor(Color.blue);
- g2d.fillRect(0, s2, s2, s2);
- g2d.setColor(new Color(255, 255, 0, 128));
- g2d.fillRect(s2, s2, s2, s2);
- g2d.setColor(Color.pink);
- g2d.fillOval(s2-3, s2-3, 6, 6);
- g2d.dispose();
- return img;
- }
-
- public BufferedImage makeReferenceImage() {
- BufferedImage img = new BufferedImage(TESTW, TESTH,
- BufferedImage.TYPE_INT_RGB);
- Graphics2D g2d = img.createGraphics();
- renderTest(g2d);
- g2d.dispose();
- return img;
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(TESTW, TESTH);
- }
-
- private static void compareImages(BufferedImage refImg,
- BufferedImage testImg,
- int tolerance)
- {
- int x1 = 0;
- int y1 = 0;
- int x2 = refImg.getWidth();
- int y2 = refImg.getHeight();
-
- for (int y = y1; y < y2; y++) {
- for (int x = x1; x < x2; x++) {
- Color expected = new Color(refImg.getRGB(x, y));
- Color actual = new Color(testImg.getRGB(x, y));
- if (!isSameColor(expected, actual, tolerance)) {
- throw new RuntimeException("Test failed at x="+x+" y="+y+
- " (expected="+expected+
- " actual="+actual+
- ")");
- }
- }
- }
- }
-
- private static boolean isSameColor(Color c1, Color c2, int e) {
- int r1 = c1.getRed();
- int g1 = c1.getGreen();
- int b1 = c1.getBlue();
- int r2 = c2.getRed();
- int g2 = c2.getGreen();
- int b2 = c2.getBlue();
- int rmin = Math.max(r2-e, 0);
- int gmin = Math.max(g2-e, 0);
- int bmin = Math.max(b2-e, 0);
- int rmax = Math.min(r2+e, 255);
- int gmax = Math.min(g2+e, 255);
- int bmax = Math.min(b2+e, 255);
- if (r1 >= rmin && r1 <= rmax &&
- g1 >= gmin && g1 <= gmax &&
- b1 >= bmin && b1 <= bmax)
- {
- return true;
- }
- return false;
- }
-
- public static void main(String[] args) throws Exception {
- boolean show = false;
- boolean dump = false;
- boolean compare = false;
-
- for (String arg : args) {
- if (arg.equals("-show")) {
- show = true;
- } else if (arg.equals("-dump")) {
- dump = true;
- } else if (arg.equals("-compare")) {
- compare = true;
- } else if (arg.equals("-ignore")) {
- ignore = true;
- }
- }
-
- DrawBufImgOp test = new DrawBufImgOp();
- Frame frame = new Frame();
- frame.add(test);
- frame.pack();
- frame.setVisible(true);
-
- // Wait until the component's been painted
- synchronized (test) {
- while (!done) {
- try {
- test.wait();
- } catch (InterruptedException e) {
- throw new RuntimeException("Failed: Interrupted");
- }
- }
- }
-
- GraphicsConfiguration gc = frame.getGraphicsConfiguration();
- if (gc.getColorModel() instanceof IndexColorModel) {
- System.out.println("IndexColorModel detected: " +
- "test considered PASSED");
- frame.dispose();
- return;
- }
-
- // Grab the screen region
- BufferedImage capture = null;
- try {
- Robot robot = new Robot();
- Point pt1 = test.getLocationOnScreen();
- Rectangle rect = new Rectangle(pt1.x, pt1.y, TESTW, TESTH);
- capture = robot.createScreenCapture(rect);
- } catch (Exception e) {
- throw new RuntimeException("Problems creating Robot");
- } finally {
- if (!show) {
- frame.dispose();
- }
- }
-
- // Compare the images (allow for +/- 1 bit differences in color comps)
- if (dump || compare) {
- BufferedImage ref = test.makeReferenceImage();
- if (dump) {
- ImageIO.write(ref, "png",
- new File("DrawBufImgOp.ref.png"));
- ImageIO.write(capture, "png",
- new File("DrawBufImgOp.cap.png"));
- }
- if (compare) {
- test.compareImages(ref, capture, 1);
- }
- }
- }
-}
--- a/test/jdk/sun/java2d/OpenGL/DrawHugeImageTest.java Mon Mar 12 17:00:54 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2014, 2016, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * @test
- * @key headful
- * @bug 8040617
- * @summary Test verifies that an attempt to get an accelerated copy of
- * a huge buffered image does not result in an OOME.
- *
- * @run main DrawHugeImageTest
- */
-
-import java.awt.Color;
-import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsEnvironment;
-import java.awt.image.BufferedImage;
-import java.awt.image.VolatileImage;
-
-public class DrawHugeImageTest {
- // we have to render the BI source several times in order
- // to get an accelerated copy to be used.
- static {
- System.setProperty("sun.java2d.accthreshold", "1");
- }
- private static final int max_rendering_count = 5;
-
- private static final Color srcColor = Color.red;
- private static final Color dstColor = Color.blue;
-
- public static void main(String[] args) {
- BufferedImage src = createSrc();
-
- VolatileImage dst = createDst();
- System.out.println("Dst: " + dst);
- boolean status;
- int count = max_rendering_count;
-
- do {
- System.out.println("render image: " + (max_rendering_count - count));
- status = render(src, dst);
-
- } while (status && count-- > 0);
-
- if (!status || count > 0) {
- throw new RuntimeException("Test failed: " + count);
- }
- }
-
- private static boolean render(BufferedImage src, VolatileImage dst) {
- int cnt = 5;
- do {
- Graphics2D g = dst.createGraphics();
- g.setColor(dstColor);
- g.fillRect(0, 0, dst.getWidth(), dst.getHeight());
- g.drawImage(src, 0, 0, null);
- g.dispose();
- } while (dst.contentsLost() && (--cnt > 0));
-
- if (cnt == 0) {
- System.err.println("Test failed: unable to render to volatile destination");
- return false;
- }
-
- BufferedImage s = dst.getSnapshot();
-
- return s.getRGB(1,1) == srcColor.getRGB();
- }
-
- private static BufferedImage createSrc() {
- final int w = 20000;
- final int h = 5;
-
- BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
- Graphics2D g = img.createGraphics();
- g.setColor(srcColor);
- g.fillRect(0, 0, w, h);
- g.dispose();
-
- return img;
- }
-
- private static VolatileImage createDst() {
- GraphicsConfiguration gc =
- GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
-
- return gc.createCompatibleVolatileImage(200, 200);
- }
-}
--- a/test/jdk/sun/java2d/OpenGL/GradientPaints.java Mon Mar 12 17:00:54 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +0,0 @@
-/*
- * Copyright (c) 2007, 2016, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @key headful
- * @bug 6521533 6525997 7102282
- * @summary Verifies that the OGL-accelerated codepaths for GradientPaint,
- * LinearGradientPaint, and RadialGradientPaint produce results that are
- * sufficiently close to those produced by the software codepaths.
- * @run main/othervm -Dsun.java2d.uiScale=1 -Dsun.java2d.opengl=True GradientPaints
- * @author campbelc
- */
-
-import java.awt.*;
-import java.awt.MultipleGradientPaint.ColorSpaceType;
-import java.awt.MultipleGradientPaint.CycleMethod;
-import java.awt.geom.*;
-import java.awt.image.*;
-import java.io.File;
-import java.util.Arrays;
-import javax.imageio.ImageIO;
-
-public class GradientPaints extends Canvas {
-
- private static final int TESTW = 600;
- private static final int TESTH = 500;
-
- /*
- * We expect slight differences in rendering between the OpenGL and
- * software pipelines due to algorithmic and rounding differences.
- * The purpose of this test is just to make sure that the OGL pipeline
- * is producing results that are "reasonably" consistent with those
- * produced in software, so we will allow +/-TOLERANCE differences
- * in each component. When comparing the test and reference images,
- * we add up the number of pixels that fall outside this tolerance
- * range and if the sum is larger than some percentage of the total
- * number of pixels.
- *
- * REMIND: Note that we have separate thresholds for linear and radial
- * gradients because the visible differences between OGL and software
- * are more apparent in the radial cases. In the future we should try
- * to reduce the number of mismatches between the two approaches, but
- * for now the visible differences are slight enough to not cause worry.
- */
- private static final int TOLERANCE = 5;
- private static final int ALLOWED_MISMATCHES_LINEAR =
- (int)(TESTW * TESTH * 0.18);
- private static final int ALLOWED_MISMATCHES_RADIAL =
- (int)(TESTW * TESTH * 0.45);
-
- private static boolean done;
- private static boolean verbose;
-
- private static final Color[] COLORS = {
- new Color(0, 0, 0),
- new Color(128, 128, 128),
- new Color(255, 0, 0),
- new Color(255, 255, 0),
- new Color(0, 255, 0),
- new Color(0, 255, 255),
- new Color(128, 0, 255),
- new Color(128, 128, 128),
- };
-
- private static enum PaintType {BASIC, LINEAR, RADIAL};
- private static enum XformType {IDENTITY, TRANSLATE, SCALE, SHEAR, ROTATE};
- private static final int[] numStopsArray = {2, 4, 7};
- private static final Object[] hints = {
- RenderingHints.VALUE_ANTIALIAS_OFF,
- RenderingHints.VALUE_ANTIALIAS_ON,
- };
-
- public void paint(Graphics g) {
- synchronized (this) {
- if (!done) {
- done = true;
- notifyAll();
- }
- }
- }
-
- private void testOne(BufferedImage refImg, VolatileImage testImg) {
- Graphics2D gref = refImg.createGraphics();
- Graphics2D gtest = testImg.createGraphics();
- Paint paint =
- makePaint(PaintType.RADIAL, CycleMethod.REPEAT,
- ColorSpaceType.SRGB, XformType.IDENTITY, 7);
- Object aahint = hints[0];
- renderTest(gref, paint, aahint);
- renderTest(gtest, paint, aahint);
- Toolkit.getDefaultToolkit().sync();
- compareImages(refImg, testImg.getSnapshot(),
- TOLERANCE, 0, "");
- gref.dispose();
- gtest.dispose();
- }
-
- private void testAll(Graphics gscreen,
- BufferedImage refImg, VolatileImage testImg)
- {
- Graphics2D gref = refImg.createGraphics();
- Graphics2D gtest = testImg.createGraphics();
- for (PaintType paintType : PaintType.values()) {
- for (CycleMethod cycleMethod : CycleMethod.values()) {
- for (ColorSpaceType colorSpace : ColorSpaceType.values()) {
- for (XformType xform : XformType.values()) {
- for (Object aahint : hints) {
- for (int numStops : numStopsArray) {
- Paint paint =
- makePaint(paintType, cycleMethod,
- colorSpace, xform, numStops);
- String msg =
- "type=" + paintType +
- " cycleMethod=" + cycleMethod +
- " colorSpace=" + colorSpace +
- " xformType=" + xform +
- " numStops=" + numStops +
- " aa=" + aahint;
- renderTest(gref, paint, aahint);
- renderTest(gtest, paint, aahint);
- gscreen.drawImage(testImg, 0, 0, null);
- Toolkit.getDefaultToolkit().sync();
- int allowedMismatches =
- paintType == PaintType.RADIAL ?
- ALLOWED_MISMATCHES_RADIAL :
- ALLOWED_MISMATCHES_LINEAR;
- compareImages(refImg, testImg.getSnapshot(),
- TOLERANCE, allowedMismatches,
- msg);
- }
- }
- }
- }
- }
- }
- gref.dispose();
- gtest.dispose();
- }
-
- private Paint makePaint(PaintType paintType,
- CycleMethod cycleMethod,
- ColorSpaceType colorSpace,
- XformType xformType, int numStops)
- {
- int startX = TESTW/6;
- int startY = TESTH/6;
- int endX = TESTW/2;
- int endY = TESTH/2;
- int ctrX = TESTW/2;
- int ctrY = TESTH/2;
- int focusX = ctrX + 20;
- int focusY = ctrY + 20;
- float radius = 100.0f;
- Paint paint;
- AffineTransform transform;
-
- Color[] colors = Arrays.copyOf(COLORS, numStops);
- float[] fractions = new float[colors.length];
- for (int i = 0; i < fractions.length; i++) {
- fractions[i] = ((float)i) / (fractions.length-1);
- }
-
- switch (xformType) {
- default:
- case IDENTITY:
- transform = new AffineTransform();
- break;
- case TRANSLATE:
- transform = AffineTransform.getTranslateInstance(2, 2);
- break;
- case SCALE:
- transform = AffineTransform.getScaleInstance(1.2, 1.4);
- break;
- case SHEAR:
- transform = AffineTransform.getShearInstance(0.1, 0.1);
- break;
- case ROTATE:
- transform = AffineTransform.getRotateInstance(Math.PI / 4,
- getWidth()/2,
- getHeight()/2);
- break;
- }
-
- switch (paintType) {
- case BASIC:
- boolean cyclic = (cycleMethod != CycleMethod.NO_CYCLE);
- paint =
- new GradientPaint(startX, startY, Color.RED,
- endX, endY, Color.BLUE, cyclic);
- break;
-
- default:
- case LINEAR:
- paint =
- new LinearGradientPaint(new Point2D.Float(startX, startY),
- new Point2D.Float(endX, endY),
- fractions, colors,
- cycleMethod, colorSpace,
- transform);
- break;
-
- case RADIAL:
- paint =
- new RadialGradientPaint(new Point2D.Float(ctrX, ctrY),
- radius,
- new Point2D.Float(focusX, focusY),
- fractions, colors,
- cycleMethod, colorSpace,
- transform);
- break;
- }
-
- return paint;
- }
-
- private void renderTest(Graphics2D g2d, Paint p, Object aahint) {
- g2d.setColor(Color.white);
- g2d.fillRect(0, 0, TESTW, TESTH);
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aahint);
- g2d.setPaint(p);
- g2d.fillOval(0, 0, TESTW, TESTH);
- }
-
- public Dimension getPreferredSize() {
- return new Dimension(TESTW, TESTH);
- }
-
- private static void compareImages(BufferedImage refImg,
- BufferedImage testImg,
- int tolerance, int allowedMismatches,
- String msg)
- {
- int numMismatches = 0;
- int x1 = 0;
- int y1 = 0;
- int x2 = refImg.getWidth();
- int y2 = refImg.getHeight();
-
- for (int y = y1; y < y2; y++) {
- for (int x = x1; x < x2; x++) {
- Color expected = new Color(refImg.getRGB(x, y));
- Color actual = new Color(testImg.getRGB(x, y));
- if (!isSameColor(expected, actual, tolerance)) {
- numMismatches++;
- }
- }
- }
-
- if (verbose) {
- System.out.println(msg);
- }
- if (numMismatches > allowedMismatches) {
- try {
- ImageIO.write(refImg, "png",
- new File("GradientPaints.ref.png"));
- ImageIO.write(testImg, "png",
- new File("GradientPaints.cap.png"));
- } catch (Exception e) {
- }
- if (!verbose) {
- System.err.println(msg);
- }
- throw new RuntimeException("Test failed: Number of mismatches (" +
- numMismatches +
- ") exceeds limit (" +
- allowedMismatches +
- ") with tolerance=" +
- tolerance);
- }
- }
-
- private static boolean isSameColor(Color c1, Color c2, int e) {
- int r1 = c1.getRed();
- int g1 = c1.getGreen();
- int b1 = c1.getBlue();
- int r2 = c2.getRed();
- int g2 = c2.getGreen();
- int b2 = c2.getBlue();
- int rmin = Math.max(r2-e, 0);
- int gmin = Math.max(g2-e, 0);
- int bmin = Math.max(b2-e, 0);
- int rmax = Math.min(r2+e, 255);
- int gmax = Math.min(g2+e, 255);
- int bmax = Math.min(b2+e, 255);
- if (r1 >= rmin && r1 <= rmax &&
- g1 >= gmin && g1 <= gmax &&
- b1 >= bmin && b1 <= bmax)
- {
- return true;
- }
- return false;
- }
-
- public static void main(String[] args) {
- if (args.length == 1 && args[0].equals("-verbose")) {
- verbose = true;
- }
-
- GradientPaints test = new GradientPaints();
- Frame frame = new Frame();
- frame.add(test);
- frame.pack();
- frame.setVisible(true);
-
- // Wait until the component's been painted
- synchronized (test) {
- while (!done) {
- try {
- test.wait();
- } catch (InterruptedException e) {
- throw new RuntimeException("Failed: Interrupted");
- }
- }
- }
-
- GraphicsConfiguration gc = frame.getGraphicsConfiguration();
- if (gc.getColorModel() instanceof IndexColorModel) {
- System.out.println("IndexColorModel detected: " +
- "test considered PASSED");
- frame.dispose();
- return;
- }
-
- BufferedImage refImg =
- new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_RGB);
- VolatileImage testImg = frame.createVolatileImage(TESTW, TESTH);
- testImg.validate(gc);
-
- try {
- test.testAll(test.getGraphics(), refImg, testImg);
- } finally {
- frame.dispose();
- }
- }
-}
--- a/test/jdk/sun/java2d/OpenGL/bug7181438.java Mon Mar 12 17:00:54 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2012, 2016, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsEnvironment;
-import java.awt.Transparency;
-import java.awt.image.BufferedImage;
-import java.awt.image.VolatileImage;
-
-/**
- * @test
- * @key headful
- * @bug 7181438
- * @summary Verifies that we get correct alpha, when we draw opaque
- * BufferedImage to non opaque VolatileImage via intermediate opaque texture.
- * @author Sergey Bylokhov
- * @run main/othervm -Dsun.java2d.accthreshold=0 bug7181438
- */
-public final class bug7181438 {
-
- private static final int SIZE = 500;
-
- public static void main(final String[] args) {
-
- final BufferedImage bi = createBufferedImage();
- final VolatileImage vi = createVolatileImage();
- final Graphics s2dVi = vi.getGraphics();
-
- //sw->texture->surface blit
- s2dVi.drawImage(bi, 0, 0, null);
-
- final BufferedImage results = vi.getSnapshot();
- for (int i = 0; i < SIZE; ++i) {
- for (int j = 0; j < SIZE; ++j) {
- //Image should be opaque: (black color and alpha = 255)
- if (results.getRGB(i, j) != 0xFF000000) {
- throw new RuntimeException("Failed: Wrong alpha");
- }
- }
- }
- System.out.println("Passed");
- }
-
-
- private static VolatileImage createVolatileImage() {
- final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
- final GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
- return gc.createCompatibleVolatileImage(SIZE, SIZE,
- Transparency.TRANSLUCENT);
- }
-
- private static BufferedImage createBufferedImage() {
- final BufferedImage bi = new BufferedImage(SIZE, SIZE,
- BufferedImage.TYPE_INT_RGB);
- final Graphics bg = bi.getGraphics();
- //Black color and alpha = 0
- bg.setColor(new Color(0, 0, 0, 0));
- bg.fillRect(0, 0, SIZE, SIZE);
- bg.dispose();
- return bi;
- }
-}
--- a/test/jdk/sun/java2d/SunGraphics2D/DrawImageBilinear.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/SunGraphics2D/DrawImageBilinear.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -23,11 +23,10 @@
/*
* @test
* @key headful
- * @bug 5009033 6603000 6666362 8159142
+ * @bug 5009033 6603000 6666362 8159142 8198613
* @summary Verifies that images transformed with bilinear filtering do not
* leave artifacts at the edges.
* @run main/othervm -Dsun.java2d.uiScale=2.5 DrawImageBilinear
- * @run main/othervm -Dsun.java2d.uiScale=2.5 -Dsun.java2d.opengl=True DrawImageBilinear
* @run main/othervm -Dsun.java2d.uiScale=2.5 -Dsun.java2d.d3d=false DrawImageBilinear
* @author campbelc
*/
--- a/test/jdk/sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/SunGraphics2D/EmptyClipRenderingTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -48,14 +48,13 @@
/**
* @test
* @key headful
- * @bug 6335200 6419610
+ * @bug 6335200 6419610 8198613
* @summary Tests that we don't render anything if specific empty clip is set
* @author Dmitri.Trembovetski@Sun.COM: area=Graphics
* @modules java.desktop/sun.awt
* @run main EmptyClipRenderingTest
* @run main/othervm -Dsun.java2d.noddraw=true EmptyClipRenderingTest
* @run main/othervm -Dsun.java2d.pmoffscreen=true EmptyClipRenderingTest
- * @run main/othervm -Dsun.java2d.opengl=true EmptyClipRenderingTest
*/
public class EmptyClipRenderingTest {
static final int IMG_W = 400;
--- a/test/jdk/sun/java2d/SunGraphics2D/PolyVertTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/SunGraphics2D/PolyVertTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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
@@ -24,11 +24,10 @@
/*
* @test
* @key headful
- * @bug 4678208 4771101 6328481 6588884
+ * @bug 4678208 4771101 6328481 6588884 8198613
* @summary verify the pixelization of degenerate polylines and polygons
* @run main PolyVertTest
* @run main/othervm -Dsun.java2d.d3d=True PolyVertTest -hwonly
- * @run main/othervm -Dsun.java2d.opengl=True PolyVertTest -hwonly
*/
import java.awt.*;
--- a/test/jdk/sun/java2d/SunGraphics2D/SimplePrimQuality.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/SunGraphics2D/SimplePrimQuality.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -24,7 +24,7 @@
/*
* @test
* @key headful
- * @bug 4832224 6322584 6328478 6328481 6322580 6588884 6587863
+ * @bug 4832224 6322584 6328478 6328481 6322580 6588884 6587863 8198613
* @summary Verifies that the pixelization of simple primitives (drawLine,
* fillRect, drawRect, fill, draw) with the OGL pipeline enabled
* matches that produced by our software loops. (The primitives tested here
@@ -34,7 +34,6 @@
* more appropriate for quick OGL testing. This test is also useful for
* comparing quality between our X11/GDI and software pipelines.
* @run main/othervm SimplePrimQuality
- * @run main/othervm -Dsun.java2d.opengl=True SimplePrimQuality
* @author campbelc
*/
--- a/test/jdk/sun/java2d/pipe/InterpolationQualityTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/pipe/InterpolationQualityTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -24,16 +24,16 @@
/*
* @test
* @key headful
- * @bug 7188093 8000176
+ * @bug 7188093 8000176 8198613
* @summary Tests each of the 3 possible methods for rendering an upscaled
* image via rendering hints for default, xrender and opengl pipelines.
*
* @author Vadim.Pakhnushev@oracle.com
* @run main/othervm -Dsun.java2d.xrender=false InterpolationQualityTest
* @run main/othervm -Dsun.java2d.xrender=True InterpolationQualityTest
- * @run main/othervm -Dsun.java2d.opengl=True InterpolationQualityTest
* @run main/othervm -Dsun.java2d.d3d=false InterpolationQualityTest
* @run main/othervm -Dsun.java2d.d3d=True InterpolationQualityTest
+ * @run main/othervm InterpolationQualityTest
*/
import java.awt.*;
--- a/test/jdk/sun/java2d/pipe/MutableColorTest/MutableColorTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/pipe/MutableColorTest/MutableColorTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -24,13 +24,12 @@
/**
* @test
* @key headful
- * @bug 6613860 6691934
+ * @bug 6613860 6691934 8198613
* @summary Tests that the pipelines can handle (in somewhat limited
* manner) mutable Colors
*
* @run main/othervm MutableColorTest
* @run main/othervm -Dsun.java2d.noddraw=true MutableColorTest
- * @run main/othervm -Dsun.java2d.opengl=True MutableColorTest
*/
import java.awt.Color;
--- a/test/jdk/sun/java2d/pipe/hw/RSLAPITest/RSLAPITest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/pipe/hw/RSLAPITest/RSLAPITest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -23,7 +23,7 @@
/*
* @test
* @key headful
- * @bug 6635805 6653780 6667607
+ * @bug 6635805 6653780 6667607 8198613
* @summary Tests that the resource sharing layer API is not broken
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @modules java.desktop/sun.java2d
@@ -32,7 +32,6 @@
* @compile -XDignore.symbol.file=true RSLAPITest.java
* @run main/othervm RSLAPITest
* @run main/othervm -Dsun.java2d.noddraw=true RSLAPITest
- * @run main/othervm -Dsun.java2d.opengl=True RSLAPITest
*/
import java.awt.Graphics;
--- a/test/jdk/sun/java2d/pipe/hw/RSLContextInvalidationTest/RSLContextInvalidationTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/pipe/hw/RSLContextInvalidationTest/RSLContextInvalidationTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -24,7 +24,7 @@
/*
* @test
* @key headful
- * @bug 6764257
+ * @bug 6764257 8198613
* @summary Tests that the color is reset properly after save/restore context
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @modules java.desktop/sun.java2d
@@ -33,7 +33,6 @@
* @compile -XDignore.symbol.file=true RSLContextInvalidationTest.java
* @run main/othervm RSLContextInvalidationTest
* @run main/othervm -Dsun.java2d.noddraw=true RSLContextInvalidationTest
- * @run main/othervm -Dsun.java2d.opengl=True RSLContextInvalidationTest
*/
import java.awt.Color;
--- a/test/jdk/sun/java2d/pipe/hw/VSyncedBufferStrategyTest/VSyncedBufferStrategyTest.java Mon Mar 12 17:00:54 2018 +0100
+++ b/test/jdk/sun/java2d/pipe/hw/VSyncedBufferStrategyTest/VSyncedBufferStrategyTest.java Mon Mar 12 09:37:49 2018 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -22,13 +22,12 @@
*/
/*
* @test
- * @bug 6678218 6681745 6691737
+ * @bug 6678218 6681745 6691737 8198613
* @summary Tests that v-synced BufferStrategies works (if vsync is supported)
* @author Dmitri.Trembovetski@sun.com: area=Graphics
* @modules java.desktop/sun.java2d.pipe.hw
* @compile -XDignore.symbol.file=true VSyncedBufferStrategyTest.java
* @run main/manual/othervm VSyncedBufferStrategyTest
- * @run main/manual/othervm -Dsun.java2d.opengl=True VSyncedBufferStrategyTest
*/
import java.awt.AWTException;