提交 c8875b5c 编写于 作者: M malenkov

6915566: Closed swing tests failing with assert errors when run with -ea -esa

Reviewed-by: art, peterz
上级 477d3450
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -31,13 +31,14 @@ import java.util.Collections; ...@@ -31,13 +31,14 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.applet.Applet;
import java.awt.AWTEvent; import java.awt.AWTEvent;
import java.awt.EventQueue; import java.awt.EventQueue;
import java.awt.Component; import java.awt.Component;
import java.awt.Container; import java.awt.Container;
import java.awt.Window;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.RepaintManager; import javax.swing.RepaintManager;
import javax.swing.SwingUtilities;
/** /**
* A collection of utility methods for Swing. * A collection of utility methods for Swing.
...@@ -91,7 +92,7 @@ public class SwingUtilities3 { ...@@ -91,7 +92,7 @@ public class SwingUtilities3 {
*/ */
public static void setVsyncRequested(Container rootContainer, public static void setVsyncRequested(Container rootContainer,
boolean isRequested) { boolean isRequested) {
assert SwingUtilities.getRoot(rootContainer) == rootContainer; assert (rootContainer instanceof Applet) || (rootContainer instanceof Window);
if (isRequested) { if (isRequested) {
vsyncedMap.put(rootContainer, Boolean.TRUE); vsyncedMap.put(rootContainer, Boolean.TRUE);
} else { } else {
...@@ -106,7 +107,7 @@ public class SwingUtilities3 { ...@@ -106,7 +107,7 @@ public class SwingUtilities3 {
* @return {@code true} if vsync painting is requested for {@code rootContainer} * @return {@code true} if vsync painting is requested for {@code rootContainer}
*/ */
public static boolean isVsyncRequested(Container 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); return Boolean.TRUE == vsyncedMap.get(rootContainer);
} }
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -399,7 +399,7 @@ class GTKPainter extends SynthPainter { ...@@ -399,7 +399,7 @@ class GTKPainter extends SynthPainter {
} }
String detail = "arrow"; String detail = "arrow";
if (name == "ScrollBar.button") { if ((name == "ScrollBar.button") || (name == "TabbedPane.button")) {
if (arrowType == ArrowType.UP || arrowType == ArrowType.DOWN) { if (arrowType == ArrowType.UP || arrowType == ArrowType.DOWN) {
detail = "vscrollbar"; detail = "vscrollbar";
} else { } else {
...@@ -409,7 +409,7 @@ class GTKPainter extends SynthPainter { ...@@ -409,7 +409,7 @@ class GTKPainter extends SynthPainter {
name == "Spinner.previousButton") { name == "Spinner.previousButton") {
detail = "spinbutton"; detail = "spinbutton";
} else if (name != "ComboBox.arrowButton") { } else if (name != "ComboBox.arrowButton") {
assert false; assert false : "unexpected name: " + name;
} }
int gtkState = GTKLookAndFeel.synthStateToGTKState( int gtkState = GTKLookAndFeel.synthStateToGTKState(
...@@ -436,7 +436,7 @@ class GTKPainter extends SynthPainter { ...@@ -436,7 +436,7 @@ class GTKPainter extends SynthPainter {
String name = button.getName(); String name = button.getName();
String detail = "button"; String detail = "button";
int direction = SwingConstants.CENTER; int direction = SwingConstants.CENTER;
if (name == "ScrollBar.button") { if ((name == "ScrollBar.button") || (name == "TabbedPane.button")) {
Integer prop = (Integer) Integer prop = (Integer)
button.getClientProperty("__arrow_direction__"); button.getClientProperty("__arrow_direction__");
direction = (prop != null) ? direction = (prop != null) ?
...@@ -457,7 +457,7 @@ class GTKPainter extends SynthPainter { ...@@ -457,7 +457,7 @@ class GTKPainter extends SynthPainter {
} else if (name == "Spinner.nextButton") { } else if (name == "Spinner.nextButton") {
detail = "spinbutton_up"; detail = "spinbutton_up";
} else if (name != "ComboBox.arrowButton") { } else if (name != "ComboBox.arrowButton") {
assert false; assert false : "unexpected name: " + name;
} }
int state = context.getComponentState(); int state = context.getComponentState();
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -914,6 +914,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI ...@@ -914,6 +914,7 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
UIResource { UIResource {
public SynthScrollableTabButton(int direction) { public SynthScrollableTabButton(int direction) {
super(direction); super(direction);
setName("TabbedPane.button");
} }
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册