From c8875b5cae7397cb99a063135b7b83f6882ca25b Mon Sep 17 00:00:00 2001 From: malenkov Date: Fri, 10 Sep 2010 20:48:17 +0400 Subject: [PATCH] 6915566: Closed swing tests failing with assert errors when run with -ea -esa Reviewed-by: art, peterz --- .../classes/com/sun/java/swing/SwingUtilities3.java | 9 +++++---- .../com/sun/java/swing/plaf/gtk/GTKPainter.java | 10 +++++----- .../javax/swing/plaf/synth/SynthTabbedPaneUI.java | 3 ++- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/share/classes/com/sun/java/swing/SwingUtilities3.java b/src/share/classes/com/sun/java/swing/SwingUtilities3.java index fb2700f70..1ca240dd7 100644 --- a/src/share/classes/com/sun/java/swing/SwingUtilities3.java +++ b/src/share/classes/com/sun/java/swing/SwingUtilities3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2010, 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,13 +31,14 @@ import java.util.Collections; import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.Callable; +import java.applet.Applet; import java.awt.AWTEvent; import java.awt.EventQueue; import java.awt.Component; import java.awt.Container; +import java.awt.Window; import javax.swing.JComponent; import javax.swing.RepaintManager; -import javax.swing.SwingUtilities; /** * A collection of utility methods for Swing. @@ -91,7 +92,7 @@ public class SwingUtilities3 { */ public static void setVsyncRequested(Container rootContainer, boolean isRequested) { - assert SwingUtilities.getRoot(rootContainer) == rootContainer; + assert (rootContainer instanceof Applet) || (rootContainer instanceof Window); if (isRequested) { vsyncedMap.put(rootContainer, Boolean.TRUE); } else { @@ -106,7 +107,7 @@ public class SwingUtilities3 { * @return {@code true} if vsync painting is requested for {@code rootContainer} */ public static boolean isVsyncRequested(Container rootContainer) { - assert SwingUtilities.getRoot(rootContainer) == rootContainer; + assert (rootContainer instanceof Applet) || (rootContainer instanceof Window); return Boolean.TRUE == vsyncedMap.get(rootContainer); } diff --git a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java index fa9a5a2fb..57a816932 100644 --- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java +++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2010, 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 @@ -399,7 +399,7 @@ class GTKPainter extends SynthPainter { } String detail = "arrow"; - if (name == "ScrollBar.button") { + if ((name == "ScrollBar.button") || (name == "TabbedPane.button")) { if (arrowType == ArrowType.UP || arrowType == ArrowType.DOWN) { detail = "vscrollbar"; } else { @@ -409,7 +409,7 @@ class GTKPainter extends SynthPainter { name == "Spinner.previousButton") { detail = "spinbutton"; } else if (name != "ComboBox.arrowButton") { - assert false; + assert false : "unexpected name: " + name; } int gtkState = GTKLookAndFeel.synthStateToGTKState( @@ -436,7 +436,7 @@ class GTKPainter extends SynthPainter { String name = button.getName(); String detail = "button"; int direction = SwingConstants.CENTER; - if (name == "ScrollBar.button") { + if ((name == "ScrollBar.button") || (name == "TabbedPane.button")) { Integer prop = (Integer) button.getClientProperty("__arrow_direction__"); direction = (prop != null) ? @@ -457,7 +457,7 @@ class GTKPainter extends SynthPainter { } else if (name == "Spinner.nextButton") { detail = "spinbutton_up"; } else if (name != "ComboBox.arrowButton") { - assert false; + assert false : "unexpected name: " + name; } int state = context.getComponentState(); diff --git a/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java b/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java index 9daf1e2ab..4c6b446be 100644 --- a/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java +++ b/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2010, 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 @@ -914,6 +914,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI UIResource { public SynthScrollableTabButton(int direction) { super(direction); + setName("TabbedPane.button"); } } } -- GitLab