Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Krasilnikov2007-04-12 16:10:26 +0000
committerOleg Krasilnikov2007-04-12 16:10:26 +0000
commit75131a463b4dabde4f4b18914be915c7faa986a8 (patch)
tree5050f7c00b767f0986a62052b92b7f3f1d40b19f /build/org.eclipse.cdt.managedbuilder.ui.tests
parent12e19c87738b2f7045cb16b009476a66b49373e0 (diff)
downloadorg.eclipse.cdt-75131a463b4dabde4f4b18914be915c7faa986a8.tar.gz
org.eclipse.cdt-75131a463b4dabde4f4b18914be915c7faa986a8.tar.xz
org.eclipse.cdt-75131a463b4dabde4f4b18914be915c7faa986a8.zip
Bug #182157 - file restored
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.ui.tests')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/TestCProjectPlatformPage.java140
1 files changed, 140 insertions, 0 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/TestCProjectPlatformPage.java b/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/TestCProjectPlatformPage.java
new file mode 100644
index 00000000000..7f031cedab6
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.ui.tests/src/org/eclipse/cdt/managedbuilder/ui/tests/TestCProjectPlatformPage.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Innoopract Informationssysteme GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Innoopract - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.managedbuilder.ui.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
+import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
+import org.eclipse.cdt.ui.wizards.CDTProjectWizard;
+import org.eclipse.cdt.ui.wizards.CWizardHandler;
+import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Tests for the get/setSelectedProjectType() of CProjectPlatformPage.
+ * @author Elias Volanakis
+ */
+public class TestCProjectPlatformPage extends TestCase implements IWizardItemsListListener {
+
+ //TODO: migrate to the new UI functionality
+ private CDTProjectWizard wizard;
+ private TestPage page;
+ private boolean currentState=false;
+
+ protected void setUp() throws Exception {
+ MBSCustomPageManager.init();
+ MBSCustomPageManager.loadExtensions();
+ wizard = new CDTProjectWizard();
+ page = new TestPage(wizard);
+ wizard.addPages();
+ }
+
+ protected void tearDown() throws Exception {
+ page.dispose();
+ page = null;
+ wizard = null;
+ }
+
+
+ // testing methods
+ //////////////////
+
+ /* Test the new page, set selection, create page lifecycle. */
+ public void testHandler1() throws Exception {
+ CWizardHandler h = new CWizardHandler(getShell(), "Head", "Name", null);
+ assertNotNull(h);
+ /*
+ IProjectType pt = new TestProjectType();
+ assertEquals(0, h.getToolChainsCount());
+ IToolchain tc = new Toolchain(new TestFolderInfo());
+ IToolChain xz;
+ tc.setId("test1");
+ h.addTc(tc);
+ // Test toolchain cannot be added
+ assertEquals(h.getToolChainsCount(), 1);
+ tc = new TestToolchain();
+ h.addTc(tc);
+ assertEquals(h.getToolChainsCount(), 2);
+ IToolChain[] tcs = h.getSelectedToolChains();
+ assertEquals(tcs.length, 33);
+ */
+ }
+
+ /* Test the new page, create page, set selection lifecycle. */
+ public void testProject() throws Exception {
+
+ IPath p = ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ /*
+ NewModelProjectWizard wiz = new CDTProjectWizard();
+ /*
+ String s = System.getenv("TEMP");
+
+ System.out.println(s);
+ assertNotNull(wiz);
+ /*
+ IProject pr1 = wiz.createIProject("test1", null);
+ assertNotNull(pr1);
+
+ IProject pr2 = wiz.createIProject("test2", p.append("test2"));
+ assertNotNull(pr2);
+ */
+ }
+
+ /*
+ * Tests that setting the selection to a projectType thats not on the list,
+ * is handled correctly.
+ */
+ public void testSelectedProjectType3() throws Exception {
+ }
+
+
+ // helping methods and classes
+ //////////////////////////////
+
+ private Shell getShell() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
+
+ class TestPage extends WizardPage implements IWizardItemsListListener{
+ TestPage(CDTProjectWizard wizard) throws Exception {
+ super(CDTMainWizardPage.class.getName());
+ }
+ IProjectType getFirstType() {
+ return null; //(IProjectType) projectTypes.get(0);
+ }
+ IProjectType getSecondType() {
+ return null; //(IProjectType) projectTypes.get(1);
+ }
+ public boolean isCurrent() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ public void toolChainListChanged(int count) {
+ // TODO Auto-generated method stub
+
+ }
+ public void createControl(Composite parent) {
+ // TODO Auto-generated method stub
+
+ }
+ }
+
+ // methods of IToolChainListListener
+ public boolean isCurrent() { return currentState; }
+ public void toolChainListChanged(int count) {}
+}

Back to the top