mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Additional tests for Custom Wizard Pages
This commit is contained in:
parent
03c8b2fa41
commit
1d6a584519
4 changed files with 322 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
|||
point="org.eclipse.cdt.managedbuilder.ui.newWizardPages">
|
||||
<wizardPage
|
||||
ID="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.AlwaysPresentWizardPage"
|
||||
operationClass="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.TestRunnable"
|
||||
pageClass="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.AlwaysPresentWizardPage"/>
|
||||
<wizardPage
|
||||
ID="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.NatureAWizardPage"
|
||||
|
@ -40,6 +41,13 @@
|
|||
pageClass="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ToolchainCWizardPage">
|
||||
<toolchain toolchainID="C"/>
|
||||
</wizardPage>
|
||||
<wizardPage
|
||||
ID="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ToolchainCv20WizardPage"
|
||||
pageClass="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ToolchainCv20WizardPage">
|
||||
<toolchain
|
||||
toolchainID="C"
|
||||
versionsSupported="2.0.0"/>
|
||||
</wizardPage>
|
||||
<wizardPage
|
||||
ID="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ProjectTypeDWizardPage"
|
||||
pageClass="org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ProjectTypeDWizardPage">
|
||||
|
|
|
@ -44,12 +44,17 @@ public class TestCustomPageManager extends TestCase
|
|||
private static final String projectTypeDPageName = "org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ProjectTypeDWizardPage";
|
||||
private static final String projectTypeEPageName = "org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ProjectTypeEWizardPage";
|
||||
private static final String toolchainFPageName = "org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ToolchainFWizardPage";
|
||||
private static final String toolchainCv20PageName = "org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ToolchainCv20WizardPage";
|
||||
|
||||
public static boolean testFlag = false;
|
||||
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
MBSCustomPageManager.init();
|
||||
|
||||
MBSCustomPageManager.loadExtensions();
|
||||
|
||||
testFlag = false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,6 +107,12 @@ public class TestCustomPageManager extends TestCase
|
|||
fail("ToolChainCWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolChainCv20WizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeDPageName))
|
||||
{
|
||||
|
@ -184,6 +195,12 @@ public class TestCustomPageManager extends TestCase
|
|||
fail("ToolChainCWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolChainCv20WizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeDPageName))
|
||||
{
|
||||
|
@ -265,6 +282,12 @@ public class TestCustomPageManager extends TestCase
|
|||
fail("ToolChainCWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolChainCv20WizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeDPageName))
|
||||
{
|
||||
|
@ -334,6 +357,12 @@ public class TestCustomPageManager extends TestCase
|
|||
fail("ToolchainCWizardPage should not have a next page.");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolChainCv20WizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(natureAPageName))
|
||||
{
|
||||
|
@ -366,6 +395,107 @@ public class TestCustomPageManager extends TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the toolchain to "C_2.0.0". Only pages with no contraints, or toolchains set to "C", or toolchains set to "C" version 2.0.0 should show up.
|
||||
*/
|
||||
public void testToolchainCv20()
|
||||
{
|
||||
// set the project type to be "X"
|
||||
MBSCustomPageManager.addPageProperty(CProjectPlatformPage.PAGE_ID, CProjectPlatformPage.PROJECT_TYPE, "X");
|
||||
|
||||
// set the toolchain to "C"
|
||||
Set toolchainSet = new LinkedHashSet();
|
||||
TestToolchain toolchain = new TestToolchain();
|
||||
toolchain.setID("C_2.0.0");
|
||||
toolchainSet.add(toolchain);
|
||||
MBSCustomPageManager.addPageProperty(CProjectPlatformPage.PAGE_ID, CProjectPlatformPage.TOOLCHAIN, toolchainSet);
|
||||
|
||||
// set the nature to "Z"
|
||||
MBSCustomPageManager.addPageProperty(CProjectPlatformPage.PAGE_ID, CProjectPlatformPage.NATURE, "Z");
|
||||
|
||||
// check each of the pages
|
||||
|
||||
// this page should always be visible
|
||||
if(!MBSCustomPageManager.isPageVisible(alwaysPresentPageName))
|
||||
{
|
||||
fail("AlwaysPresentWizardPage should be visible");
|
||||
}
|
||||
|
||||
// next page for this page should be the page for toolchain C
|
||||
if(MBSCustomPageManager.getNextPage(alwaysPresentPageName) != MBSCustomPageManager.getPageData(toolchainCPageName).getWizardPage())
|
||||
{
|
||||
fail("AlwaysPresentWizardPage's next page should be ToolchainCWizardPage");
|
||||
}
|
||||
|
||||
// toolchain C page's previous page should be the always present page
|
||||
if(MBSCustomPageManager.getPreviousPage(toolchainCPageName) != MBSCustomPageManager.getPageData(alwaysPresentPageName).getWizardPage())
|
||||
{
|
||||
fail("ToolchainCWizardPage's previous page should be AlwaysPresentWizardPage");
|
||||
}
|
||||
|
||||
// Toolchain C page should be visible
|
||||
if(!MBSCustomPageManager.isPageVisible(toolchainCPageName))
|
||||
{
|
||||
fail("ToolchainCWizardPage should be visible");
|
||||
}
|
||||
|
||||
// Toolchain C page's next page should be the page for C 2.0
|
||||
if(MBSCustomPageManager.getNextPage(toolchainCPageName) != MBSCustomPageManager.getPageData(toolchainCv20PageName).getWizardPage())
|
||||
{
|
||||
fail("ToolchainCWizardPage's next page should be ToolchainCv20WizardPage.");
|
||||
}
|
||||
|
||||
// toolchain C v 2.0.0 page's previous page should be the toolchain C page
|
||||
if(MBSCustomPageManager.getPreviousPage(toolchainCv20PageName) != MBSCustomPageManager.getPageData(toolchainCPageName).getWizardPage())
|
||||
{
|
||||
fail("ToolchainCv20WizardPage's previous page should be ToolchainCWizardPage");
|
||||
}
|
||||
|
||||
// Toolchain C v 2.0.0 page should be visible
|
||||
if(!MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolchainCWizardPage should be visible");
|
||||
}
|
||||
|
||||
// Toolchain C v 2.0.0 page's next page should be null
|
||||
if(MBSCustomPageManager.getNextPage(toolchainCv20PageName) != null)
|
||||
{
|
||||
fail("ToolchainCv20WizardPage should not have a next page.");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(natureAPageName))
|
||||
{
|
||||
fail("NatureAWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(natureBPageName))
|
||||
{
|
||||
fail("NatureBWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeDPageName))
|
||||
{
|
||||
fail("ProjectTypeDWizardPage should not be visible");
|
||||
}
|
||||
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeEPageName))
|
||||
{
|
||||
fail("ProjectTypeEWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainFPageName))
|
||||
{
|
||||
fail("ToolchainFWizardPage should not be visible");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the project type to "D". Only pages with no contraints or project types set to "D" should show up.
|
||||
|
@ -435,6 +565,12 @@ public class TestCustomPageManager extends TestCase
|
|||
fail("ToolChainCWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolChainCv20WizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeEPageName))
|
||||
{
|
||||
|
@ -519,6 +655,12 @@ public class TestCustomPageManager extends TestCase
|
|||
fail("ToolChainCWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolChainCv20WizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeDPageName))
|
||||
{
|
||||
|
@ -595,6 +737,12 @@ public class TestCustomPageManager extends TestCase
|
|||
fail("NatureBWizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(toolchainCv20PageName))
|
||||
{
|
||||
fail("ToolChainCv20WizardPage should not be visible");
|
||||
}
|
||||
|
||||
// the rest of the pages should be invisible
|
||||
if(MBSCustomPageManager.isPageVisible(projectTypeDPageName))
|
||||
{
|
||||
|
@ -722,6 +870,16 @@ public class TestCustomPageManager extends TestCase
|
|||
}
|
||||
|
||||
|
||||
public void testOperation()
|
||||
{
|
||||
MBSCustomPageManager.getPageData(alwaysPresentPageName).getOperation().run();
|
||||
|
||||
if(testFlag != true)
|
||||
{
|
||||
fail("Running operation associated with AlwaysPresentWizardPage failed.");
|
||||
}
|
||||
}
|
||||
|
||||
public TestCustomPageManager(String name)
|
||||
{
|
||||
|
||||
|
@ -735,11 +893,12 @@ public class TestCustomPageManager extends TestCase
|
|||
suite.addTest(new TestCustomPageManager("testNatureA"));
|
||||
suite.addTest(new TestCustomPageManager("testNatureB"));
|
||||
suite.addTest(new TestCustomPageManager("testToolchainC"));
|
||||
suite.addTest(new TestCustomPageManager("testToolchainCv20"));
|
||||
suite.addTest(new TestCustomPageManager("testProjectTypeD"));
|
||||
suite.addTest(new TestCustomPageManager("testProjectTypeE"));
|
||||
suite.addTest(new TestCustomPageManager("testToolchainF"));
|
||||
suite.addTest(new TestCustomPageManager("testMultiplePages"));
|
||||
|
||||
suite.addTest(new TestCustomPageManager("testOperation"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 Texas Instruments Incorporated 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:
|
||||
* Texas Instruments - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.ui.tests.wizardPages;
|
||||
|
||||
import java.lang.Runnable;
|
||||
import org.eclipse.cdt.managedbuilder.ui.tests.TestCustomPageManager;
|
||||
|
||||
public class TestRunnable implements Runnable
|
||||
{
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Runnable#run()
|
||||
*/
|
||||
public void run()
|
||||
{
|
||||
TestCustomPageManager.testFlag = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005 Texas Instruments Incorporated 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:
|
||||
* Texas Instruments - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.ui.tests.wizardPages;
|
||||
|
||||
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
||||
public class ToolchainCv20WizardPage extends MBSCustomPage
|
||||
{
|
||||
|
||||
private Composite composite;
|
||||
|
||||
public ToolchainCv20WizardPage()
|
||||
{
|
||||
pageID = "org.eclipse.cdt.managedbuilder.ui.tests.wizardPages.ToolchainCv20WizardPage";
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return new String("Toolchain C v 2.0 Wizard Page");
|
||||
}
|
||||
|
||||
public void createControl(Composite parent)
|
||||
{
|
||||
|
||||
composite = new Composite(parent, SWT.NULL);
|
||||
composite.setLayout(new GridLayout());
|
||||
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
Text pageText = new Text(composite, SWT.CENTER);
|
||||
pageText.setBounds(composite.getBounds());
|
||||
pageText.setText("Toolchain C v 2.0 Wizard Page");
|
||||
pageText.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
public void dispose()
|
||||
{
|
||||
composite.dispose();
|
||||
|
||||
}
|
||||
|
||||
public Control getControl()
|
||||
{
|
||||
return composite;
|
||||
}
|
||||
|
||||
public String getDescription()
|
||||
{
|
||||
return new String("My description");
|
||||
}
|
||||
|
||||
public String getErrorMessage()
|
||||
{
|
||||
return new String("My error msg");
|
||||
}
|
||||
|
||||
public Image getImage()
|
||||
{
|
||||
return wizard.getDefaultPageImage();
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return new String("My Title");
|
||||
}
|
||||
|
||||
public void performHelp()
|
||||
{
|
||||
// do nothing
|
||||
|
||||
}
|
||||
|
||||
public void setDescription(String description)
|
||||
{
|
||||
// do nothing
|
||||
|
||||
}
|
||||
|
||||
public void setImageDescriptor(ImageDescriptor image)
|
||||
{
|
||||
// do nothing
|
||||
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
// do nothing
|
||||
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible)
|
||||
{
|
||||
composite.setVisible(visible);
|
||||
|
||||
}
|
||||
|
||||
protected boolean isCustomPageComplete()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue