You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/11/26 21:15:55 UTC
svn commit: r479418 [13/43] - in
/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common:
javax/swing/ javax/swing/border/ javax/swing/colorchooser/
javax/swing/event/ javax/swing/filechooser/ javax/swing/plaf/
javax/swing/plaf/basic/ j...
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalButtonUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalButtonUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalButtonUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalButtonUITest.java Sun Nov 26 12:15:43 2006
@@ -23,27 +23,28 @@
package javax.swing.plaf.metal;
import java.awt.Color;
-
import javax.swing.JButton;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.basic.BasicButtonUITest;
public class MetalButtonUITest extends BasicButtonUITest {
-
protected MetalButtonUI metalUI;
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
ui = new MetalButtonUI();
- metalUI = (MetalButtonUI)ui;
+ metalUI = (MetalButtonUI) ui;
}
+ @Override
public void testCreateUI() {
assertTrue("created UI is not null", null != MetalButtonUI.createUI(new JButton()));
- assertTrue("created UI is of the proper class", MetalButtonUI.createUI(null) instanceof MetalButtonUI);
- assertTrue("created UI is of unique", MetalButtonUI.createUI(null) == MetalButtonUI.createUI(null));
+ assertTrue("created UI is of the proper class",
+ MetalButtonUI.createUI(null) instanceof MetalButtonUI);
+ assertTrue("created UI is of unique", MetalButtonUI.createUI(null) == MetalButtonUI
+ .createUI(null));
}
public void testMetalButtonUI() {
@@ -53,54 +54,54 @@
}
public void testGetDisabledTextColor() {
- assertTrue("DisabledTextColor is ColorUIResource", metalUI.getDisabledTextColor() instanceof ColorUIResource);
- assertTrue("DisabledTextColor is ColorUIResource", metalUI.disabledTextColor instanceof ColorUIResource);
+ assertTrue("DisabledTextColor is ColorUIResource",
+ metalUI.getDisabledTextColor() instanceof ColorUIResource);
+ assertTrue("DisabledTextColor is ColorUIResource",
+ metalUI.disabledTextColor instanceof ColorUIResource);
metalUI.disabledTextColor = Color.WHITE;
assertSame("DisabledTextColor", Color.WHITE, metalUI.disabledTextColor);
- assertTrue("DisabledTextColor is ColorUIResource", metalUI.getDisabledTextColor() instanceof ColorUIResource);
+ assertTrue("DisabledTextColor is ColorUIResource",
+ metalUI.getDisabledTextColor() instanceof ColorUIResource);
assertNotSame("DisabledTextColor", Color.WHITE, metalUI.disabledTextColor);
final ColorUIResource red = new ColorUIResource(Color.RED);
metalUI.disabledTextColor = red;
assertNotSame("DisabledTextColor", red, metalUI.getDisabledTextColor());
-
metalUI.disabledTextColor = null;
assertNotNull("DisabledTextColor", metalUI.getDisabledTextColor());
-
UIManager.put("Button.disabledText", red);
metalUI.disabledTextColor = null;
assertSame("DisabledTextColor", red, metalUI.getDisabledTextColor());
}
public void testGetFocusColor() {
- assertTrue("FocusColor is ColorUIResource", metalUI.getFocusColor() instanceof ColorUIResource);
- assertTrue("FocusColor is ColorUIResource", metalUI.focusColor instanceof ColorUIResource);
-
+ assertTrue("FocusColor is ColorUIResource",
+ metalUI.getFocusColor() instanceof ColorUIResource);
+ assertTrue("FocusColor is ColorUIResource",
+ metalUI.focusColor instanceof ColorUIResource);
metalUI.focusColor = Color.WHITE;
assertEquals("FocusColor", Color.WHITE, metalUI.focusColor);
- assertTrue("FocusColor is ColorUIResource", metalUI.getFocusColor() instanceof ColorUIResource);
-
+ assertTrue("FocusColor is ColorUIResource",
+ metalUI.getFocusColor() instanceof ColorUIResource);
final ColorUIResource red = new ColorUIResource(Color.RED);
metalUI.focusColor = red;
assertNotSame(red, metalUI.getFocusColor());
-
metalUI.disabledTextColor = null;
assertNotNull(metalUI.getFocusColor());
}
public void testGetSelectColor() {
- assertTrue("SelectColor is ColorUIResource", metalUI.getSelectColor() instanceof ColorUIResource);
- assertTrue("SelectColor is ColorUIResource", metalUI.selectColor instanceof ColorUIResource);
-
+ assertTrue("SelectColor is ColorUIResource",
+ metalUI.getSelectColor() instanceof ColorUIResource);
+ assertTrue("SelectColor is ColorUIResource",
+ metalUI.selectColor instanceof ColorUIResource);
metalUI.selectColor = Color.WHITE;
assertEquals("SelectColor", Color.WHITE, metalUI.selectColor);
- assertTrue("FocusColor is ColorUIResource", metalUI.getSelectColor() instanceof ColorUIResource);
-
+ assertTrue("FocusColor is ColorUIResource",
+ metalUI.getSelectColor() instanceof ColorUIResource);
final ColorUIResource red = new ColorUIResource(Color.RED);
metalUI.selectColor = red;
assertNotSame(red, metalUI.getSelectColor());
-
metalUI.selectColor = null;
assertNotNull(metalUI.getSelectColor());
}
-
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxIconTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxIconTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxIconTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxIconTest.java Sun Nov 26 12:15:43 2006
@@ -15,22 +15,23 @@
* limitations under the License.
*/
/**
-* @author Alexander T. Simbirtsev
-* @version $Revision$
-*/
+ * @author Alexander T. Simbirtsev
+ * @version $Revision$
+ */
package javax.swing.plaf.metal;
import junit.framework.TestCase;
public class MetalCheckBoxIconTest extends TestCase {
-
protected MetalCheckBoxIcon icon;
+ @Override
protected void setUp() throws Exception {
super.setUp();
icon = new MetalCheckBoxIcon();
}
+ @Override
protected void tearDown() throws Exception {
icon = null;
super.tearDown();
@@ -56,5 +57,4 @@
public void testGetIconHeight() {
assertEquals(icon.getControlSize(), icon.getIconHeight());
}
-
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalCheckBoxUITest.java Sun Nov 26 12:15:43 2006
@@ -25,7 +25,6 @@
import java.awt.Color;
import java.awt.Font;
import java.awt.image.BufferedImage;
-
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@@ -40,7 +39,6 @@
import javax.swing.plaf.IconUIResource;
public class MetalCheckBoxUITest extends MetalRadioButtonUITest {
-
PublicMetalCheckBoxUI publicUI;
public static void main(final String[] args) {
@@ -50,28 +48,32 @@
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
publicUI = new PublicMetalCheckBoxUI();
}
+ @Override
public void testCreateUI() {
assertTrue("created UI is not null", null != MetalCheckBoxUI.createUI(new JButton()));
- assertTrue("created UI is of the proper class", MetalCheckBoxUI.createUI(null) instanceof MetalCheckBoxUI);
- assertTrue("created UI is not shared", MetalCheckBoxUI.createUI(null) == MetalCheckBoxUI.createUI(null));
+ assertTrue("created UI is of the proper class",
+ MetalCheckBoxUI.createUI(null) instanceof MetalCheckBoxUI);
+ assertTrue("created UI is not shared",
+ MetalCheckBoxUI.createUI(null) == MetalCheckBoxUI.createUI(null));
}
class PublicMetalCheckBoxUI extends MetalCheckBoxUI {
+ @Override
public String getPropertyPrefix() {
return super.getPropertyPrefix();
}
-
public void setDisabledTextColor(final Color color) {
disabledTextColor = color;
}
+ @Override
public Color getDisabledTextColor() {
return super.getDisabledTextColor();
}
@@ -80,6 +82,7 @@
focusColor = color;
}
+ @Override
public Color getFocusColor() {
return super.getFocusColor();
}
@@ -88,15 +91,18 @@
selectColor = color;
}
+ @Override
public Color getSelectColor() {
return super.getSelectColor();
}
+ @Override
public void uninstallDefaults(final AbstractButton b) {
super.uninstallDefaults(b);
}
}
+ @Override
public void testUninstallDefaults() {
JCheckBox button = new JCheckBox();
UIManager.put("CheckBox.disabledText", new ColorUIResource(Color.red));
@@ -108,10 +114,9 @@
UIManager.put("CheckBox.font", font);
Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UIManager.put("CheckBox.border", border);
- Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB)));
+ Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
+ BufferedImage.TYPE_INT_RGB)));
UIManager.put("CheckBox.icon", icon);
-
-
button.setUI(publicUI);
publicUI.installDefaults(button);
publicUI.uninstallDefaults(button);
@@ -125,6 +130,7 @@
assertEquals("icon", icon, publicUI.getDefaultIcon());
}
+ @Override
public void testInstallDefaults() {
JCheckBox button = new JCheckBox();
UIManager.put("CheckBox.disabledText", new ColorUIResource(Color.red));
@@ -136,10 +142,9 @@
UIManager.put("CheckBox.font", font);
Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UIManager.put("CheckBox.border", border);
- Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB)));
+ Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
+ BufferedImage.TYPE_INT_RGB)));
UIManager.put("CheckBox.icon", icon);
-
-
button.setUI(publicUI);
publicUI.installDefaults(button);
assertEquals(Color.blue, button.getBackground());
@@ -155,5 +160,4 @@
public void testGetPropertyPrefix() {
assertEquals("prefix ", "CheckBox.", publicUI.getPropertyPrefix());
}
-
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxButtonTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxButtonTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxButtonTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxButtonTest.java Sun Nov 26 12:15:43 2006
@@ -21,7 +21,6 @@
package javax.swing.plaf.metal;
import java.awt.ComponentOrientation;
-
import javax.swing.CellRendererPane;
import javax.swing.Icon;
import javax.swing.ImageIcon;
@@ -36,10 +35,12 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
button = new MetalComboBoxButton(new JComboBox(), null, null, null);
}
+ @Override
protected void tearDown() throws Exception {
button = null;
}
@@ -50,30 +51,25 @@
assertNull(button.listBox);
assertNull(button.rendererPane);
assertFalse(button.isIconOnly());
-
JComboBox comboBox = new JComboBox();
Icon comboIcon = new ImageIcon();
CellRendererPane rendererPane = new CellRendererPane();
JList list = new JList();
-
button = new MetalComboBoxButton(comboBox, comboIcon, rendererPane, list);
assertEquals(comboBox, button.comboBox);
assertEquals(comboIcon, button.comboIcon);
assertEquals(rendererPane, button.rendererPane);
assertEquals(list, button.listBox);
assertFalse(button.isIconOnly());
-
button = new MetalComboBoxButton(comboBox, comboIcon, true, rendererPane, list);
assertEquals(comboBox, button.comboBox);
assertEquals(comboIcon, button.comboIcon);
assertEquals(rendererPane, button.rendererPane);
assertEquals(list, button.listBox);
assertTrue(button.isIconOnly());
-
comboBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
button = new MetalComboBoxButton(comboBox, null, null, null);
assertTrue(button.getComponentOrientation().isLeftToRight());
-
comboBox.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
assertTrue(button.getComponentOrientation().isLeftToRight());
}
@@ -110,7 +106,6 @@
assertTrue(button.isEnabled());
button.setEnabled(false);
assertFalse(button.isEnabled());
-
JComboBox comboBox = new JComboBox();
comboBox.setEnabled(false);
button = new MetalComboBoxButton(comboBox, null, null, null);
@@ -121,4 +116,3 @@
button.paintComponent(createTestGraphics());
}
}
-
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxEditorTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxEditorTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxEditorTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxEditorTest.java Sun Nov 26 12:15:43 2006
@@ -21,7 +21,6 @@
package javax.swing.plaf.metal;
import java.awt.Insets;
-
import javax.swing.BorderFactory;
import javax.swing.JTextField;
import javax.swing.SwingTestCase;
@@ -33,26 +32,24 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
editor = new MetalComboBoxEditor();
}
+ @Override
protected void tearDown() throws Exception {
editor = null;
}
public void testMetalComboBoxEditor() throws Exception {
assertNotNull(MetalComboBoxEditor.editorBorderInsets);
-
- JTextField textEditor = (JTextField)editor.getEditorComponent();
+ JTextField textEditor = (JTextField) editor.getEditorComponent();
assertEquals(MetalComboBoxEditor.editorBorderInsets, textEditor.getInsets());
-
MetalComboBoxEditor.editorBorderInsets = new Insets(2, 2, 2, 2);
assertEquals(MetalComboBoxEditor.editorBorderInsets, textEditor.getInsets());
-
textEditor.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
assertNotSame(MetalComboBoxEditor.editorBorderInsets, textEditor.getInsets());
-
MetalComboBoxEditor.editorBorderInsets = new Insets(2, 2, 2, 2);
assertNotSame(MetalComboBoxEditor.editorBorderInsets, textEditor.getInsets());
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxIconTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxIconTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxIconTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxIconTest.java Sun Nov 26 12:15:43 2006
@@ -30,10 +30,12 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
icon = new MetalComboBoxIcon();
}
+ @Override
protected void tearDown() throws Exception {
icon = null;
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalComboBoxUITest.java Sun Nov 26 12:15:43 2006
@@ -25,7 +25,6 @@
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.image.BufferedImage;
-
import javax.swing.BorderFactory;
import javax.swing.CellRendererPane;
import javax.swing.JButton;
@@ -41,17 +40,20 @@
public class MetalComboBoxUITest extends SwingTestCase {
private TestUI ui;
+
private JComboBox comboBox;
public MetalComboBoxUITest(final String name) {
super(name);
}
+ @Override
protected void setUp() throws Exception {
ui = new TestUI();
comboBox = new JComboBox();
}
+ @Override
protected void tearDown() throws Exception {
ui = null;
comboBox = null;
@@ -65,7 +67,6 @@
public void testCreateUI() throws Exception {
ComponentUI ui1 = MetalComboBoxUI.createUI(comboBox);
assertTrue(ui1.getClass() == MetalComboBoxUI.class);
-
ComponentUI ui2 = MetalComboBoxUI.createUI(comboBox);
assertNotSame(ui1, ui2);
}
@@ -88,7 +89,8 @@
//TODO
public void testLayoutComboBox() throws Exception {
ui.setComboBox(comboBox);
- ui.layoutComboBox(null, (MetalComboBoxUI.MetalComboBoxLayoutManager)ui.createLayoutManager());
+ ui.layoutComboBox(null, (MetalComboBoxUI.MetalComboBoxLayoutManager) ui
+ .createLayoutManager());
}
public void testGetMinimumSize() throws Exception {
@@ -98,17 +100,17 @@
ui.setListBox(popup.getList());
ui.installListeners();
comboBox.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
-
- Dimension listPart = new BasicComboBoxRenderer().getListCellRendererComponent(popup.getList(), "", -1, false, false).getPreferredSize();
- Dimension expectedSize = new Dimension(listPart.width + listPart.height + 8, listPart.height + 8);
+ Dimension listPart = new BasicComboBoxRenderer().getListCellRendererComponent(
+ popup.getList(), "", -1, false, false).getPreferredSize();
+ Dimension expectedSize = new Dimension(listPart.width + listPart.height + 8,
+ listPart.height + 8);
assertEquals(expectedSize, ui.getMinimumSize(null));
assertEquals(expectedSize, ui.getCachedMinimumSize());
-
ui.setCachedMinimumSize(new Dimension(100, 100));
assertEquals(ui.getCachedMinimumSize(), ui.getMinimumSize(null));
-
comboBox.addItem("aaa");
- listPart = new BasicComboBoxRenderer().getListCellRendererComponent(popup.getList(), "aaa", -1, false, false).getPreferredSize();
+ listPart = new BasicComboBoxRenderer().getListCellRendererComponent(popup.getList(),
+ "aaa", -1, false, false).getPreferredSize();
expectedSize = new Dimension(listPart.width + listPart.height + 8, listPart.height + 8);
assertEquals(expectedSize, ui.getMinimumSize(null));
}
@@ -120,9 +122,8 @@
public void testCreateArrowButton() throws Exception {
ui.setComboBox(comboBox);
assertTrue(ui.createArrowButton().getClass() == MetalComboBoxButton.class);
- MetalComboBoxButton arrowButton = (MetalComboBoxButton)ui.createArrowButton();
+ MetalComboBoxButton arrowButton = (MetalComboBoxButton) ui.createArrowButton();
assertEquals("", arrowButton.getText());
-
assertEquals(comboBox, arrowButton.getComboBox());
assertTrue(arrowButton.getComboIcon().getClass() == MetalComboBoxIcon.class);
if (isHarmony()) {
@@ -130,11 +131,10 @@
} else {
assertTrue(arrowButton.isIconOnly());
}
-
assertEquals(SwingConstants.TRAILING, arrowButton.getHorizontalTextPosition());
assertEquals(SwingConstants.CENTER, arrowButton.getHorizontalAlignment());
-
- assertEquals(new Insets(3, 4, 4, 6), arrowButton.getBorder().getBorderInsets(arrowButton));
+ assertEquals(new Insets(3, 4, 4, 6), arrowButton.getBorder().getBorderInsets(
+ arrowButton));
}
public void testCreateLayoutManager() throws Exception {
@@ -146,12 +146,10 @@
assertTrue(ui.createPopup() instanceof BasicComboPopup);
}
-
private Graphics createGraphics() {
return new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR).createGraphics();
}
-
private class TestUI extends MetalComboBoxUI {
public void setComboBox(final JComboBox comboBox) {
this.comboBox = comboBox;
@@ -173,6 +171,7 @@
return editor;
}
+ @Override
public void installListeners() {
super.installListeners();
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalDesktopIconUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalDesktopIconUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalDesktopIconUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalDesktopIconUITest.java Sun Nov 26 12:15:43 2006
@@ -18,11 +18,9 @@
* @author Vadim L. Bogdanov
* @version $Revision$
*/
-
package javax.swing.plaf.metal;
import java.awt.Dimension;
-
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import javax.swing.SwingTestCase;
@@ -31,7 +29,9 @@
public class MetalDesktopIconUITest extends SwingTestCase {
private TestMetalDesktopIconUI ui;
+
private JInternalFrame.JDesktopIcon icon;
+
private JInternalFrame frame;
private class TestMetalDesktopIconUI extends MetalDesktopIconUI {
@@ -43,9 +43,9 @@
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
frame = new JInternalFrame();
icon = frame.getDesktopIcon();
ui = new TestMetalDesktopIconUI();
@@ -55,6 +55,7 @@
/*
* @see TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
@@ -73,7 +74,6 @@
public void testCreateUI() {
ComponentUI ui1 = MetalDesktopIconUI.createUI(frame);
ComponentUI ui2 = MetalDesktopIconUI.createUI(frame);
-
assertTrue("not null", ui1 != null);
assertTrue("statefull", ui1 != ui2);
}
@@ -82,16 +82,16 @@
* Class under test for Dimension getMaximumSize(JComponent)
*/
public void testGetMaximumSize() {
- assertEquals("== minimumSize (JRockit fails)", ui.getMinimumSize(icon),
- ui.getMaximumSize(icon));
+ assertEquals("== minimumSize (JRockit fails)", ui.getMinimumSize(icon), ui
+ .getMaximumSize(icon));
}
/*
* Class under test for Dimension getMinimumSize(JComponent)
*/
public void testGetMinimumSize() {
- assertEquals("== preferredSize (JRockit fails)",
- ui.getPreferredSize(icon), ui.getMinimumSize(icon));
+ assertEquals("== preferredSize (JRockit fails)", ui.getPreferredSize(icon), ui
+ .getMinimumSize(icon));
}
/*
@@ -101,13 +101,11 @@
Dimension size = ui.getPreferredSize(icon);
int desktopIconWidth = UIManager.getInt("DesktopIcon.width");
assertEquals("width ok", desktopIconWidth, size.width);
-
icon.setSize(ui.getPreferredSize(icon));
icon.doLayout();
if (isHarmony()) {
- assertEquals("height ok",
- ui.getIconPane().getPreferredSize().height,
- ui.getIconPane().getSize().height);
+ assertEquals("height ok", ui.getIconPane().getPreferredSize().height, ui
+ .getIconPane().getSize().height);
}
}
@@ -115,7 +113,6 @@
int count = icon.getComponentCount();
ui.uninstallComponents();
assertEquals("uninstalled", count - 2, icon.getComponentCount());
-
ui.installComponents();
assertEquals("added 2 component", count, icon.getComponentCount());
if (isHarmony()) {
@@ -128,7 +125,6 @@
if (isHarmony()) {
assertTrue("added iconPane", icon.isAncestorOf(ui.getIconPane()));
}
-
ui.uninstallComponents();
assertEquals("uninstalled", count - 2, icon.getComponentCount());
if (isHarmony()) {
@@ -140,7 +136,6 @@
icon.setBackground(null);
icon.setForeground(null);
icon.setFont(null);
-
ui.installDefaults();
assertTrue("opaque", icon.isOpaque());
assertNotNull(icon.getBackground());
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalFileChooserUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalFileChooserUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalFileChooserUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalFileChooserUITest.java Sun Nov 26 12:15:43 2006
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* @author Anton Avtamonov
* @version $Revision$
@@ -24,7 +23,6 @@
import java.awt.Dimension;
import java.util.Arrays;
import java.util.List;
-
import javax.swing.ActionMap;
import javax.swing.JButton;
import javax.swing.JFileChooser;
@@ -35,17 +33,20 @@
public class MetalFileChooserUITest extends SwingTestCase {
private MetalFileChooserUI ui;
+
private JFileChooser fc;
public MetalFileChooserUITest(final String name) {
super(name);
}
+ @Override
protected void setUp() throws Exception {
fc = new JFileChooser();
ui = new MetalFileChooserUI(fc);
}
+ @Override
protected void tearDown() throws Exception {
ui = null;
fc = null;
@@ -78,51 +79,47 @@
public void testCreateActionMap() throws Exception {
ui.installUI(fc);
ActionMap map = ui.createActionMap();
- List allKeys = Arrays.asList(map.allKeys());
+ List<Object> allKeys = Arrays.asList(map.allKeys());
assertEquals(3, allKeys.size());
assertTrue(allKeys.contains("approveSelection"));
assertEquals(ui.getApproveSelectionAction(), map.get("approveSelection"));
-
assertTrue(allKeys.contains("cancelSelection"));
assertEquals(ui.getCancelSelectionAction(), map.get("cancelSelection"));
-
assertTrue(allKeys.contains("Go Up"));
assertEquals(ui.getChangeToParentDirectoryAction(), map.get("Go Up"));
}
public void testCreateList() throws Exception {
ui.installUI(fc);
-
JPanel listPanel = ui.createList(fc);
assertNotNull(listPanel);
if (isHarmony()) {
assertEquals(2, listPanel.getComponentCount());
}
assertTrue(listPanel.getComponent(0) instanceof JScrollPane);
- assertTrue(((JScrollPane)listPanel.getComponent(0)).getViewport().getView() instanceof JList);
- JList list = (JList)((JScrollPane)listPanel.getComponent(0)).getViewport().getView();
+ assertTrue(((JScrollPane) listPanel.getComponent(0)).getViewport().getView() instanceof JList);
+ JList list = (JList) ((JScrollPane) listPanel.getComponent(0)).getViewport().getView();
assertEquals(ui.getModel(), list.getModel());
-
assertNotSame(ui.createList(fc), ui.createList(fc));
}
// TODO: detail view is not implemented yet
public void testCreateDetailsView() throws Exception {
ui.installUI(fc);
-// JPanel detailsView = ui.createDetailsView(fc);
-// assertNotNull(detailsView);
-// assertEquals(1, detailsView.getComponentCount());
-// assertTrue(detailsView.getComponent(0) instanceof JScrollPane);
-// assertTrue(((JScrollPane)detailsView.getComponent(0)).getViewport().getView() instanceof JTable);
-// JTable table = (JList)((JScrollPane)listPanel.getComponent(0)).getViewport().getView();
-// assertEquals(ui.getModel(), list.getModel());
-
-// assertNotSame(ui.createList(fc), ui.createList(fc));
+ // JPanel detailsView = ui.createDetailsView(fc);
+ // assertNotNull(detailsView);
+ // assertEquals(1, detailsView.getComponentCount());
+ // assertTrue(detailsView.getComponent(0) instanceof JScrollPane);
+ // assertTrue(((JScrollPane)detailsView.getComponent(0)).getViewport().getView() instanceof JTable);
+ // JTable table = (JList)((JScrollPane)listPanel.getComponent(0)).getViewport().getView();
+ // assertEquals(ui.getModel(), list.getModel());
+ // assertNotSame(ui.createList(fc), ui.createList(fc));
}
public void testCreateListSelectionListener() throws Exception {
assertNotNull(ui.createListSelectionListener(null));
- assertNotSame(ui.createListSelectionListener(null), ui.createListSelectionListener(null));
+ assertNotSame(ui.createListSelectionListener(null), ui
+ .createListSelectionListener(null));
}
public void testGetPreferredSize() throws Exception {
@@ -135,7 +132,8 @@
public void testGetMaxiumumSize() throws Exception {
assertNotNull(ui.getMaximumSize(null));
- assertEquals(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE), ui.getMaximumSize(null));
+ assertEquals(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE), ui
+ .getMaximumSize(null));
}
public void testCreatePropertyChangeListener() throws Exception {
@@ -154,17 +152,16 @@
assertNotNull(ui.getApproveButton(fc));
assertEquals(ui.getApproveButton(fc), ui.getApproveButton(fc));
}
-
-// private void traverse(final Container cont) {
-// for (int i = 0; i < cont.getComponentCount(); i++) {
-// Component child = cont.getComponent(i);
-// if (child instanceof JButton) {
-// System.err.println("Button " + ((JButton)child).getText());
-// }
-//
-// if (child instanceof Container) {
-// traverse((Container)child);
-// }
-// }
-// }
+ // private void traverse(final Container cont) {
+ // for (int i = 0; i < cont.getComponentCount(); i++) {
+ // Component child = cont.getComponent(i);
+ // if (child instanceof JButton) {
+ // System.err.println("Button " + ((JButton)child).getText());
+ // }
+ //
+ // if (child instanceof Container) {
+ // traverse((Container)child);
+ // }
+ // }
+ // }
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalIconFactoryTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalIconFactoryTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalIconFactoryTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalIconFactoryTest.java Sun Nov 26 12:15:43 2006
@@ -14,12 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* @author Sergey Burlak
* @version $Revision$
*/
-
package javax.swing.plaf.metal;
import javax.swing.Icon;
@@ -27,7 +25,6 @@
import javax.swing.plaf.UIResource;
public class MetalIconFactoryTest extends SwingTestCase {
-
public void testGetCheckBoxIcon() {
Icon icon = MetalIconFactory.getCheckBoxIcon();
checkIcon(icon, 13, 13);
@@ -38,49 +35,56 @@
Icon icon = MetalIconFactory.getCheckBoxMenuItemIcon();
checkIcon(icon, 10, 10);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getCheckBoxMenuItemIcon() == MetalIconFactory.getCheckBoxMenuItemIcon());
+ assertTrue(MetalIconFactory.getCheckBoxMenuItemIcon() == MetalIconFactory
+ .getCheckBoxMenuItemIcon());
}
public void testGetFileChooserDetailViewIcon() {
Icon icon = MetalIconFactory.getFileChooserDetailViewIcon();
checkIcon(icon, 18, 18);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getFileChooserDetailViewIcon() == MetalIconFactory.getFileChooserDetailViewIcon());
+ assertTrue(MetalIconFactory.getFileChooserDetailViewIcon() == MetalIconFactory
+ .getFileChooserDetailViewIcon());
}
public void testGetFileChooserHomeFolderIcon() {
Icon icon = MetalIconFactory.getFileChooserHomeFolderIcon();
checkIcon(icon, 18, 18);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getFileChooserHomeFolderIcon() == MetalIconFactory.getFileChooserHomeFolderIcon());
+ assertTrue(MetalIconFactory.getFileChooserHomeFolderIcon() == MetalIconFactory
+ .getFileChooserHomeFolderIcon());
}
public void testGetFileChooserListViewIcon() {
Icon icon = MetalIconFactory.getFileChooserListViewIcon();
checkIcon(icon, 18, 18);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getFileChooserListViewIcon() == MetalIconFactory.getFileChooserListViewIcon());
+ assertTrue(MetalIconFactory.getFileChooserListViewIcon() == MetalIconFactory
+ .getFileChooserListViewIcon());
}
public void testGetFileChooserNewFolderIcon() {
Icon icon = MetalIconFactory.getFileChooserNewFolderIcon();
checkIcon(icon, 18, 18);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getFileChooserNewFolderIcon() == MetalIconFactory.getFileChooserNewFolderIcon());
+ assertTrue(MetalIconFactory.getFileChooserNewFolderIcon() == MetalIconFactory
+ .getFileChooserNewFolderIcon());
}
public void testGetFileChooserUpFolserIcon() {
Icon icon = MetalIconFactory.getFileChooserUpFolderIcon();
checkIcon(icon, 18, 18);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getFileChooserUpFolderIcon() == MetalIconFactory.getFileChooserUpFolderIcon());
+ assertTrue(MetalIconFactory.getFileChooserUpFolderIcon() == MetalIconFactory
+ .getFileChooserUpFolderIcon());
}
public void testGetHorizontalSliderThumbIcon() {
Icon icon = MetalIconFactory.getHorizontalSliderThumbIcon();
checkIcon(icon, 16, 15);
assertTrue(icon instanceof UIResource);
- assertSame(MetalIconFactory.getHorizontalSliderThumbIcon(), MetalIconFactory.getHorizontalSliderThumbIcon());
+ assertSame(MetalIconFactory.getHorizontalSliderThumbIcon(), MetalIconFactory
+ .getHorizontalSliderThumbIcon());
}
public void testGetInternalFrameAltMaximizeIcon() {
@@ -88,7 +92,8 @@
Icon icon = MetalIconFactory.getInternalFrameAltMaximizeIcon(size);
checkIcon(icon, size, size);
assertTrue(icon instanceof UIResource);
- assertFalse(MetalIconFactory.getInternalFrameAltMaximizeIcon(size) == MetalIconFactory.getInternalFrameAltMaximizeIcon(size));
+ assertFalse(MetalIconFactory.getInternalFrameAltMaximizeIcon(size) == MetalIconFactory
+ .getInternalFrameAltMaximizeIcon(size));
}
public void testGetInternalFrameCloseIcon() {
@@ -96,14 +101,16 @@
Icon icon = MetalIconFactory.getInternalFrameCloseIcon(size);
checkIcon(icon, size, size);
assertTrue(icon instanceof UIResource);
- assertFalse(MetalIconFactory.getInternalFrameCloseIcon(size) == MetalIconFactory.getInternalFrameCloseIcon(size));
+ assertFalse(MetalIconFactory.getInternalFrameCloseIcon(size) == MetalIconFactory
+ .getInternalFrameCloseIcon(size));
}
public void testGetInternalFrameDefaultMenuIcon() {
Icon icon = MetalIconFactory.getInternalFrameDefaultMenuIcon();
checkIcon(icon, 16, 16);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getInternalFrameDefaultMenuIcon() == MetalIconFactory.getInternalFrameDefaultMenuIcon());
+ assertTrue(MetalIconFactory.getInternalFrameDefaultMenuIcon() == MetalIconFactory
+ .getInternalFrameDefaultMenuIcon());
}
public void testGetInternalFrameMaximizeIcon() {
@@ -111,7 +118,8 @@
Icon icon = MetalIconFactory.getInternalFrameMaximizeIcon(size);
checkIcon(icon, size, size);
assertTrue(icon instanceof UIResource);
- assertFalse(MetalIconFactory.getInternalFrameMaximizeIcon(size) == MetalIconFactory.getInternalFrameMaximizeIcon(size));
+ assertFalse(MetalIconFactory.getInternalFrameMaximizeIcon(size) == MetalIconFactory
+ .getInternalFrameMaximizeIcon(size));
}
public void testGetInternalFrameMinimizeIcon() {
@@ -119,7 +127,8 @@
Icon icon = MetalIconFactory.getInternalFrameMinimizeIcon(size);
checkIcon(icon, size, size);
assertTrue(icon instanceof UIResource);
- assertFalse(MetalIconFactory.getInternalFrameMinimizeIcon(size) == MetalIconFactory.getInternalFrameMinimizeIcon(size));
+ assertFalse(MetalIconFactory.getInternalFrameMinimizeIcon(size) == MetalIconFactory
+ .getInternalFrameMinimizeIcon(size));
}
public void testGetMenuArrowIcon() {
@@ -133,7 +142,8 @@
Icon icon = MetalIconFactory.getMenuItemArrowIcon();
checkIcon(icon, 8, 4);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getMenuItemArrowIcon() == MetalIconFactory.getMenuItemArrowIcon());
+ assertTrue(MetalIconFactory.getMenuItemArrowIcon() == MetalIconFactory
+ .getMenuItemArrowIcon());
}
public void testGetMenuItemCheckIcon() {
@@ -144,56 +154,66 @@
Icon icon = MetalIconFactory.getRadioButtonIcon();
checkIcon(icon, 13, 13);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getRadioButtonIcon() == MetalIconFactory.getRadioButtonIcon());
+ assertTrue(MetalIconFactory.getRadioButtonIcon() == MetalIconFactory
+ .getRadioButtonIcon());
}
public void testGetRadioButtonMenuItemIcon() {
Icon icon = MetalIconFactory.getRadioButtonMenuItemIcon();
checkIcon(icon, 10, 10);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getRadioButtonMenuItemIcon() == MetalIconFactory.getRadioButtonMenuItemIcon());
+ assertTrue(MetalIconFactory.getRadioButtonMenuItemIcon() == MetalIconFactory
+ .getRadioButtonMenuItemIcon());
}
public void testGetTreeComputerIcon() {
Icon icon = MetalIconFactory.getTreeComputerIcon();
checkIcon(icon, 16, 16);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getTreeComputerIcon() == MetalIconFactory.getTreeComputerIcon());
+ assertTrue(MetalIconFactory.getTreeComputerIcon() == MetalIconFactory
+ .getTreeComputerIcon());
}
public void testGetTreeControlIcon() {
- MetalIconFactory.TreeControlIcon icon = (MetalIconFactory.TreeControlIcon)MetalIconFactory.getTreeControlIcon(true);
+ MetalIconFactory.TreeControlIcon icon = (MetalIconFactory.TreeControlIcon) MetalIconFactory
+ .getTreeControlIcon(true);
checkIcon(icon, 18, 18);
assertFalse(icon instanceof UIResource);
assertTrue(icon.isLight);
- assertFalse(MetalIconFactory.getTreeControlIcon(true) == MetalIconFactory.getTreeControlIcon(true));
+ assertFalse(MetalIconFactory.getTreeControlIcon(true) == MetalIconFactory
+ .getTreeControlIcon(true));
}
public void testGetTreeFloppyDriveIcon() {
Icon icon = MetalIconFactory.getTreeFloppyDriveIcon();
checkIcon(icon, 16, 16);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getTreeFloppyDriveIcon() == MetalIconFactory.getTreeFloppyDriveIcon());
+ assertTrue(MetalIconFactory.getTreeFloppyDriveIcon() == MetalIconFactory
+ .getTreeFloppyDriveIcon());
}
public void testGetTreeFolderIcon() {
- MetalIconFactory.TreeFolderIcon icon = (MetalIconFactory.TreeFolderIcon)MetalIconFactory.getTreeFolderIcon();
+ MetalIconFactory.TreeFolderIcon icon = (MetalIconFactory.TreeFolderIcon) MetalIconFactory
+ .getTreeFolderIcon();
checkIcon(icon, 18, 16);
assertFalse(icon instanceof UIResource);
assertEquals(-1, icon.getShift());
assertEquals(2, icon.getAdditionalHeight());
- assertFalse(MetalIconFactory.getTreeFolderIcon() == MetalIconFactory.getTreeFolderIcon());
+ assertFalse(MetalIconFactory.getTreeFolderIcon() == MetalIconFactory
+ .getTreeFolderIcon());
}
public void testGetTreeHardDriveIcon() {
Icon icon = MetalIconFactory.getTreeHardDriveIcon();
checkIcon(icon, 16, 16);
assertTrue(icon instanceof UIResource);
- assertTrue(MetalIconFactory.getTreeHardDriveIcon() == MetalIconFactory.getTreeHardDriveIcon());
+ assertTrue(MetalIconFactory.getTreeHardDriveIcon() == MetalIconFactory
+ .getTreeHardDriveIcon());
}
public void testGetTreeLeafIcon() {
- MetalIconFactory.TreeLeafIcon icon = (MetalIconFactory.TreeLeafIcon)MetalIconFactory.getTreeLeafIcon();
+ MetalIconFactory.TreeLeafIcon icon = (MetalIconFactory.TreeLeafIcon) MetalIconFactory
+ .getTreeLeafIcon();
checkIcon(icon, 20, 16);
assertEquals(2, icon.getShift());
assertEquals(4, icon.getAdditionalHeight());
@@ -205,7 +225,8 @@
Icon icon = MetalIconFactory.getVerticalSliderThumbIcon();
checkIcon(icon, 15, 16);
assertTrue(icon instanceof UIResource);
- assertSame(MetalIconFactory.getVerticalSliderThumbIcon(), MetalIconFactory.getVerticalSliderThumbIcon());
+ assertSame(MetalIconFactory.getVerticalSliderThumbIcon(), MetalIconFactory
+ .getVerticalSliderThumbIcon());
}
public void testPaletteCloseIcon() {
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameTitlePaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameTitlePaneTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameTitlePaneTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameTitlePaneTest.java Sun Nov 26 12:15:43 2006
@@ -18,20 +18,17 @@
* @author Vadim L. Bogdanov
* @version $Revision$
*/
-
package javax.swing.plaf.metal;
import java.awt.LayoutManager;
import java.awt.Rectangle;
import java.beans.PropertyChangeListener;
-
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
-
import javax.swing.SwingTestCase;
public class MetalInternalFrameTitlePaneTest extends SwingTestCase {
@@ -39,6 +36,8 @@
* This class is used to access protected members
*/
private class TestMetalInternalFrameTitlePane extends MetalInternalFrameTitlePane {
+ private static final long serialVersionUID = 1L;
+
public TestMetalInternalFrameTitlePane(final JInternalFrame frame) {
super(frame);
}
@@ -82,9 +81,9 @@
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
frame = new JInternalFrame();
pane = new MetalInternalFrameTitlePane(frame);
}
@@ -92,6 +91,7 @@
/*
* @see TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
@@ -110,7 +110,6 @@
frame = new JInternalFrame("", true, true, true, true);
pane = new MetalInternalFrameTitlePane(frame);
assertEquals(3, pane.getComponentCount());
-
frame = new JInternalFrame("", true, true, true, false);
pane = new MetalInternalFrameTitlePane(frame);
if (isHarmony()) {
@@ -125,11 +124,9 @@
pane.uninstallDefaults();
pane.paletteTitleHeight = 0;
pane.paletteCloseIcon = null;
-
pane.installDefaults();
assertTrue("paletteTitleHeight != 0", pane.paletteTitleHeight != 0);
- assertTrue("installed paletteCloseIcon",
- pane.paletteCloseIcon != null);
+ assertTrue("installed paletteCloseIcon", pane.paletteCloseIcon != null);
}
/*
@@ -137,10 +134,8 @@
*/
public void testUninstallDefaults() {
pane.uninstallDefaults();
-
assertTrue("paletteTitleHeight != 0", pane.paletteTitleHeight != 0);
- assertTrue("didn't uninstall paletteCloseIcon",
- pane.paletteCloseIcon != null);
+ assertTrue("didn't uninstall paletteCloseIcon", pane.paletteCloseIcon != null);
}
/*
@@ -148,24 +143,23 @@
*/
public void testCreateButtons() {
TestMetalInternalFrameTitlePane pane = new TestMetalInternalFrameTitlePane(frame);
-
- assertEquals("maxButton accessible name", "Maximize",
- pane.getMaxButton().getAccessibleContext().getAccessibleName());
+ assertEquals("maxButton accessible name", "Maximize", pane.getMaxButton()
+ .getAccessibleContext().getAccessibleName());
if (isHarmony()) {
- assertFalse("maxButton's border is not painted",
- pane.getMaxButton().isBorderPainted());
+ assertFalse("maxButton's border is not painted", pane.getMaxButton()
+ .isBorderPainted());
}
- assertEquals("iconButton accessible name", "Iconify",
- pane.getIconButton().getAccessibleContext().getAccessibleName());
+ assertEquals("iconButton accessible name", "Iconify", pane.getIconButton()
+ .getAccessibleContext().getAccessibleName());
if (isHarmony()) {
- assertFalse("iconButton's border is not painted",
- pane.getIconButton().isBorderPainted());
+ assertFalse("iconButton's border is not painted", pane.getIconButton()
+ .isBorderPainted());
}
- assertEquals("closeButton accessible name", "Close",
- pane.getCloseButton().getAccessibleContext().getAccessibleName());
+ assertEquals("closeButton accessible name", "Close", pane.getCloseButton()
+ .getAccessibleContext().getAccessibleName());
if (isHarmony()) {
- assertFalse("closeButton's border is not painted",
- pane.getCloseButton().isBorderPainted());
+ assertFalse("closeButton's border is not painted", pane.getCloseButton()
+ .isBorderPainted());
}
}
@@ -175,7 +169,6 @@
public void testAssembleSystemMenu() {
TestMetalInternalFrameTitlePane pane = new TestMetalInternalFrameTitlePane(frame);
pane.assembleSystemMenu();
-
assertNull("windowMenu == null", pane.getWindowMenu());
assertNull("menuBar == null", pane.getMenuBar());
}
@@ -192,7 +185,6 @@
*/
public void testMetalInternalFrameTitlePane() {
pane = new MetalInternalFrameTitlePane(frame);
-
assertFalse("isPalette == false", pane.isPalette);
}
@@ -202,7 +194,6 @@
public void testAddSystemMenuItems() {
// the tested function does nothing
JMenu menu = new JMenu();
-
pane.addSystemMenuItems(menu);
assertEquals(0, menu.getItemCount());
}
@@ -214,7 +205,7 @@
PropertyChangeListener listener = pane.createPropertyChangeListener();
assertTrue("!= null", listener != null);
assertTrue("instanceof TitlePaneLayout",
- listener instanceof BasicInternalFrameTitlePane.PropertyChangeHandler);
+ listener instanceof BasicInternalFrameTitlePane.PropertyChangeHandler);
}
/*
@@ -224,7 +215,7 @@
LayoutManager layout = pane.createLayout();
assertTrue("!= null", layout != null);
assertTrue("instanceof TitlePaneLayout",
- layout instanceof BasicInternalFrameTitlePane.TitlePaneLayout);
+ layout instanceof BasicInternalFrameTitlePane.TitlePaneLayout);
}
/*
@@ -235,20 +226,17 @@
frame.setClosable(true);
frame.setIconifiable(true);
frame.setMaximizable(true);
-
// test set to true
pane.setPalette(true);
assertTrue("isPalette is true", pane.isPalette);
assertTrue("changed close icon",
- pane.getCloseButton().getIcon() == pane.paletteCloseIcon);
+ pane.getCloseButton().getIcon() == pane.paletteCloseIcon);
assertTrue("1 child", pane.getComponentCount() == 1);
// is layoutContainer called?
-
// test set to false
pane.setPalette(false);
assertFalse("isPalette is false", pane.isPalette);
- assertTrue("changed close icon",
- pane.getCloseButton().getIcon() == pane.getCloseIcon());
+ assertTrue("changed close icon", pane.getCloseButton().getIcon() == pane.getCloseIcon());
assertTrue("3 children", pane.getComponentCount() == 3);
}
@@ -270,44 +258,36 @@
TestMetalInternalFrameTitlePane pane = new TestMetalInternalFrameTitlePane(frame);
pane.setSize(200, 31);
LayoutManager layout = pane.getLayout();
- final Rectangle zeroBounds = new Rectangle(0, 0, 0, 0);
final Rectangle iconButtonBounds = new Rectangle(134, 7, 16, 16);
final Rectangle maximizeButtonBounds = new Rectangle(156, 7, 16, 16);
final Rectangle closeButtonBounds = new Rectangle(178, 7, 16, 16);
-
// test layoutContainer(): non-iconifiable, non-maximizable, non-closable
layout.layoutContainer(null);
-// assertEquals("iconButton", zeroBounds,
-// pane.getComponent(0).getBounds());
-// assertTrue("maximizeButton", pane.getComponent(1).getBounds().
-// equals(zeroBounds));
-// assertTrue("closeButton", pane.getComponent(2).getBounds().
-// equals(zeroBounds));
-
+ // assertEquals("iconButton", zeroBounds,
+ // pane.getComponent(0).getBounds());
+ // assertTrue("maximizeButton", pane.getComponent(1).getBounds().
+ // equals(zeroBounds));
+ // assertTrue("closeButton", pane.getComponent(2).getBounds().
+ // equals(zeroBounds));
// test layoutContainer(): iconifiable, maximizable, closable
frame.setIconifiable(true);
frame.setMaximizable(true);
frame.setClosable(true);
-
layout.layoutContainer(pane);
if (isHarmony()) {
- assertEquals("iconButton", iconButtonBounds,
- pane.getComponent(0).getBounds());
- assertEquals("maximizeButton", maximizeButtonBounds,
- pane.getComponent(1).getBounds());
- assertEquals("closeButton", closeButtonBounds,
- pane.getComponent(2).getBounds());
+ assertEquals("iconButton", iconButtonBounds, pane.getComponent(0).getBounds());
+ assertEquals("maximizeButton", maximizeButtonBounds, pane.getComponent(1)
+ .getBounds());
+ assertEquals("closeButton", closeButtonBounds, pane.getComponent(2).getBounds());
}
-
// test layoutContainer(): isPalette == true
pane.setPalette(true);
layout.layoutContainer(null);
// these bounds can be changed in the future
if (isHarmony()) {
- assertEquals("palette: closeButton", new Rectangle(189, 11, 8, 8),
- pane.getComponent(0).getBounds());
+ assertEquals("palette: closeButton", new Rectangle(189, 11, 8, 8), pane
+ .getComponent(0).getBounds());
}
-
// minimumLayoutSize(), preferredLayoutSize() implementations
assertTrue("", layout.minimumLayoutSize(pane) != null);
assertTrue("", layout.preferredLayoutSize(pane) != null);
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalInternalFrameUITest.java Sun Nov 26 12:15:43 2006
@@ -18,18 +18,15 @@
* @author Vadim L. Bogdanov
* @version $Revision$
*/
-
package javax.swing.plaf.metal;
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import javax.swing.UIManager;
-
import javax.swing.SwingTestCase;
import javax.swing.plaf.ComponentUI;
public class MetalInternalFrameUITest extends SwingTestCase {
-
private JInternalFrame frame;
private MetalInternalFrameUI ui;
@@ -37,9 +34,9 @@
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
frame = new JInternalFrame();
ui = new MetalInternalFrameUI(frame);
}
@@ -47,15 +44,17 @@
/*
* @see TestCase#tearDown()
*/
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
-
private boolean belongs(final Object o, final Object[] array) {
- for (int i = 0; i < array.length; i++)
- if (array[i] == o)
+ for (int i = 0; i < array.length; i++) {
+ if (array[i] == o) {
return true;
+ }
+ }
return false;
}
@@ -74,8 +73,7 @@
JComponent comp = ui.createNorthPane(frame);
assertTrue("not null", comp != null);
assertTrue("instanceof MetalInternalFrameTitlePane",
- comp instanceof MetalInternalFrameTitlePane);
-
+ comp instanceof MetalInternalFrameTitlePane);
JComponent comp2 = ui.createNorthPane(frame);
assertTrue("new object", comp != comp2);
}
@@ -86,9 +84,7 @@
public void testCreateUI() {
ComponentUI ui = MetalInternalFrameUI.createUI(frame);
assertTrue("not null", ui != null);
- assertTrue("instanceof MetalInternalFrameUI",
- ui instanceof MetalInternalFrameUI);
-
+ assertTrue("instanceof MetalInternalFrameUI", ui instanceof MetalInternalFrameUI);
ComponentUI ui2 = MetalInternalFrameUI.createUI(frame);
assertTrue("stateful", ui != ui2);
}
@@ -99,20 +95,15 @@
public void testInstallUI() {
ui.installUI(frame);
assertFalse("false by default",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
-
+ ((MetalInternalFrameTitlePane) ui.getNorthPane()).isPalette);
frame.putClientProperty(MetalInternalFrameUI.IS_PALETTE, Boolean.TRUE);
ui = new MetalInternalFrameUI(frame);
ui.installUI(frame);
- assertTrue("true",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
-
-
+ assertTrue("true", ((MetalInternalFrameTitlePane) ui.getNorthPane()).isPalette);
frame.putClientProperty(MetalInternalFrameUI.IS_PALETTE, Boolean.FALSE);
ui = new MetalInternalFrameUI(frame);
ui.installUI(frame);
- assertFalse("false again",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
+ assertFalse("false again", ((MetalInternalFrameTitlePane) ui.getNorthPane()).isPalette);
}
/*
@@ -129,14 +120,12 @@
frame.setUI(ui);
ui.uninstallListeners();
ui.installListeners();
-
frame.putClientProperty(MetalInternalFrameUI.IS_PALETTE, Boolean.TRUE);
- assertTrue("isPalette of titlePane is true",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
-
+ assertTrue("isPalette of titlePane is true", ((MetalInternalFrameTitlePane) ui
+ .getNorthPane()).isPalette);
frame.putClientProperty(MetalInternalFrameUI.IS_PALETTE, Boolean.FALSE);
- assertFalse("isPalette of titlePane is false",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
+ assertFalse("isPalette of titlePane is false", ((MetalInternalFrameTitlePane) ui
+ .getNorthPane()).isPalette);
}
/*
@@ -145,10 +134,9 @@
public void testUninstallListeners() {
frame.setUI(ui);
ui.uninstallListeners();
-
frame.putClientProperty(MetalInternalFrameUI.IS_PALETTE, Boolean.TRUE);
- assertFalse("isPalette of titlePane is false",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
+ assertFalse("isPalette of titlePane is false", ((MetalInternalFrameTitlePane) ui
+ .getNorthPane()).isPalette);
}
/*
@@ -170,10 +158,8 @@
*/
public void testUninstallComponents() {
frame.setUI(ui);
-
ui.uninstallComponents();
- assertFalse("titlePane uninstalled",
- belongs(ui.getNorthPane(), frame.getComponents()));
+ assertFalse("titlePane uninstalled", belongs(ui.getNorthPane(), frame.getComponents()));
assertNull("northPane == null", ui.getNorthPane());
}
@@ -189,21 +175,17 @@
*/
public void testSetPalette() {
frame.setUI(ui);
-
ui.setPalette(true);
- assertTrue("isPalette of titlePane is true",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
- assertTrue("changed frame border",
- UIManager.getDefaults().getBorder("InternalFrame.paletteBorder") ==
- frame.getBorder());
-
+ assertTrue("isPalette of titlePane is true", ((MetalInternalFrameTitlePane) ui
+ .getNorthPane()).isPalette);
+ assertTrue("changed frame border", UIManager.getDefaults().getBorder(
+ "InternalFrame.paletteBorder") == frame.getBorder());
// test propertyChangeListener;
// ui.setPalette(false) has to be called by the listener
frame.putClientProperty(MetalInternalFrameUI.IS_PALETTE, Boolean.FALSE);
- assertFalse("isPalette of titlePane is false",
- ((MetalInternalFrameTitlePane)ui.getNorthPane()).isPalette);
- assertTrue("changed frame border",
- UIManager.getDefaults().getBorder("InternalFrame.border") ==
- frame.getBorder());
+ assertFalse("isPalette of titlePane is false", ((MetalInternalFrameTitlePane) ui
+ .getNorthPane()).isPalette);
+ assertTrue("changed frame border", UIManager.getDefaults().getBorder(
+ "InternalFrame.border") == frame.getBorder());
}
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalLookAndFeelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalLookAndFeelTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalLookAndFeelTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalLookAndFeelTest.java Sun Nov 26 12:15:43 2006
@@ -14,12 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/**
* @author Sergey Burlak
* @version $Revision$
*/
-
package javax.swing.plaf.metal;
import javax.swing.SwingTestCase;
@@ -29,10 +27,12 @@
public class MetalLookAndFeelTest extends SwingTestCase {
private DefaultMetalTheme defaultMetalTheme;
+ @Override
public void setUp() {
defaultMetalTheme = new DefaultMetalTheme();
}
+ @Override
public void tearDown() {
defaultMetalTheme = null;
}
@@ -44,11 +44,13 @@
}
public void testGetAcceleratorForeground() {
- checkColor(MetalLookAndFeel.getAcceleratorForeground(), defaultMetalTheme.getAcceleratorForeground());
+ checkColor(MetalLookAndFeel.getAcceleratorForeground(), defaultMetalTheme
+ .getAcceleratorForeground());
}
public void testGetAcceleratorSelectedForeground() {
- checkColor(MetalLookAndFeel.getAcceleratorSelectedForeground(), defaultMetalTheme.getAcceleratorSelectedForeground());
+ checkColor(MetalLookAndFeel.getAcceleratorSelectedForeground(), defaultMetalTheme
+ .getAcceleratorSelectedForeground());
}
public void testGetBlack() {
@@ -60,15 +62,18 @@
}
public void testGetControlDarkShadow() {
- checkColor(MetalLookAndFeel.getControlDarkShadow(), defaultMetalTheme.getControlDarkShadow());
+ checkColor(MetalLookAndFeel.getControlDarkShadow(), defaultMetalTheme
+ .getControlDarkShadow());
}
public void testGetControlDisabled() {
- checkColor(MetalLookAndFeel.getControlDisabled(), defaultMetalTheme.getControlDisabled());
+ checkColor(MetalLookAndFeel.getControlDisabled(), defaultMetalTheme
+ .getControlDisabled());
}
public void testGetControlHighlight() {
- checkColor(MetalLookAndFeel.getControlHighlight(), defaultMetalTheme.getControlHighlight());
+ checkColor(MetalLookAndFeel.getControlHighlight(), defaultMetalTheme
+ .getControlHighlight());
}
public void testGetControlInfo() {
@@ -80,7 +85,8 @@
}
public void testGetControlTextColor() {
- checkColor(MetalLookAndFeel.getControlTextColor(), defaultMetalTheme.getControlTextColor());
+ checkColor(MetalLookAndFeel.getControlTextColor(), defaultMetalTheme
+ .getControlTextColor());
}
public void testGetControlTextFont() {
@@ -98,15 +104,18 @@
}
public void testGetHighlightedTextColor() {
- checkColor(MetalLookAndFeel.getHighlightedTextColor(), defaultMetalTheme.getHighlightedTextColor());
+ checkColor(MetalLookAndFeel.getHighlightedTextColor(), defaultMetalTheme
+ .getHighlightedTextColor());
}
public void testGetInactiveControlTextColor() {
- checkColor(MetalLookAndFeel.getInactiveControlTextColor(), defaultMetalTheme.getInactiveControlTextColor());
+ checkColor(MetalLookAndFeel.getInactiveControlTextColor(), defaultMetalTheme
+ .getInactiveControlTextColor());
}
public void testGetInactiveSystemTextColor() {
- checkColor(MetalLookAndFeel.getInactiveSystemTextColor(), defaultMetalTheme.getInactiveSystemTextColor());
+ checkColor(MetalLookAndFeel.getInactiveSystemTextColor(), defaultMetalTheme
+ .getInactiveSystemTextColor());
}
public void testGetMenuBackground() {
@@ -114,7 +123,8 @@
}
public void testGetMenuDisabledBackground() {
- checkColor(MetalLookAndFeel.getMenuDisabledForeground(), defaultMetalTheme.getMenuDisabledForeground());
+ checkColor(MetalLookAndFeel.getMenuDisabledForeground(), defaultMetalTheme
+ .getMenuDisabledForeground());
}
public void testGetMenuForeground() {
@@ -122,11 +132,13 @@
}
public void testGetMenuSelectedBackground() {
- checkColor(MetalLookAndFeel.getMenuSelectedBackground(), defaultMetalTheme.getMenuSelectedBackground());
+ checkColor(MetalLookAndFeel.getMenuSelectedBackground(), defaultMetalTheme
+ .getMenuSelectedBackground());
}
public void testGetMenuSelectedForeground() {
- checkColor(MetalLookAndFeel.getMenuSelectedForeground(), defaultMetalTheme.getMenuSelectedForeground());
+ checkColor(MetalLookAndFeel.getMenuSelectedForeground(), defaultMetalTheme
+ .getMenuSelectedForeground());
}
public void testGetMenuTextFont() {
@@ -148,27 +160,33 @@
}
public void testGetPrimaryControlDarkShadow() {
- checkColor(MetalLookAndFeel.getPrimaryControlDarkShadow(), defaultMetalTheme.getPrimaryControlDarkShadow());
+ checkColor(MetalLookAndFeel.getPrimaryControlDarkShadow(), defaultMetalTheme
+ .getPrimaryControlDarkShadow());
}
public void testGetPrimaryControlHighlight() {
- checkColor(MetalLookAndFeel.getPrimaryControlHighlight(), defaultMetalTheme.getPrimaryControlHighlight());
+ checkColor(MetalLookAndFeel.getPrimaryControlHighlight(), defaultMetalTheme
+ .getPrimaryControlHighlight());
}
public void testGetPrimaryControlInfo() {
- checkColor(MetalLookAndFeel.getPrimaryControlInfo(), defaultMetalTheme.getPrimaryControlInfo());
+ checkColor(MetalLookAndFeel.getPrimaryControlInfo(), defaultMetalTheme
+ .getPrimaryControlInfo());
}
public void testGetPrimaryControlShadow() {
- checkColor(MetalLookAndFeel.getPrimaryControlShadow(), defaultMetalTheme.getPrimaryControlShadow());
+ checkColor(MetalLookAndFeel.getPrimaryControlShadow(), defaultMetalTheme
+ .getPrimaryControlShadow());
}
public void testGetSeparatorBackground() {
- checkColor(MetalLookAndFeel.getSeparatorBackground(), defaultMetalTheme.getSeparatorBackground());
+ checkColor(MetalLookAndFeel.getSeparatorBackground(), defaultMetalTheme
+ .getSeparatorBackground());
}
public void testGetSeparatorForeground() {
- checkColor(MetalLookAndFeel.getSeparatorForeground(), defaultMetalTheme.getSeparatorForeground());
+ checkColor(MetalLookAndFeel.getSeparatorForeground(), defaultMetalTheme
+ .getSeparatorForeground());
}
public void testSubTextFont() {
@@ -182,7 +200,8 @@
}
public void testGetSystemTestColor() {
- checkColor(MetalLookAndFeel.getSystemTextColor(), defaultMetalTheme.getSystemTextColor());
+ checkColor(MetalLookAndFeel.getSystemTextColor(), defaultMetalTheme
+ .getSystemTextColor());
}
public void testSystemTextFont() {
@@ -192,7 +211,8 @@
}
public void testGetTextHighlightColor() {
- checkColor(MetalLookAndFeel.getTextHighlightColor(), defaultMetalTheme.getTextHighlightColor());
+ checkColor(MetalLookAndFeel.getTextHighlightColor(), defaultMetalTheme
+ .getTextHighlightColor());
}
public void testUserTextFont() {
@@ -210,11 +230,13 @@
}
public void testGetWindowBackground() {
- checkColor(MetalLookAndFeel.getWindowBackground(), defaultMetalTheme.getWindowBackground());
+ checkColor(MetalLookAndFeel.getWindowBackground(), defaultMetalTheme
+ .getWindowBackground());
}
public void testGetWindowTitleBackground() {
- checkColor(MetalLookAndFeel.getWindowTitleBackground(), defaultMetalTheme.getWindowTitleBackground());
+ checkColor(MetalLookAndFeel.getWindowTitleBackground(), defaultMetalTheme
+ .getWindowTitleBackground());
}
public void testGetWindowTitleFont() {
@@ -224,15 +246,18 @@
}
public void testGetWindowTitleForeground() {
- checkColor(MetalLookAndFeel.getWindowTitleForeground(), defaultMetalTheme.getWindowTitleForeground());
+ checkColor(MetalLookAndFeel.getWindowTitleForeground(), defaultMetalTheme
+ .getWindowTitleForeground());
}
public void testGetWindowTitleInactiveBackground() {
- checkColor(MetalLookAndFeel.getWindowTitleInactiveBackground(), defaultMetalTheme.getWindowTitleInactiveBackground());
+ checkColor(MetalLookAndFeel.getWindowTitleInactiveBackground(), defaultMetalTheme
+ .getWindowTitleInactiveBackground());
}
public void testGetWindowTitleInactiveForeground() {
- checkColor(MetalLookAndFeel.getWindowTitleInactiveForeground(), defaultMetalTheme.getWindowTitleInactiveForeground());
+ checkColor(MetalLookAndFeel.getWindowTitleInactiveForeground(), defaultMetalTheme
+ .getWindowTitleInactiveForeground());
}
public void testIsNativeLookAndFeel() {
@@ -247,5 +272,4 @@
assertNotNull(color);
assertSame(color, themeColor);
}
-
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalMenuBarUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalMenuBarUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalMenuBarUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalMenuBarUITest.java Sun Nov 26 12:15:43 2006
@@ -15,9 +15,9 @@
* limitations under the License.
*/
/**
-* @author Alexander T. Simbirtsev
-* @version $Revision$
-*/
+ * @author Alexander T. Simbirtsev
+ * @version $Revision$
+ */
package javax.swing.plaf.metal;
import javax.swing.JMenuBar;
@@ -25,7 +25,7 @@
import javax.swing.plaf.basic.BasicMenuBarUITest;
public class MetalMenuBarUITest extends BasicMenuBarUITest {
-
+ @Override
protected void setUp() throws Exception {
super.setUp();
menuBarUI = new MetalMenuBarUI();
@@ -34,6 +34,7 @@
/*
* Test method for 'javax.swing.plaf.metal.MetalMenuBarUI.createUI(JComponent)'
*/
+ @Override
public void testCreateUI() {
JMenuBar bar = new JMenuBar();
ComponentUI ui1 = MetalMenuBarUI.createUI(bar);
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalPopupMenuSeparatorUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalPopupMenuSeparatorUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalPopupMenuSeparatorUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalPopupMenuSeparatorUITest.java Sun Nov 26 12:15:43 2006
@@ -15,19 +15,18 @@
* limitations under the License.
*/
/**
-* @author Alexander T. Simbirtsev
-* @version $Revision$
-*/
+ * @author Alexander T. Simbirtsev
+ * @version $Revision$
+ */
package javax.swing.plaf.metal;
import java.awt.Dimension;
-
import javax.swing.JButton;
import javax.swing.JSeparator;
import javax.swing.SwingConstants;
public class MetalPopupMenuSeparatorUITest extends MetalSeparatorUITest {
-
+ @Override
protected void setUp() throws Exception {
super.setUp();
ui = new MetalPopupMenuSeparatorUI();
@@ -36,6 +35,7 @@
/*
* Test method for 'javax.swing.plaf.basic.BasicSeparatorUI.getPreferredSize(JComponent)'
*/
+ @Override
public void testGetSizes() {
JSeparator separator1 = new JSeparator(SwingConstants.HORIZONTAL);
JSeparator separator2 = new JSeparator(SwingConstants.VERTICAL);
@@ -50,10 +50,13 @@
/*
* Test method for 'javax.swing.plaf.metal.MetalPopupMenuSeparatorUI.createUI(JComponent)'
*/
+ @Override
public void testCreateUI() {
- assertNotNull("created UI is not null", MetalPopupMenuSeparatorUI.createUI(new JButton()));
- assertTrue("created UI is of the proper class", MetalPopupMenuSeparatorUI.createUI(null) instanceof MetalPopupMenuSeparatorUI);
- assertNotSame("created UI is of unique", MetalPopupMenuSeparatorUI.createUI(null), MetalPopupMenuSeparatorUI.createUI(null));
+ assertNotNull("created UI is not null", MetalPopupMenuSeparatorUI
+ .createUI(new JButton()));
+ assertTrue("created UI is of the proper class", MetalPopupMenuSeparatorUI
+ .createUI(null) instanceof MetalPopupMenuSeparatorUI);
+ assertNotSame("created UI is of unique", MetalPopupMenuSeparatorUI.createUI(null),
+ MetalPopupMenuSeparatorUI.createUI(null));
}
-
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalProgressBarUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalProgressBarUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalProgressBarUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalProgressBarUITest.java Sun Nov 26 12:15:43 2006
@@ -18,7 +18,6 @@
* @author Dennis Ushakov
* @version $Revision$
*/
-
package javax.swing.plaf.metal;
import javax.swing.BasicSwingTestCase;
@@ -27,10 +26,12 @@
public class MetalProgressBarUITest extends BasicSwingTestCase {
private JProgressBar progressBar;
+ @Override
protected void setUp() throws Exception {
progressBar = new JProgressBar();
}
+ @Override
protected void tearDown() throws Exception {
progressBar = null;
}
@@ -39,6 +40,4 @@
assertNotNull(MetalSliderUI.createUI(progressBar));
assertFalse(MetalSliderUI.createUI(progressBar) == MetalSliderUI.createUI(progressBar));
}
-
}
-
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRadioButtonUITest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRadioButtonUITest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRadioButtonUITest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRadioButtonUITest.java Sun Nov 26 12:15:43 2006
@@ -25,7 +25,6 @@
import java.awt.Color;
import java.awt.Font;
import java.awt.image.BufferedImage;
-
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@@ -38,11 +37,9 @@
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.IconUIResource;
-
import junit.framework.TestCase;
public class MetalRadioButtonUITest extends TestCase {
-
PublicMetalRadioButtonUI publicUI;
public static void main(final String[] args) {
@@ -52,24 +49,26 @@
/*
* @see TestCase#setUp()
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
publicUI = new PublicMetalRadioButtonUI();
}
public void testCreateUI() {
assertTrue("created UI is not null", null != MetalRadioButtonUI.createUI(new JButton()));
- assertTrue("created UI is of the proper class", MetalRadioButtonUI.createUI(null) instanceof MetalRadioButtonUI);
- assertTrue("created UI is not shared", MetalRadioButtonUI.createUI(null) == MetalRadioButtonUI.createUI(null));
+ assertTrue("created UI is of the proper class",
+ MetalRadioButtonUI.createUI(null) instanceof MetalRadioButtonUI);
+ assertTrue("created UI is not shared",
+ MetalRadioButtonUI.createUI(null) == MetalRadioButtonUI.createUI(null));
}
class PublicMetalRadioButtonUI extends MetalRadioButtonUI {
-
public void setDisabledTextColor(final Color color) {
disabledTextColor = color;
}
+ @Override
public Color getDisabledTextColor() {
return super.getDisabledTextColor();
}
@@ -78,6 +77,7 @@
focusColor = color;
}
+ @Override
public Color getFocusColor() {
return super.getFocusColor();
}
@@ -86,10 +86,12 @@
selectColor = color;
}
+ @Override
public Color getSelectColor() {
return super.getSelectColor();
}
+ @Override
public void uninstallDefaults(final AbstractButton b) {
super.uninstallDefaults(b);
}
@@ -106,10 +108,9 @@
UIManager.put("RadioButton.font", font);
Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UIManager.put("RadioButton.border", border);
- Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB)));
+ Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
+ BufferedImage.TYPE_INT_RGB)));
UIManager.put("RadioButton.icon", icon);
-
-
button.setUI(publicUI);
publicUI.installDefaults(button);
publicUI.uninstallDefaults(button);
@@ -134,10 +135,9 @@
UIManager.put("RadioButton.font", font);
Border border = new BorderUIResource(BorderFactory.createEmptyBorder(0, 0, 0, 0));
UIManager.put("RadioButton.border", border);
- Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB)));
+ Icon icon = new IconUIResource(new ImageIcon(new BufferedImage(10, 10,
+ BufferedImage.TYPE_INT_RGB)));
UIManager.put("RadioButton.icon", icon);
-
-
button.setUI(publicUI);
publicUI.installDefaults(button);
assertEquals(Color.blue, button.getBackground());
@@ -167,5 +167,4 @@
publicUI.setFocusColor(Color.WHITE);
assertEquals("FocusColor ", Color.WHITE, publicUI.getFocusColor());
}
-
}
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUI$MetalRootLayoutTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUI%24MetalRootLayoutTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUI$MetalRootLayoutTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUI$MetalRootLayoutTest.java Sun Nov 26 12:15:43 2006
@@ -18,13 +18,11 @@
* @author Vadim L. Bogdanov
* @version $Revision$
*/
-
package javax.swing.plaf.metal;
import java.awt.Dimension;
import java.awt.LayoutManager2;
import java.awt.Rectangle;
-
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
@@ -34,26 +32,28 @@
import javax.swing.SwingTestCase;
public class MetalRootPaneUI$MetalRootLayoutTest extends SwingTestCase {
-
private JRootPane rootPane;
+
private MetalRootPaneUI ui;
+
private JFrame frame;
+
private LayoutManager2 layout;
+
private JComponent titlePane;
+ @Override
protected void setUp() throws Exception {
super.setUp();
-
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
-
JFrame.setDefaultLookAndFeelDecorated(true);
frame = new JFrame();
rootPane = frame.getRootPane();
- ((JComponent)rootPane).setBorder(BorderFactory.createEmptyBorder(5, 10, 15, 20));
+ ((JComponent) rootPane).setBorder(BorderFactory.createEmptyBorder(5, 10, 15, 20));
ui = new MetalRootPaneUI();
rootPane.setUI(ui);
- layout = (LayoutManager2)rootPane.getLayout();
- titlePane = (JComponent)rootPane.getLayeredPane().getComponent(1);
+ layout = (LayoutManager2) rootPane.getLayout();
+ titlePane = (JComponent) rootPane.getLayeredPane().getComponent(1);
}
public MetalRootPaneUI$MetalRootLayoutTest(final String name) {
@@ -61,27 +61,25 @@
}
public void testPreferredLayoutSize() {
- ((JComponent)frame.getContentPane()).setPreferredSize(new Dimension(200, 300));
+ ((JComponent) frame.getContentPane()).setPreferredSize(new Dimension(200, 300));
titlePane.setPreferredSize(new Dimension(20, 20));
-
assertEquals(new Dimension(230, 340), layout.preferredLayoutSize(rootPane));
}
public void testMinimumLayoutSize() {
- ((JComponent)frame.getContentPane()).setMinimumSize(new Dimension(200, 300));
+ ((JComponent) frame.getContentPane()).setMinimumSize(new Dimension(200, 300));
titlePane.setMinimumSize(new Dimension(20, 20));
-
assertEquals(new Dimension(230, 340), layout.minimumLayoutSize(rootPane));
}
public void testMaximumLayoutSize() {
- ((JComponent)frame.getContentPane()).setMaximumSize(new Dimension(200, 300));
+ ((JComponent) frame.getContentPane()).setMaximumSize(new Dimension(200, 300));
titlePane.setMaximumSize(new Dimension(30, 400));
-
if (isHarmony()) {
assertEquals(new Dimension(230, 720), layout.maximumLayoutSize(rootPane));
} else {
- assertEquals(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE), layout.maximumLayoutSize(rootPane));
+ assertEquals(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE), layout
+ .maximumLayoutSize(rootPane));
}
}
@@ -89,25 +87,21 @@
final Dimension rootPaneDimension = new Dimension(640, 480);
final Rectangle glassPaneBounds = new Rectangle(10, 5, 610, 460);
final Rectangle titlePaneBounds = new Rectangle(0, 0, 610, 20);
-
frame.setSize(rootPaneDimension);
rootPane.setSize(rootPaneDimension);
titlePane.setPreferredSize(new Dimension(100, 20));
layout.layoutContainer(rootPane);
-
// test without menu
assertEquals(glassPaneBounds, rootPane.getGlassPane().getBounds());
assertEquals(glassPaneBounds, rootPane.getLayeredPane().getBounds());
assertEquals(titlePaneBounds, titlePane.getBounds());
assertEquals(new Rectangle(0, 20, 610, 440), rootPane.getContentPane().getBounds());
-
// test with menu
JMenuBar menuBar = new JMenuBar();
menuBar.setPreferredSize(new Dimension(150, 30));
menuBar.add(new JMenu("Menu"));
rootPane.setJMenuBar(menuBar);
layout.layoutContainer(rootPane);
-
assertEquals(glassPaneBounds, rootPane.getGlassPane().getBounds());
assertEquals(glassPaneBounds, rootPane.getLayeredPane().getBounds());
assertEquals(titlePaneBounds, titlePane.getBounds());
Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUIRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUIRTest.java?view=diff&rev=479418&r1=479417&r2=479418
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUIRTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/plaf/metal/MetalRootPaneUIRTest.java Sun Nov 26 12:15:43 2006
@@ -21,7 +21,6 @@
package javax.swing.plaf.metal;
import java.awt.Component;
-
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.SwingTestCase;
@@ -31,10 +30,12 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
@@ -44,7 +45,6 @@
JDialog d = new JDialog();
Component[] comps = d.getLayeredPane().getComponents();
assertEquals(2, comps.length);
-
Component titlePane = null;
for (int i = 0; i < comps.length; i++) {
if (comps[i] != d.getContentPane()) {
@@ -52,6 +52,6 @@
}
}
assertTrue(titlePane instanceof JComponent);
- assertEquals(1, ((JComponent)titlePane).getComponentCount());
+ assertEquals(1, ((JComponent) titlePane).getComponentCount());
}
}