source: trunk/org.modelica.mdt.test/src/org/modelica/mdt/test/TestNewProjectWizard.java

Last change on this file was 235, checked in by boris, 19 years ago
  • added class type selection retention to the new class wizard dialog, as requested by ze boss !
File size: 3.2 KB
Line 
1/*
2 * This file is part of Modelica Development Tooling.
3 *
4 * Copyright (c) 2005, Link�pings universitet, Department of
5 * Computer and Information Science, PELAB
6 *
7 * All rights reserved.
8 *
9 * (The new BSD license, see also
10 * http://www.opensource.org/licenses/bsd-license.php)
11 *
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions are
15 * met:
16 *
17 * * Redistributions of source code must retain the above copyright
18 *   notice, this list of conditions and the following disclaimer.
19 *
20 * * Redistributions in binary form must reproduce the above copyright
21 *   notice, this list of conditions and the following disclaimer in
22 *   the documentation and/or other materials provided with the
23 *   distribution.
24 *
25 * * Neither the name of Link�pings universitet nor the names of its
26 *   contributors may be used to endorse or promote products derived from
27 *   this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 */
41
42package org.modelica.mdt.test;
43
44import org.eclipse.swt.widgets.Button;
45import org.eclipse.swt.widgets.Text;
46import org.eclipse.ui.IWorkbenchWizard;
47import org.modelica.mdt.test.util.Utility;
48import org.modelica.mdt.ui.wizards.NewProjectWizard;
49
50import abbot.tester.swt.ButtonTester;
51import abbot.tester.swt.TextTester;
52
53import junit.framework.TestCase;
54
55public class TestNewProjectWizard extends TestCase
56{
57    /* name of the project that test creates */
58    public static final String PROJECT_NAME_1 = 
59        TestNewProjectWizard.class.getName() + "1";
60   
61    public void testWizard()
62    {
63        /*
64         * init and display wizard
65         */
66        IWorkbenchWizard wizard = 
67            Utility.openWizard("org.modelica.mdt.NewProjectWizard");
68        assertFalse(wizard.canFinish());
69
70        /* fetch project name text field */
71        Text name = 
72            TextTester.getInstrumentedText(NewProjectWizard.PROJECT_NAME_TAG);     
73        /* enter project name */
74        TextTester.getTextTester().actionEnterText(name, PROJECT_NAME_1);
75       
76        assertTrue(wizard.canFinish());
77
78        /*
79         * create project by clicking finish button
80         */
81        Button finish = Utility.findButtonByText("&Finish");
82       
83        /* wait for the name change to propogate to enable the finish button */
84        while (!finish.getEnabled()) { Utility.sleep(this, 100); }
85       
86        ButtonTester.getButtonTester().actionClick(finish);
87   
88        //TODO check that project was created
89    }
90
91}
Note: See TracBrowser for help on using the repository browser.