aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2011-11-16 10:22:54 (EST)
committerMickael Istria2011-11-16 10:22:54 (EST)
commitca96ee48ecc5316db7dff68191de87b45cd0c586 (patch)
tree057841a359cb62c49d1b8fcaebfc737d58b982bb
parent4cf365e21b71c4f690da4bd00737137983e7843a (diff)
downloadorg.eclipse.gmf-tooling-ca96ee48ecc5316db7dff68191de87b45cd0c586.zip
org.eclipse.gmf-tooling-ca96ee48ecc5316db7dff68191de87b45cd0c586.tar.gz
org.eclipse.gmf-tooling-ca96ee48ecc5316db7dff68191de87b45cd0c586.tar.bz2
Bug 267354:
Actual test classes and resource
-rw-r--r--tests/org.eclipse.gmf.tests/models/tests/267354-FigureRefChildren.gmfgraph24
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllSWTBotTests.java32
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/swtbot/FigureGenerationTest.java79
3 files changed, 135 insertions, 0 deletions
diff --git a/tests/org.eclipse.gmf.tests/models/tests/267354-FigureRefChildren.gmfgraph b/tests/org.eclipse.gmf.tests/models/tests/267354-FigureRefChildren.gmfgraph
new file mode 100644
index 0000000..dbaeacc
--- /dev/null
+++ b/tests/org.eclipse.gmf.tests/models/tests/267354-FigureRefChildren.gmfgraph
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gmfgraph:Canvas xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition">
+ <figures>
+ <figures
+ xsi:type="gmfgraph:Rectangle"
+ name="figure"/>
+ <descriptors
+ name="desc">
+ <actualFigure
+ xsi:type="gmfgraph:FigureRef"
+ figure="//@figures.0/@figures.0">
+ <foregroundColor
+ xsi:type="gmfgraph:ConstantColor"
+ value="lightGreen"/>
+ </actualFigure>
+ </descriptors>
+ </figures>
+ <nodes
+ name="node"
+ figure="desc"/>
+</gmfgraph:Canvas>
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllSWTBotTests.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllSWTBotTests.java
new file mode 100644
index 0000000..57857de
--- /dev/null
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllSWTBotTests.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+* Copyright (c) 2011 EBM Websourcing (PetalsLink)
+* 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:
+* Mickael Istria (EBM - PetalsLink) : initial implementation
+*******************************************************************************/
+package org.eclipse.gmf.tests;
+
+import org.eclipse.gmf.tests.gen.swtbot.FigureGenerationTest;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+ FigureGenerationTest.class
+})
+public class AllSWTBotTests {
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ if (System.getProperty("buildingWithTycho") != null) {
+ System.err.println("Generating a target platform");
+ Utils.setTargetPlatform();
+ }
+ }
+}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/swtbot/FigureGenerationTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/swtbot/FigureGenerationTest.java
new file mode 100644
index 0000000..95dbdbd
--- /dev/null
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/swtbot/FigureGenerationTest.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+* Copyright (c) 2011 EBM Websourcing (PetalsLink)
+* 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:
+* Mickael Istria (EBM - PetalsLink) : initial implementation
+*******************************************************************************/
+package org.eclipse.gmf.tests.gen.swtbot;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class FigureGenerationTest extends SWTBotEclipseTestCase {
+
+ @Test
+ public void testBug267354_FigureRefChildren() throws Exception {
+ // Don't use SWTBot to save time and not related to GMF.
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject("testProjectBug267354");
+ proj.create(new NullProgressMonitor());
+ proj.open(new NullProgressMonitor());
+ IFile file = proj.getFile("267354-FigureRefChildren.gmfgraph");
+ file.create(getClass().getClassLoader().getResourceAsStream("/models/tests/267354-FigureRefChildren.gmfgraph"), false, new NullProgressMonitor());
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, "org.eclipse.gmf.gmfgraph.presentation.GMFGraphEditorID", true);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ });
+ SWTBotTreeItem figureGalleryNode = bot.editorByTitle("267354-FigureRefChildren.gmfgraph").bot().tree().getAllItems()[0].expand().getNode("Canvas").expand().getNode("Figure Gallery").click();
+ figureGalleryNode.contextMenu("Generate Figures Plug-in ...").click();
+ bot.shell("Figure Gallery Generator").bot().text().setText("org.eclipse.gmf.testProjectBug267354");
+ bot.button("OK").click();
+ bot.waitWhile(new ICondition() {
+ @Override
+ public boolean test() throws Exception {
+ return bot.activeShell().getText().equals("Generate Figures Plug-in ...");
+ }
+
+ @Override
+ public void init(SWTBot bot) {
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return null;
+ }
+ }, 40000);
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getProject("org.eclipse.gmf.testProjectBug267354").getFile(new Path("src/org/eclipse/gmf/testProjectBug267354/Desc.java"));
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ });
+ Assert.assertTrue("Did not find specified background color attribute", bot.editorByTitle("Desc.java").toTextEditor().getText().contains("ColorConstants.lightGreen"));
+ }
+}