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