diff --git a/.github/workflows/buildAndTest.yml b/.github/workflows/buildAndTest.yml
index b1596cd3f..4f8cc8f96 100644
--- a/.github/workflows/buildAndTest.yml
+++ b/.github/workflows/buildAndTest.yml
@@ -25,7 +25,7 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v2
with:
- java-version: 8
+ java-version: 11
distribution: adopt
- name: Cache Maven packages
uses: actions/cache@v2
diff --git a/build/de.cau.cs.kieler.klighd.repository/category.xml b/build/de.cau.cs.kieler.klighd.repository/category.xml
index 3478191f4..2617736d5 100644
--- a/build/de.cau.cs.kieler.klighd.repository/category.xml
+++ b/build/de.cau.cs.kieler.klighd.repository/category.xml
@@ -63,11 +63,11 @@
-
+
-
+
-
+
diff --git a/build/de.cau.cs.kieler.klighd.repository/pom.xml b/build/de.cau.cs.kieler.klighd.repository/pom.xml
index 6f2ddc983..63d88d068 100644
--- a/build/de.cau.cs.kieler.klighd.repository/pom.xml
+++ b/build/de.cau.cs.kieler.klighd.repository/pom.xml
@@ -32,10 +32,16 @@
which has been built meanwhile, doesn't work properly yet,
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=453708#c34
so we have to stick to this plug-in -->
+
org.jboss.tools.tycho-plugins
repository-utils
- 1.0.0
+ 2.5.0
generate-facade
@@ -46,17 +52,17 @@
- https://download.eclipse.org/releases/2020-06/
+ https://download.eclipse.org/releases/2021-06/
https://download.eclipse.org/modeling/mdt/uml2/updates/5.4/
https://download.eclipse.org/elk/updates/releases/0.8.1/>
- https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.22.0/>
+ https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.25.0/>
https://xtext.github.io/download/updates/releases/2.1.1/>
- https://download.eclipse.org/tools/orbit/downloads/drops/R20200529191137/repository/
+ https://download.eclipse.org/tools/orbit/downloads/drops/R20210223232630/repository/
https://rtsys.informatik.uni-kiel.de/~kieler/updatesite/sprotty/0.9.0/
diff --git a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-elkNightly.target b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-elkNightly.target
index 4ee5aacc6..b78d8fac2 100644
--- a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-elkNightly.target
+++ b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-elkNightly.target
@@ -8,7 +8,7 @@
-
+
@@ -25,7 +25,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
diff --git a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo-elkNightly.target b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo-elkNightly.target
index ce981af0f..0e6e56c8e 100644
--- a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo-elkNightly.target
+++ b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo-elkNightly.target
@@ -8,7 +8,7 @@
-
+
@@ -25,7 +25,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
diff --git a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo.target b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo.target
index 08f46ce70..9c7d6f0bd 100644
--- a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo.target
+++ b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform-piccolo.target
@@ -8,7 +8,7 @@
-
+
@@ -25,7 +25,7 @@
-
+
@@ -40,7 +40,7 @@
-
+
diff --git a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform.target b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform.target
index 6de8e5d65..0ef65c6da 100644
--- a/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform.target
+++ b/build/de.cau.cs.kieler.klighd.targetplatform/de.cau.cs.kieler.klighd.targetplatform.target
@@ -8,7 +8,7 @@
-
+
@@ -25,7 +25,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
diff --git a/plugins/de.cau.cs.kieler.kgraph.text.ide/META-INF/MANIFEST.MF b/plugins/de.cau.cs.kieler.kgraph.text.ide/META-INF/MANIFEST.MF
index 547b97718..70f3ee94d 100644
--- a/plugins/de.cau.cs.kieler.kgraph.text.ide/META-INF/MANIFEST.MF
+++ b/plugins/de.cau.cs.kieler.kgraph.text.ide/META-INF/MANIFEST.MF
@@ -7,9 +7,11 @@ Bundle-Vendor: Kiel University
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: de.cau.cs.kieler.kgraph.text,
org.eclipse.xtext.ide,
- org.eclipse.xtext.xbase.ide
+ com.google.guava,
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.xtend.lib,
+ org.eclipse.xtend.lib.macro
Export-Package: de.cau.cs.kieler.kgraph.text.ide,
de.cau.cs.kieler.kgraph.text.ide.contentassist.antlr,
de.cau.cs.kieler.kgraph.text.ide.contentassist.antlr.internal
Automatic-Module-Name: de.cau.cs.kieler.kgraph.text.ide
-
diff --git a/plugins/de.cau.cs.kieler.kgraph.text.ui/src/de/cau/cs/kieler/kgraph/text/ui/KGraphUiModule.java b/plugins/de.cau.cs.kieler.kgraph.text.ui/src/de/cau/cs/kieler/kgraph/text/ui/KGraphUiModule.java
index a4d0bfe17..590d2a86f 100644
--- a/plugins/de.cau.cs.kieler.kgraph.text.ui/src/de/cau/cs/kieler/kgraph/text/ui/KGraphUiModule.java
+++ b/plugins/de.cau.cs.kieler.kgraph.text.ui/src/de/cau/cs/kieler/kgraph/text/ui/KGraphUiModule.java
@@ -17,6 +17,9 @@
package de.cau.cs.kieler.kgraph.text.ui;
import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.xtext.resource.containers.IAllContainersState;
+
+import com.google.inject.Provider;
/**
* Use this class to register components to be used within the IDE.
@@ -37,4 +40,7 @@ public KGraphUiModule(final AbstractUIPlugin plugin) {
super(plugin);
}
+ public Provider provideIAllContainersState() {
+ return org.eclipse.xtext.ui.shared.Access.getWorkspaceProjectsState();
+ }
}
diff --git a/plugins/de.cau.cs.kieler.kgraph.text/META-INF/MANIFEST.MF b/plugins/de.cau.cs.kieler.kgraph.text/META-INF/MANIFEST.MF
index 9bcb637e6..b1a234bc5 100644
--- a/plugins/de.cau.cs.kieler.kgraph.text/META-INF/MANIFEST.MF
+++ b/plugins/de.cau.cs.kieler.kgraph.text/META-INF/MANIFEST.MF
@@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.xtext;visibility:=reexport,
org.eclipse.xtext.util,
org.antlr.runtime,
org.eclipse.xtext.xbase.lib,
- org.eclipse.xtext.xbase,
org.eclipse.emf.ecore,
org.eclipse.emf.common,
org.eclipse.core.resources,
diff --git a/plugins/de.cau.cs.kieler.klighd.piccolo.batik/.classpath b/plugins/de.cau.cs.kieler.klighd.piccolo.batik/.classpath
index b48ccfc73..711341e8d 100644
--- a/plugins/de.cau.cs.kieler.klighd.piccolo.batik/.classpath
+++ b/plugins/de.cau.cs.kieler.klighd.piccolo.batik/.classpath
@@ -1,30 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
index e24a5e08b..3def1d66f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,9 +51,8 @@
- 1.7.0
- 1.8
- 2.22.0
+ 2.5.0
+ 2.25.0
0.8.1
@@ -66,6 +65,13 @@
UTF-8
UTF-8
+
+ 1.8
+
+
+
+
-ea
@@ -202,6 +208,11 @@
cocoa
x86_64
+
+ macosx
+ cocoa
+ aarch64
+
diff --git a/test/de.cau.cs.kieler.klighd.piccolo.test/META-INF/MANIFEST.MF b/test/de.cau.cs.kieler.klighd.piccolo.test/META-INF/MANIFEST.MF
index 4d84614c1..63330c7d5 100644
--- a/test/de.cau.cs.kieler.klighd.piccolo.test/META-INF/MANIFEST.MF
+++ b/test/de.cau.cs.kieler.klighd.piccolo.test/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: KLighD Piccolo2D Binding Tests
Bundle-SymbolicName: de.cau.cs.kieler.klighd.piccolo.test;singleton:=true
Bundle-Version: 2.2.1.qualifier
Bundle-Vendor: Kiel University
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.junit;bundle-version="4.8.0",
org.eclipse.core.runtime,
org.eclipse.xtext.xbase.lib;bundle-version="2.4.2",
diff --git a/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/FreeHEPSVGOffscreenRenderingTest.launch b/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/FreeHEPSVGOffscreenRenderingTest.launch
index fe0958f14..3a6c88b70 100644
--- a/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/FreeHEPSVGOffscreenRenderingTest.launch
+++ b/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/FreeHEPSVGOffscreenRenderingTest.launch
@@ -39,16 +39,17 @@
+
+
-
-
+
-
-
+
+
@@ -63,9 +64,12 @@
+
+
+
@@ -110,13 +114,17 @@
+
+
+
+
@@ -126,11 +134,9 @@
-
-
@@ -151,6 +157,7 @@
+
diff --git a/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/HighlightedEdgeToForegroundTest.launch b/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/HighlightedEdgeToForegroundTest.launch
index 14f807e0f..1eaf256d3 100644
--- a/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/HighlightedEdgeToForegroundTest.launch
+++ b/test/de.cau.cs.kieler.klighd.piccolo.test/runConfigs/HighlightedEdgeToForegroundTest.launch
@@ -1,45 +1,167 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/de.cau.cs.kieler.klighd.piccolo.test/src/de/cau/cs/kieler/klighd/piccolo/test/freehep/FreeHEPSVGOffscreenRenderingTest.xtend b/test/de.cau.cs.kieler.klighd.piccolo.test/src/de/cau/cs/kieler/klighd/piccolo/test/freehep/FreeHEPSVGOffscreenRenderingTest.xtend
index 2ad88dccd..0b3c35e14 100644
--- a/test/de.cau.cs.kieler.klighd.piccolo.test/src/de/cau/cs/kieler/klighd/piccolo/test/freehep/FreeHEPSVGOffscreenRenderingTest.xtend
+++ b/test/de.cau.cs.kieler.klighd.piccolo.test/src/de/cau/cs/kieler/klighd/piccolo/test/freehep/FreeHEPSVGOffscreenRenderingTest.xtend
@@ -29,11 +29,14 @@ import de.cau.cs.kieler.klighd.kgraph.util.KGraphUtil
import de.cau.cs.kieler.klighd.krendering.KRenderingFactory
import de.cau.cs.kieler.klighd.microlayout.PlacementUtil
import de.cau.cs.kieler.klighd.piccolo.export.SVGOffscreenRenderer
+import de.cau.cs.kieler.klighd.util.KlighdProperties
import de.cau.cs.kieler.klighd.util.KlighdSemanticDiagramData
import de.cau.cs.kieler.klighd.util.KlighdSynthesisProperties
import java.io.ByteArrayOutputStream
import java.util.EnumSet
import java.util.regex.Pattern
+import org.eclipse.elk.core.math.ElkPadding
+import org.eclipse.elk.core.options.CoreOptions
import org.eclipse.elk.core.options.PortConstraints
import org.eclipse.elk.core.options.PortLabelPlacement
import org.eclipse.elk.core.options.PortSide
@@ -53,10 +56,10 @@ import static extension org.junit.Assert.assertEquals
/**
* @author chsch
*/
- @FixMethodOrder(JVM)
+ @FixMethodOrder(NAME_ASCENDING)
class FreeHEPSVGOffscreenRenderingTest {
- extension KRenderingFactory = KRenderingFactory.eINSTANCE
+ static extension KRenderingFactory = KRenderingFactory.eINSTANCE
@BeforeClass
def static void initDisplay() {
@@ -537,16 +540,17 @@ class FreeHEPSVGOffscreenRenderingTest {
- def equalsSVGof(CharSequence expectation, (KNode) => void viewModelBuilder) {
- expectation.equalsSVGof(viewModelBuilder, false)
+ def static equalsSVGof(CharSequence expectation, (KNode) => void viewModelBuilder) {
+ expectation.equalsSVGof(viewModelBuilder, false, false)
}
- def equalsSVGwithTextLengthsOf(CharSequence expectation, (KNode) => void viewModelBuilder) {
- expectation.equalsSVGof(viewModelBuilder, true)
+ def static equalsSVGwithTextLengthsOf(CharSequence expectation, (KNode) => void viewModelBuilder) {
+ expectation.equalsSVGof(viewModelBuilder, false, true)
}
- def equalsSVGof(CharSequence expectation, (KNode) => void viewModelBuilder, boolean withTextLength) {
+ def static equalsSVGof(CharSequence expectation, (KNode) => void viewModelBuilder, boolean widthEdgesFirst, boolean withTextLength) {
val root = KGraphUtil.createInitializedNode()
+ root.setProperty(CoreOptions.PADDING, new ElkPadding(10))
viewModelBuilder.apply(root)
val output = new ByteArrayOutputStream()
@@ -555,6 +559,7 @@ class FreeHEPSVGOffscreenRenderingTest {
.setProperty(SVGOffscreenRenderer.GENERATOR, SVGOffscreenRenderer.GENERATOR_SVG_FREEHEP_EXTENDED)
.setProperty(IOffscreenRenderer.TRANSPARENT_BACKGROUND, Boolean.TRUE)
.setProperty(IOffscreenRenderer.SET_TEXT_LENGTHS, Boolean.valueOf(withTextLength))
+ .setProperty(KlighdProperties.EDGES_FIRST, widthEdgesFirst)
)
if (status.exception !== null)
@@ -562,53 +567,54 @@ class FreeHEPSVGOffscreenRenderingTest {
OK_STATUS.assertEquals(status)
- expectation.toString.assertEquals(
- output.toString.trimMetaInfos.maskFontSizeAndTextYPos
+ expectation.toString.sortProperties().assertEquals(
+ output.toString.trimMetaInfos.sortProperties().maskFontSizeAndTextYPos
)
}
static val END_OF_HEADER_MARKER = ''
+ static val END_OF_SVG_MARKER_LENGTH = ''.length
- def trimMetaInfos(String svg) {
+ def static trimMetaInfos(String svg) {
val trimmed = svg.trim
switch endOfHeader : trimmed.indexOf(END_OF_HEADER_MARKER) + END_OF_HEADER_MARKER.length {
- case trimmed.length > endOfHeader + 6: trimmed.substring(endOfHeader, trimmed.length - 6).trim + Klighd.LINE_SEPARATOR
- case trimmed.length > endOfHeader: trimmed.substring(endOfHeader).trim + Klighd.LINE_SEPARATOR
- default: trimmed
+ case trimmed.length > endOfHeader + END_OF_SVG_MARKER_LENGTH: trimmed.substring(endOfHeader, trimmed.length - END_OF_SVG_MARKER_LENGTH).trim + Klighd.LINE_SEPARATOR
+ case trimmed.length > endOfHeader: trimmed.substring(endOfHeader).trim + Klighd.LINE_SEPARATOR
+ default: trimmed
}
}
static val P_FONT_SIZE = Pattern.compile('(font-size=")[^"]*(")')
static val P_DY = Pattern.compile('(dy=")[^"]*(")')
- static val P_TEXT_Y = Pattern.compile('($2')
val textYMasked = P_TEXT_Y.matcher(fontSizeMasked).replaceAll('$1$2')
P_DY.matcher(textYMasked).replaceAll('$1$2')
}
- def addKNodeWithSizeOf(KNode parent, float width, float height) {
+ def static addKNodeWithSizeOf(KNode parent, float width, float height) {
val node = createInitializedNode
node.setSize(width, height)
parent.children += node
node
}
- def addKPortWithSizeOf(KNode parent, float width, float height) {
+ def static addKPortWithSizeOf(KNode parent, float width, float height) {
val port = createInitializedPort
port.setSize(width, height)
parent.ports += port
port
}
- def addKRectangleWithStrokeOnlyColoring(KGraphElement kge) {
+ def static addKRectangleWithStrokeOnlyColoring(KGraphElement kge) {
kge.data += createKRectangle
kge
}
- def addKTextWithAssumedSizeOf(KLabel label, float width, float height) {
+ def static addKTextWithAssumedSizeOf(KLabel label, float width, float height) {
createKText => [
label.data += it
setProperty(KlighdInternalProperties.KLIGHD_TESTING_WIDTH, width)
@@ -616,4 +622,42 @@ class FreeHEPSVGOffscreenRenderingTest {
makePersistent // required as the PlacementUtil.getTestingTextSize(...) method inspects the list of persisted entries only
]
}
+
+ static val Pattern tagOrNonTag = Pattern.compile('<((?:[^<>]|<[^<>]*>)*)>|([^<]+)'); // a tag (group1) is enclosed in '<>' and may contain nested pairs of '<>' indicating the escapes of and ; non-tag content is captured as group2
+ static val Pattern item = Pattern.compile('[^\\s=]+(\\=\\"[^\\"]*\\")?');
+
+ def static sortProperties(String input) {
+ input.lines().iterator().map[ line |
+ val matcher = tagOrNonTag.matcher(line);
+ val result = matcher.iterator.map[
+ if (matcher.group(1).isNullOrEmpty)
+ matcher.group(2)
+ else
+ item.matcher(matcher.group(1)).iterator().toList().sortInplace[
+ a, b | if (a.contains('=') && b.contains('=')) a.compareTo(b) else 0
+ ].join('<', ' ', '>', [ it ])
+ ].join();
+
+ // do some 'self testing' for each line to make sure we didn't swallow any characters,
+ // a diff of 1 is ok, as '..dfjskl"/>...' is converted to '..dfjskl" />...' by the above joining strategy
+ if (Math.abs(result.length() - line.length) > 1)
+ assertEquals('''Lengths differ («line.length» vs. «result.length»):''', line, result);
+
+ return result;
+
+ ].join(Klighd.LINE_SEPARATOR);
+ }
+
+ def static java.util.Iterator iterator(java.util.regex.Matcher matcher) {
+ new java.util.Iterator() {
+ override hasNext() {
+ return matcher.find();
+ }
+
+ override next() {
+ return matcher.group();
+ }
+
+ }
+ }
}
diff --git a/test/de.cau.cs.kieler.klighd.test/runConfigs/ViewChangedNotificationTest.launch b/test/de.cau.cs.kieler.klighd.test/runConfigs/ViewChangedNotificationTest.launch
index 3e9cbb409..4067eb61c 100644
--- a/test/de.cau.cs.kieler.klighd.test/runConfigs/ViewChangedNotificationTest.launch
+++ b/test/de.cau.cs.kieler.klighd.test/runConfigs/ViewChangedNotificationTest.launch
@@ -1,45 +1,165 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/de.cau.cs.kieler.klighd.test/src/de/cau/cs/kieler/klighd/test/ViewChangedNotificationTest.java b/test/de.cau.cs.kieler.klighd.test/src/de/cau/cs/kieler/klighd/test/ViewChangedNotificationTest.java
index 405db2ac9..4a90b7fa5 100644
--- a/test/de.cau.cs.kieler.klighd.test/src/de/cau/cs/kieler/klighd/test/ViewChangedNotificationTest.java
+++ b/test/de.cau.cs.kieler.klighd.test/src/de/cau/cs/kieler/klighd/test/ViewChangedNotificationTest.java
@@ -29,10 +29,13 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.FixMethodOrder;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TestName;
import org.junit.runners.MethodSorters;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
import com.google.common.collect.Sets;
import de.cau.cs.kieler.klighd.IDiagramWorkbenchPart;
@@ -46,6 +49,7 @@
import de.cau.cs.kieler.klighd.kgraph.KGraphElement;
import de.cau.cs.kieler.klighd.kgraph.KNode;
import de.cau.cs.kieler.klighd.piccolo.viewer.PiccoloViewer;
+import de.cau.cs.kieler.klighd.syntheses.DiagramLayoutOptions;
import de.cau.cs.kieler.klighd.util.KlighdSynthesisProperties;
import de.cau.cs.kieler.klighd.viewers.ContextViewer;
@@ -58,6 +62,8 @@
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class ViewChangedNotificationTest {
+ private static final boolean DEBUG_SYS_OUT = false;
+
private Shell shell = null;
private ViewContext viewContext = null;
private AssertionError failure = null;
@@ -69,7 +75,7 @@ public class ViewChangedNotificationTest {
public static void lookForElkLayered() {
Assert.assertNotNull(
"ELK Layered is not on the classpath, but it's required for properly executing the tests.",
- LayoutMetaDataService.getInstance().getAlgorithmDataBySuffix("org.eclipse.elk.layered")
+ LayoutMetaDataService.getInstance().getAlgorithmDataBySuffix(DiagramLayoutOptions.ELK_LAYERED)
);
}
@@ -83,7 +89,7 @@ public void prepare() {
// which is too high for some tests below 100, so I request the modelless style here
// however, on linux the SWT.RESIZE flag is required to successfully run the tests 4-5b, so...
shell = new Shell(Display.getDefault(), SWT.RESIZE);
- shell.setSize(300, 200);
+ shell.setSize(400, 200);
shell.setLocation(100, 100);
shell.setLayout(new FillLayout());
@@ -93,7 +99,7 @@ public void prepare() {
new ContextViewer(shell).setModel(viewContext, true);
heightDelta = 200 - viewContext.getViewer().getControl().getSize().y;
- shell.setSize(300, 200 + heightDelta);
+ shell.setSize(400, 200 + heightDelta);
viewContext.update(null);
@@ -106,6 +112,9 @@ public void prepare() {
failure = null;
}
+ @Rule
+ public TestName name= new TestName();
+
/**
* Process queued tasks delegated to the Display's thread, which is the one the tests are
* executed, and clean up the employed {@link Shell}.
@@ -158,8 +167,14 @@ public void run() {
public void viewChanged(final ViewChange change) {
- final Iterable l = Sets.newHashSet(
- countNodesOnly ? change.visibleDiagramNodes() : change.visibleDiagramElements());
+ final Iterable l = Sets.newLinkedHashSet(
+ () -> countNodesOnly ? Iterators.filter(change.visibleDiagramNodes(), KGraphElement.class) : change.visibleDiagramElements()
+ );
+
+ if (DEBUG_SYS_OUT) {
+ System.out.println(name.getMethodName() + ":\n" + String.join("\n", Iterables.transform(l, e -> e.toString())));
+ }
+
try {
MatcherAssert.assertThat("", l,
IsIterableWithSize.iterableWithSize(expectedElementsNumber));
@@ -264,10 +279,10 @@ public void test04b() {
public void test05() {
viewContext.setZoomStyle(ZoomStyle.NONE);
expectedElementsNumber = 4;
- if (Klighd.IS_WINDOWS)
- shell.setSize(150, shell.getSize().y);
- else
+ if (Klighd.IS_MACOSX)
shell.setSize(130, shell.getSize().y);
+ else
+ shell.setSize(140, shell.getSize().y);
}
/**
@@ -278,9 +293,9 @@ public void test05b() {
viewContext.setZoomStyle(ZoomStyle.NONE);
countNodesOnly = false;
expectedElementsNumber = 23;
- if (Klighd.IS_WINDOWS)
- shell.setSize(150, shell.getSize().y);
- else
+ if (Klighd.IS_MACOSX)
shell.setSize(130, shell.getSize().y);
+ else
+ shell.setSize(140, shell.getSize().y);
}
}