001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package javax.swing.plaf.synth;
019:
020: import javax.swing.JComponent;
021: import javax.swing.JLabel;
022: import javax.swing.plaf.ComponentUI;
023:
024: import junit.framework.TestCase;
025:
026: public class SynthLookAndFeelTest extends TestCase {
027:
028: SynthLookAndFeel laf = new SynthLookAndFeel();
029:
030: JLabel l = new JLabel();
031:
032: /*
033: * Test method for
034: * 'javax.swing.plaf.synth.SynthLookAndFeel.isNativeLookAndFeel()'
035: */
036: public void testIsNativeLookAndFeel() {
037: assertFalse(laf.isNativeLookAndFeel());
038: }
039:
040: /*
041: * Test method for
042: * 'javax.swing.plaf.synth.SynthLookAndFeel.isSupportedLookAndFeel()'
043: */
044: public void testIsSupportedLookAndFeel() {
045: assertTrue(laf.isSupportedLookAndFeel());
046: }
047:
048: /*
049: * Test method for
050: * 'javax.swing.plaf.synth.SynthLookAndFeel.getStyleFactory()'
051: */
052: public void testGetStyleFactory() {
053: SynthStyleFactory sf = new SynthStyleFactory() {
054: @Override
055: @SuppressWarnings("unused")
056: public SynthStyle getStyle(JComponent c, Region id) {
057: return null;
058: }
059: };
060: SynthLookAndFeel.setStyleFactory(sf);
061: assertSame(sf, SynthLookAndFeel.getStyleFactory());
062: }
063:
064: // /*
065: // * Test method for
066: // * 'javax.swing.plaf.synth.SynthLookAndFeel.createUI(JComponent)'
067: // */
068: // public void testCreateUI() {
069: // l.setEnabled(false);
070: // ComponentUI labelUI = SynthLookAndFeel.createUI(l);
071: // assertTrue(labelUI instanceof SynthUI);
072: // assertTrue(labelUI instanceof SynthLabelUI);
073: // assertTrue(((SynthLabelUI) labelUI).getLabelState(l) == SynthConstants.DISABLED);
074: // }
075:
076: /*
077: * Test method for
078: * 'javax.swing.plaf.synth.SynthLookAndFeel.updateStyles(Component)'
079: */
080: public void testUpdateStyles() {
081: // TODO:
082: }
083:
084: /*
085: * Test method for
086: * 'javax.swing.plaf.synth.SynthLookAndFeel.getRegion(JComponent)'
087: */
088: public void testGetRegion() {
089: assertSame(Region.LABEL, SynthLookAndFeel.getRegion(l));
090: }
091:
092: /*
093: * Test method for 'javax.swing.plaf.synth.SynthLookAndFeel.getName()'
094: */
095: public void testGetName() {
096: assertEquals("Synth Look and Feel", laf.getName()); //$NON-NLS-1$
097: }
098:
099: /*
100: * Test method for 'javax.swing.plaf.synth.SynthLookAndFeel.getID()'
101: */
102: public void testGetID() {
103: assertEquals("Synth", laf.getID()); //$NON-NLS-1$
104: }
105:
106: /*
107: * Test method for
108: * 'javax.swing.plaf.synth.SynthLookAndFeel.shouldUpdateStyleOnAncestorChanged()'
109: */
110: public void testShouldUpdateStyleOnAncestorChanged() {
111: assertFalse(laf.shouldUpdateStyleOnAncestorChanged());
112: }
113:
114: }
|