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: * @author Sergey Burlak
019: * @version $Revision$
020: */package javax.swing.plaf.basic;
021:
022: import javax.swing.Action;
023: import javax.swing.LookAndFeel;
024: import javax.swing.SwingTestCase;
025: import javax.swing.UIDefaults;
026:
027: public class BasicLookAndFeelTest extends SwingTestCase {
028: private BasicLookAndFeel lf;
029:
030: @Override
031: public void setUp() {
032: lf = basicLookAndFeelInstance();
033: }
034:
035: @Override
036: public void tearDown() {
037: lf = null;
038: }
039:
040: public void testAudioActionMap() {
041: assertEquals(13, lf.getAudioActionMap().size());
042: }
043:
044: public void testDefaultsTable() {
045: UIDefaults defaults = lf.getDefaults();
046: if (isHarmony()) {
047: assertEquals(475, defaults.size());
048: }
049: assertNull(lookAndFeelInstance().getDefaults());
050: }
051:
052: public void testCreateAudioAction() {
053: Action createAudioAction = lf.createAudioAction("-");
054: assertTrue(createAudioAction instanceof BasicLookAndFeel.AudioAction);
055: assertTrue(lf
056: .createAudioAction("CheckBoxMenuItem.commandSound") instanceof BasicLookAndFeel.AudioAction);
057: }
058:
059: private LookAndFeel lookAndFeelInstance() {
060: return new LookAndFeel() {
061: @Override
062: public String getDescription() {
063: return null;
064: }
065:
066: @Override
067: public String getID() {
068: return null;
069: }
070:
071: @Override
072: public String getName() {
073: return null;
074: }
075:
076: @Override
077: public boolean isNativeLookAndFeel() {
078: return false;
079: }
080:
081: @Override
082: public boolean isSupportedLookAndFeel() {
083: return false;
084: }
085: };
086: }
087:
088: private BasicLookAndFeel basicLookAndFeelInstance() {
089: return new BasicLookAndFeel() {
090: private static final long serialVersionUID = 1L;
091:
092: @Override
093: public String getDescription() {
094: return "basic description";
095: }
096:
097: @Override
098: public String getID() {
099: return "basic id";
100: }
101:
102: @Override
103: public String getName() {
104: return "basic name";
105: }
106:
107: @Override
108: public boolean isNativeLookAndFeel() {
109: return false;
110: }
111:
112: @Override
113: public boolean isSupportedLookAndFeel() {
114: return false;
115: }
116: };
117: }
118: }
|