|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 package com.symbian.smt.gui.smtwidgets; |
|
17 |
|
18 import org.eclipse.swt.SWT; |
|
19 import org.eclipse.swt.widgets.Display; |
|
20 import org.eclipse.swt.widgets.Shell; |
|
21 import org.junit.After; |
|
22 import org.junit.Before; |
|
23 |
|
24 import com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget; |
|
25 |
|
26 |
|
27 public class ResourcesWidgetTest { |
|
28 |
|
29 Display display; |
|
30 Shell shell; |
|
31 ResourcesWidget resourcesWidget; |
|
32 |
|
33 /** |
|
34 * @throws java.lang.Exception |
|
35 */ |
|
36 @Before |
|
37 public void setUp() throws Exception { |
|
38 display = new Display(); |
|
39 shell = new Shell(display); |
|
40 resourcesWidget = new ResourcesWidget(shell, SWT.NONE); |
|
41 } |
|
42 |
|
43 |
|
44 /** |
|
45 * @throws java.lang.Exception |
|
46 */ |
|
47 @After |
|
48 public void tearDown() throws Exception { |
|
49 resourcesWidget = null; |
|
50 display.dispose(); |
|
51 } |
|
52 |
|
53 // /** |
|
54 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getShapesFile()}. |
|
55 // */ |
|
56 // @Test |
|
57 // public final void testGetShapesFile() { |
|
58 // resourcesWidget.setShapesFiles(instanceStore.getShapesFiles()); |
|
59 // String[] filenames = resourcesWidget.getShapesFiles(); |
|
60 // |
|
61 // assertTrue("Shapes filenames should not be null", filenames != null); |
|
62 // assertTrue("Expected 2 filenames, got " + filenames.length, filenames.length == 2); |
|
63 // |
|
64 // String expected_fn = "./../SystemModelGenerator/resources/auxiliary/Shapes.xml"; |
|
65 // String got_fn = filenames[0]; |
|
66 // |
|
67 // assertTrue("First expected filename: [" + expected_fn + "], got: [" + got_fn + "]", got_fn.equalsIgnoreCase(expected_fn)); |
|
68 // |
|
69 // expected_fn = "./../SystemModelGenerator/resources/auxiliary/Example-shapes.xml"; |
|
70 // got_fn = filenames[1]; |
|
71 // |
|
72 // assertTrue("First expected filename: [" + expected_fn + "], got: [" + got_fn + "]", got_fn.equalsIgnoreCase(expected_fn)); |
|
73 // } |
|
74 // |
|
75 // /** |
|
76 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getShapesFile()}. |
|
77 // */ |
|
78 // @Test |
|
79 // public final void testGetSelectedShapesFile() { |
|
80 // resourcesWidget.setSelectedShapesFiles(instanceStore.getSelectedShapesFiles()); |
|
81 // |
|
82 // if (resourcesWidget.getSelectedShapesFiles() != null) { |
|
83 // fail("Selected shapes files should be null by default"); |
|
84 // } |
|
85 // } |
|
86 // |
|
87 // /** |
|
88 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getLevelsFile()}. |
|
89 // */ |
|
90 // @Test |
|
91 // public final void testGetLevelsFile() { |
|
92 // if (!resourcesWidget.getSelectedLevelsFiles()[0].equalsIgnoreCase("Auto")) { |
|
93 // fail("Did not return default levels file"); |
|
94 // } |
|
95 // } |
|
96 // |
|
97 // /** |
|
98 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getLocalisationFile()}. |
|
99 // */ |
|
100 // @Test |
|
101 // public final void testGetLocalisationFile() { |
|
102 // if (!resourcesWidget.getSelectedLocalisationFiles()[0].equalsIgnoreCase("")) { |
|
103 // fail("Did not return default localisation file"); |
|
104 // } |
|
105 // } |
|
106 // |
|
107 // /** |
|
108 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getSystemInfoFile()}. |
|
109 // */ |
|
110 // @Test |
|
111 // public final void testGetSystemInfoFile() { |
|
112 // if (!resourcesWidget.getSelectedSystemInfoFiles()[0].equalsIgnoreCase("")) { |
|
113 // fail("Did not return default system info file"); |
|
114 // } |
|
115 // } |
|
116 // |
|
117 // /** |
|
118 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getDependenciesFile()}. |
|
119 // */ |
|
120 // @Test |
|
121 // public final void testGetDependenciesFile() { |
|
122 // if (!resourcesWidget.getSelectedDependenciesFiles()[0].equalsIgnoreCase("")) { |
|
123 // fail("Did not return default dependencies file"); |
|
124 // } |
|
125 // } |
|
126 // |
|
127 // /** |
|
128 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getColoursFile()}. |
|
129 // */ |
|
130 // @Test |
|
131 // public final void testGetColoursFile() { |
|
132 // if (!resourcesWidget.getSelectedColoursFiles()[0].equalsIgnoreCase("")) { |
|
133 // fail("Did not return default colours file"); |
|
134 // } |
|
135 // } |
|
136 // |
|
137 // /** |
|
138 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getBorderStylesFile()}. |
|
139 // */ |
|
140 // @Test |
|
141 // public final void testGetBorderStylesFile() { |
|
142 // if (!resourcesWidget.getSelectedBorderStylesFiles()[0].equalsIgnoreCase("")) { |
|
143 // fail("Did not return default border styles file"); |
|
144 // } |
|
145 // } |
|
146 // |
|
147 // /** |
|
148 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getBorderShapesFile()}. |
|
149 // */ |
|
150 // @Test |
|
151 // public final void testGetDefaultBorderShapesFile() { |
|
152 // if (!resourcesWidget.getSelectedBorderShapesFiles()[0].equalsIgnoreCase("")) { |
|
153 // fail("Did not return default border shapes file"); |
|
154 // } |
|
155 // } |
|
156 // |
|
157 // /** |
|
158 // * Test method for {@link com.symbian.smt.gui.smtwidgets.resources.ResourcesWidget#getPatternsFile()}. |
|
159 // */ |
|
160 // @Test |
|
161 // public final void testGetPatternsFile() { |
|
162 // if (!resourcesWidget.getSelectedPatternsFiles()[0].equalsIgnoreCase("")) { |
|
163 // fail("Did not return default patterns file"); |
|
164 // } |
|
165 // } |
|
166 // |
|
167 // @Test |
|
168 // public void testSetBorderShapesFile() { |
|
169 // resourcesWidget.setSelectedBorderShapesFiles(new String[] {""}); |
|
170 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedBorderShapesFiles()); |
|
171 // } |
|
172 // |
|
173 // @Test |
|
174 // public void testSetBorderStylesFile() { |
|
175 // resourcesWidget.setSelectedBorderStylesFiles(new String[] {""}); |
|
176 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedBorderStylesFiles()); |
|
177 // } |
|
178 // |
|
179 // @Test |
|
180 // public void testSetColoursFile() { |
|
181 // resourcesWidget.setSelectedColoursFiles(new String[] {""}); |
|
182 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedColoursFiles()); |
|
183 // } |
|
184 // |
|
185 // @Test |
|
186 // public void testSetDependenciesFile() { |
|
187 // resourcesWidget.setSelectedDependenciesFiles(new String[] {""}); |
|
188 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedDependenciesFiles()); |
|
189 // } |
|
190 // |
|
191 // @Test |
|
192 // public void testSetLevelsFile() { |
|
193 // resourcesWidget.setSelectedLevelsFiles(new String[] {""}); |
|
194 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedLevelsFiles()); |
|
195 // } |
|
196 // |
|
197 // @Test |
|
198 // public void testSetLocalisationFile() { |
|
199 // resourcesWidget.setSelectedLocalisationFiles(new String[] {""}); |
|
200 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedLocalisationFiles()); |
|
201 // } |
|
202 // @Test |
|
203 // public void testSetPatternsFile() { |
|
204 // resourcesWidget.setSelectedPatternsFiles(new String[] {""}); |
|
205 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedPatternsFiles()); |
|
206 // } |
|
207 // |
|
208 // @Test |
|
209 // public void testSetShapesFile() { |
|
210 // resourcesWidget.setSelectedShapesFiles(new String[] {""}); |
|
211 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedShapesFiles()); |
|
212 // } |
|
213 // |
|
214 // @Test |
|
215 // public void testSetSystemInfoFile() { |
|
216 // resourcesWidget.setSelectedSystemInfoFiles(new String[] {""}); |
|
217 // Assert.assertEquals(new String[] {""}, resourcesWidget.getSelectedSystemInfoFiles()); |
|
218 // } |
|
219 // |
|
220 // @Test |
|
221 // public void setAndGetBorderShapesFiles() { |
|
222 // String items[] = {"file1", "file2"}; |
|
223 // |
|
224 // resourcesWidget.setBorderShapesFiles(items); |
|
225 // |
|
226 // String returned[] = resourcesWidget.getBorderShapesFiles(); |
|
227 // |
|
228 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
229 // } |
|
230 // |
|
231 // @Test |
|
232 // public void setAndGetBorderStylesFiles() { |
|
233 // String items[] = {"file1", "file2"}; |
|
234 // |
|
235 // resourcesWidget.setBorderStylesFiles(items); |
|
236 // |
|
237 // String returned[] = resourcesWidget.getBorderStylesFiles(); |
|
238 // |
|
239 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
240 // } |
|
241 // |
|
242 // @Test |
|
243 // public void setAndGetColoursFiles() { |
|
244 // String items[] = {"file1", "file2"}; |
|
245 // |
|
246 // resourcesWidget.setColoursFiles(items); |
|
247 // |
|
248 // String returned[] = resourcesWidget.getColoursFiles(); |
|
249 // |
|
250 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
251 // } |
|
252 // |
|
253 // @Test |
|
254 // public void setAndGetPatternsFiles() { |
|
255 // String items[] = {"file1", "file2"}; |
|
256 // |
|
257 // resourcesWidget.setPatternsFiles(items); |
|
258 // |
|
259 // String returned[] = resourcesWidget.getPatternsFiles(); |
|
260 // |
|
261 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
262 // } |
|
263 // |
|
264 // @Test |
|
265 // public void setAndGetSystemInfoFiles() { |
|
266 // String items[] = {"file1", "file2"}; |
|
267 // |
|
268 // resourcesWidget.setSystemInfoFiles(items); |
|
269 // |
|
270 // String returned[] = resourcesWidget.getSystemInfoFiles(); |
|
271 // |
|
272 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
273 // } |
|
274 // |
|
275 // @Test |
|
276 // public void setAndGetLevelsFiles() { |
|
277 // String items[] = {"file1", "file2"}; |
|
278 // |
|
279 // resourcesWidget.setLevelsFiles(items); |
|
280 // |
|
281 // String returned[] = resourcesWidget.getLevelsFiles(); |
|
282 // |
|
283 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
284 // } |
|
285 // |
|
286 // @Test |
|
287 // public void setAndGetLocalisationFiles() { |
|
288 // String items[] = {"file1", "file2"}; |
|
289 // |
|
290 // resourcesWidget.setLocalisationFiles(items); |
|
291 // |
|
292 // String returned[] = resourcesWidget.getLocalisationFiles(); |
|
293 // |
|
294 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
295 // } |
|
296 // |
|
297 // |
|
298 // @Test |
|
299 // public void setAndGetDependenciesFiles() { |
|
300 // String items[] = {"file1", "file2"}; |
|
301 // |
|
302 // resourcesWidget.setDependenciesFiles(items); |
|
303 // |
|
304 // String returned[] = resourcesWidget.getDependenciesFiles(); |
|
305 // |
|
306 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
307 // } |
|
308 // |
|
309 // @Test |
|
310 // public void setAndGetShapesFiles() { |
|
311 // String items[] = {"file1", "file2"}; |
|
312 // |
|
313 // resourcesWidget.setShapesFiles(items); |
|
314 // |
|
315 // String returned[] = resourcesWidget.getShapesFiles(); |
|
316 // |
|
317 // assertTrue(returned.length == 2 && returned[0].equals("file1") && returned[1].equals("file2")); |
|
318 // } |
|
319 } |