2
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
package com.nokia.carbide.cpp.codescanner.tests;
|
|
19 |
|
|
20 |
import org.eclipse.core.resources.IProject;
|
|
21 |
import org.eclipse.core.runtime.CoreException;
|
|
22 |
import org.eclipse.core.runtime.IProgressMonitor;
|
|
23 |
import org.eclipse.core.runtime.NullProgressMonitor;
|
|
24 |
|
|
25 |
import com.nokia.carbide.cpp.internal.codescanner.config.CSProjectSettings;
|
|
26 |
import com.nokia.carbide.cpp.project.core.ProjectCorePlugin;
|
|
27 |
|
|
28 |
import junit.framework.TestCase;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Test cases for Class CSProjectSettings.
|
|
32 |
*
|
|
33 |
*/
|
|
34 |
public class CSProjectSettingsTest extends TestCase {
|
|
35 |
|
|
36 |
private static IProgressMonitor monitor;
|
|
37 |
private static IProject project;
|
|
38 |
|
|
39 |
protected void setUp() throws Exception {
|
|
40 |
super.setUp();
|
|
41 |
try {
|
|
42 |
if (monitor == null) {
|
|
43 |
monitor = new NullProgressMonitor();
|
|
44 |
}
|
|
45 |
if (project == null) {
|
|
46 |
project = ProjectCorePlugin.createProject("CSProjectSettingsTest", null);
|
|
47 |
}
|
|
48 |
project.open(monitor);
|
|
49 |
} catch (CoreException e) {
|
|
50 |
fail();
|
|
51 |
}
|
|
52 |
}
|
|
53 |
|
|
54 |
protected void tearDown() throws Exception {
|
|
55 |
try {
|
|
56 |
project.close(monitor);
|
|
57 |
} catch (CoreException e) {
|
|
58 |
fail();
|
|
59 |
}
|
|
60 |
super.tearDown();
|
|
61 |
}
|
|
62 |
|
|
63 |
public void testCSProjectSettings() {
|
|
64 |
CSProjectSettings projectSettings = new CSProjectSettings(project);
|
|
65 |
assertNotNull(projectSettings);
|
|
66 |
}
|
|
67 |
|
|
68 |
public void testGetProject() {
|
|
69 |
CSProjectSettings projectSettings = new CSProjectSettings(project);
|
|
70 |
assertNotNull(projectSettings);
|
|
71 |
assertTrue(projectSettings.getProject().equals(project));
|
|
72 |
}
|
|
73 |
|
|
74 |
public void testGetDialogSettings() {
|
|
75 |
CSProjectSettings projectSettings = new CSProjectSettings(project);
|
|
76 |
assertNotNull(projectSettings);
|
|
77 |
assertNotNull(projectSettings.getDialogSettings());
|
|
78 |
}
|
|
79 |
|
|
80 |
public void testSaveDialogSettings() {
|
|
81 |
CSProjectSettings projectSettings = new CSProjectSettings(project);
|
|
82 |
assertNotNull(projectSettings);
|
|
83 |
assertNotNull(projectSettings.getDialogSettings());
|
|
84 |
assertTrue(projectSettings.saveDialogSettings());
|
|
85 |
}
|
|
86 |
|
|
87 |
}
|