01: /*
02: * LnFManagerTest.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.lnf;
13:
14: import java.util.List;
15: import junit.framework.TestCase;
16: import workbench.TestUtil;
17: import workbench.resource.Settings;
18: import workbench.util.StringUtil;
19:
20: /**
21: *
22: * @author support@sql-workbench.net
23: */
24: public class LnFManagerTest extends TestCase {
25: public LnFManagerTest(String testName) {
26: super (testName);
27: }
28:
29: public void testSeparatorConvert() {
30: TestUtil util = new TestUtil("LnFTest");
31: LnFManager mgr = new LnFManager();
32: LnFDefinition lnf = new LnFDefinition("Test", "someclass",
33: "lib1.jar" + StringUtil.getPathSeparator() + "lib2.jar");
34: mgr.addDefinition(lnf);
35: mgr.saveLookAndFeelDefinitions();
36:
37: Settings set = Settings.getInstance();
38: int count = set.getIntProperty("workbench.lnf.count", -1);
39: assertEquals("Wrong count", 1, count);
40:
41: String libs = set
42: .getProperty("workbench.lnf.0.classpath", null);
43: assertNotNull(libs);
44: assertEquals("Wrong separator", true, libs
45: .indexOf(LnFDefinition.LNF_PATH_SEPARATOR) > -1);
46:
47: List<LnFDefinition> lnflist = mgr.getAvailableLookAndFeels();
48: LnFDefinition def = null;
49: int realCount = 0;
50: for (LnFDefinition l : lnflist) {
51: if (!l.isBuiltInLnF()) {
52: def = l;
53: realCount++;
54: }
55: }
56: assertEquals(1, realCount);
57:
58: String deflibs = def.getLibrary();
59: assertEquals("Wrong separator", true, deflibs
60: .indexOf(StringUtil.getPathSeparator()) > -1);
61: }
62:
63: }
|