Skip to content

Commit

Permalink
prmr#413 Fix geometry tests for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
prmr authored and louib committed Aug 15, 2021
1 parent c53571c commit 9a7d177
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 64 deletions.
62 changes: 31 additions & 31 deletions test/ca/mcgill/cs/jetuml/persistence/TestPersistenceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ private void verifyUseCaseDiagram(Diagram pDiagram)
assertEquals(new Rectangle(460, 230, 110, 40), NodeViewerRegistry.getBounds(u3));
assertEquals("Use case 3", u3.getName().toString());

assertTrue(new Rectangle(270, 50, 48, 90).equals(NodeViewerRegistry.getBounds(a1)) || new Rectangle(270, 50, 48, 87).equals(NodeViewerRegistry.getBounds(a1)));
assertEquals(new Rectangle(270, 50, 48, osDependent(91, 87, 87)), NodeViewerRegistry.getBounds(a1));
assertEquals("Actor", a1.getName().toString());

assertTrue(new Rectangle(280, 230, 48, 90).equals(NodeViewerRegistry.getBounds(a2)) || new Rectangle(280, 230, 48, 87).equals(NodeViewerRegistry.getBounds(a2)));
assertEquals(new Rectangle(280, 230, 49, 91), NodeViewerRegistry.getBounds(a2));
assertEquals("Actor2", a2.getName().toString());

assertEquals("A note", n1.getName());
Expand All @@ -218,7 +218,7 @@ private void verifyUseCaseDiagram(Diagram pDiagram)
assertEquals(new Rectangle(650, 150, 110, 40), NodeViewerRegistry.getBounds(u4));
assertEquals("Use case 4", u4.getName().toString());

assertTrue(new Rectangle(190, 140, 48, 90).equals(NodeViewerRegistry.getBounds(a3)) || new Rectangle(190, 140, 48, 87).equals(NodeViewerRegistry.getBounds(a3)));
assertEquals(new Rectangle(650, 150, 110, 40), NodeViewerRegistry.getBounds(u4));
assertEquals("Actor3", a3.getName().toString());

assertEquals(10, numberOfEdges(pDiagram));
Expand All @@ -239,11 +239,11 @@ private void verifyUseCaseDiagram(Diagram pDiagram)
assertTrue(cr1.getStart() == n1);
assertTrue(cr1.getEnd() == p1);

assertEquals(new Rectangle(236, 120, 34, 38), getBounds(cr2));
assertEquals(new Rectangle(osDependent(237, 236, 236), 120, osDependent(33, 34, 34), 38), getBounds(cr2));
assertTrue(cr2.getStart() == a3);
assertTrue(cr2.getEnd() == a1);

assertEquals(new Rectangle(osDependent(229,228, 229), 207, osDependent(61,63, 61), 44), getBounds(cr3));
assertEquals(new Rectangle(osDependent(228,228, 229), 207, osDependent(62,63, 61), 44), getBounds(cr3));
assertTrue( cr3.getStart() == a3);
assertTrue( cr3.getEnd() == a2);
assertTrue( cr3.properties().get("Dependency Type").get() == UseCaseDependencyEdge.Type.Extend);
Expand All @@ -252,24 +252,24 @@ private void verifyUseCaseDiagram(Diagram pDiagram)
assertTrue( cr4.getStart() == a1 );
assertTrue( cr4.getEnd() == u1 );

assertEquals(new Rectangle(326, 158, 142, 103), getBounds(cr5));
assertEquals(new Rectangle(osDependent(327, 326, 326), 158, osDependent(141, 142, 142), 103), getBounds(cr5));
assertTrue( cr5.getStart() == a2 );
assertTrue( cr5.getEnd() == u2 );

assertEquals(new Rectangle(326, 250, 134, 22), getBounds(cr6));
assertEquals(new Rectangle(osDependent(327, 326, 326), 250, osDependent(133, 134, 134), 22), getBounds(cr6));
assertTrue( cr6.getStart() == a2 );
assertTrue( cr6.getEnd() == u3 );

assertEquals(new Rectangle(499,77,12,54), getBounds(cr7));
assertTrue( cr7.getStart() == u2 );
assertTrue( cr7.getEnd() == u1 );

assertEquals(new Rectangle(osDependent(484,483, 484),169,osDependent(63,65, 62),62), getBounds(cr8));
assertEquals(new Rectangle(osDependent(483,483, 484),169,osDependent(64,65, 62),62), getBounds(cr8));
assertTrue( cr8.getStart() == u2 );
assertTrue( cr8.getEnd() == u3 );
assertTrue( cr8.properties().get("Dependency Type").get() == UseCaseDependencyEdge.Type.Include);

assertEquals(new Rectangle(568,150,82,26), getBounds(cr9));
assertEquals(new Rectangle(568,150,82,osDependent(27, 26, 26)), getBounds(cr9));
assertTrue( cr9.getStart() == u2 );
assertTrue( cr9.getEnd() == u4 );
assertTrue( cr9.properties().get("Dependency Type").get() == UseCaseDependencyEdge.Type.Extend);
Expand Down Expand Up @@ -370,7 +370,7 @@ private void verifyClassDiagram(Diagram pDiagram)
assertEquals("bar", node3.getMethods());
assertEquals("Class2", node3.getName());
assertFalse(node3.hasParent());
assertEquals(new Rectangle(460, 520, 100, 78), NodeViewerRegistry.getBounds(node3));
assertEquals(new Rectangle(460, 520, 100, osDependent(81, 78, 78)), NodeViewerRegistry.getBounds(node3));

assertEquals("", node4.getAttributes());
assertEquals("", node4.getMethods());
Expand Down Expand Up @@ -404,7 +404,7 @@ private void verifyClassDiagram(Diagram pDiagram)
assertEquals(node8, edge5.getEnd());

DependencyEdge edge6 = (DependencyEdge) eIterator.next();
assertEquals(new Rectangle(378, osDependent(390,390, 384), 83, osDependent(23,26, 21)), getBounds(edge6));
assertEquals(new Rectangle(378, osDependent(390,390, 384), 83, osDependent(27,26, 21)), getBounds(edge6));
assertEquals(node7, edge6.getEnd());
assertEquals("e1", edge6.getMiddleLabel());
assertEquals(node1, edge6.getStart());
Expand All @@ -420,15 +420,15 @@ private void verifyClassDiagram(Diagram pDiagram)
assertEquals(node3, edge2.getStart());

AggregationEdge edge3 = (AggregationEdge) eIterator.next();
assertEquals(new Rectangle(558, osDependent(377,380, 379), 72, osDependent(23,20, 21)), getBounds(edge3));
assertEquals(new Rectangle(558, osDependent(379,380, 379), 72, osDependent(21,20, 21)), getBounds(edge3));
assertEquals(node4, edge3.getEnd());
assertEquals("*", edge3.getEndLabel());
assertEquals("e4", edge3.getMiddleLabel());
assertEquals(node1, edge3.getStart());
assertEquals("1", edge3.getStartLabel());

AggregationEdge edge4 = (AggregationEdge) eIterator.next();
assertEquals(new Rectangle(559, 399, 72, 160), getBounds(edge4));
assertEquals(new Rectangle(559, 399, 72, osDependent(161, 160, 160)), getBounds(edge4));
assertEquals(node3, edge4.getEnd());
assertEquals("", edge4.getEndLabel());
assertEquals("e5", edge4.getMiddleLabel());
Expand Down Expand Up @@ -496,26 +496,26 @@ private void verifySequenceDiagram(Diagram pDiagram)
ReturnEdge retC = (ReturnEdge) eIterator.next();
NoteEdge nedge = (NoteEdge) eIterator.next();

assertEquals(new Rectangle(osDependent(214,212, 216), 85, 86, 26), getBounds(self));
assertEquals(new Rectangle(osDependent(214,212, 216), 85, 86, osDependent(27, 26, 26)), getBounds(self));
assertEquals(selfCall, self.getEnd());
assertEquals("selfCall()", self.getMiddleLabel());
assertEquals(init, self.getStart());
assertFalse(self.isSignal());

assertEquals(new Rectangle(osDependent(224,222, 226), 100, osDependent(179, 181, 177),
26), getBounds(signal));
osDependent(27, 26, 26)), getBounds(signal));
assertEquals(o2Call, signal.getEnd());
assertEquals("signal", signal.getMiddleLabel());
assertEquals(selfCall, signal.getStart());
assertTrue(signal.isSignal());

assertEquals(new Rectangle(417, 120, 206, 26), getBounds(call1));
assertEquals(new Rectangle(417, 120, 206, osDependent(27, 26, 26)), getBounds(call1));
assertEquals(o3Call, call1.getEnd());
assertEquals("call1()", call1.getMiddleLabel());
assertEquals(o2Call, call1.getStart());
assertFalse(call1.isSignal());

assertEquals(new Rectangle(416, 160, 207, osDependent(23,26, 23)), getBounds(ret1));
assertEquals(new Rectangle(416, 160, 207, osDependent(27,26, 23)), getBounds(ret1));
assertEquals(o2Call, ret1.getEnd());
assertEquals("r1", ret1.getMiddleLabel());
assertEquals(o3Call, ret1.getStart());
Expand Down Expand Up @@ -556,7 +556,7 @@ private void verifyStateDiagram(Diagram pDiagram)
assertEquals(new Rectangle(640, 230, 20, 20), NodeViewerRegistry.getBounds(end));

assertEquals("A note\non two lines", note.getName());
assertEquals(new Rectangle(690, 320, osDependent(86,81, 86), 40), NodeViewerRegistry.getBounds(note));
assertEquals(new Rectangle(690, 320, osDependent(86,81, 86), osDependent(43, 40, 40)), NodeViewerRegistry.getBounds(note));

assertEquals(new Rectangle(576, 339, 0, 0), NodeViewerRegistry.getBounds(point));

Expand All @@ -575,17 +575,17 @@ private void verifyStateDiagram(Diagram pDiagram)
assertEquals(note, ne.getStart());
assertEquals(point, ne.getEnd());

assertEquals(new Rectangle(168, osDependent(73,76, 75), 82, osDependent(37,34, 35)), getBounds(fromStart));
assertEquals(new Rectangle(168, osDependent(75,76, 75), 82, osDependent(35,34, 35)), getBounds(fromStart));
assertEquals(start, fromStart.getStart());
assertEquals(s1, fromStart.getEnd());
assertEquals("start", fromStart.getMiddleLabel().toString());

assertEquals(new Rectangle(328, osDependent(100,103, 101), 182, osDependent(28,25, 26)), getBounds(e1));
assertEquals(new Rectangle(328, osDependent(102,103, 101), 182, osDependent(26,25, 26)), getBounds(e1));
assertEquals(s1, e1.getStart());
assertEquals(s2, e1.getEnd());
assertEquals("e1", e1.getMiddleLabel().toString());

assertEquals(new Rectangle(328, 131, 182, osDependent(27,24, 25)), getBounds(e2));
assertEquals(new Rectangle(328, 131, 182, osDependent(25,24, 25)), getBounds(e2));
assertEquals(s2, e2.getStart());
assertEquals(s1, e2.getEnd());
assertEquals("e2", e2.getMiddleLabel().toString());
Expand Down Expand Up @@ -618,36 +618,36 @@ private void verifyObjectDiagram(Diagram pDiagram)
PointNode p1 = (PointNode) findRootNode(pDiagram, PointNode.class, build("x", 281));
PointNode p2 = (PointNode) findRootNode(pDiagram, PointNode.class, build("x", 474));

assertEquals(new Rectangle(240, 130, osDependent(110, 110, 100), osDependent(90, 100, 100)), NodeViewerRegistry.getBounds(type1));
assertEquals(new Rectangle(240, 130, osDependent(120, 110, 100), osDependent(100, 100, 100)), NodeViewerRegistry.getBounds(type1));
List<Node> children = type1.getChildren();
assertEquals(1, children.size());
assertEquals(":Type1", type1.getName().toString());

FieldNode name = (FieldNode) children.get(0);
assertEquals(new Rectangle(245, 200, osDependent(100, 100, 90), osDependent(20, 26, 21)), NodeViewerRegistry.getBounds(name));
assertEquals(new Rectangle(245, 200, osDependent(110, 100, 90), osDependent(27, 26, 21)), NodeViewerRegistry.getBounds(name));
assertEquals("name", name.getName().toString());
assertEquals(type1, name.getParent());
assertEquals("", name.getValue().toString());

assertEquals(new Rectangle(440, 290, osDependent(120, 130, 110), 160), NodeViewerRegistry.getBounds(blank));
assertEquals(new Rectangle(440, 290, osDependent(130, 130, 110), osDependent(170, 160, 160)), NodeViewerRegistry.getBounds(blank));
children = blank.getChildren();
assertEquals(3, children.size());
assertEquals("", blank.getName().toString());
FieldNode name2 = (FieldNode) children.get(0);
FieldNode name3 = (FieldNode) children.get(1);
FieldNode name4 = (FieldNode) children.get(2);

assertEquals(new Rectangle(445, 360, osDependent(110, 120, 100), 26), NodeViewerRegistry.getBounds(name2));
assertEquals(new Rectangle(445, 360, osDependent(120, 120, 100), osDependent(27, 26, 26)), NodeViewerRegistry.getBounds(name2));
assertEquals("name2", name2.getName().toString());
assertEquals(blank, name2.getParent());
assertEquals("value", name2.getValue().toString());

assertEquals(new Rectangle(445, 391, osDependent(110, 120, 100), 26), NodeViewerRegistry.getBounds(name3));
assertEquals(new Rectangle(445, osDependent(392, 391, 391), osDependent(120, 120, 100), osDependent(27, 26, 26)), NodeViewerRegistry.getBounds(name3));
assertEquals("name3", name3.getName().toString());
assertEquals(blank, name3.getParent());
assertEquals("value", name3.getValue().toString());

assertEquals(new Rectangle(445, 422, osDependent(110, 120, 100), 26), NodeViewerRegistry.getBounds(name4));
assertEquals(new Rectangle(445, osDependent(424, 422, 422), osDependent(120, 120, 100), osDependent(27,26,26)), NodeViewerRegistry.getBounds(name4));
assertEquals("name4", name4.getName().toString());
assertEquals(blank, name4.getParent());
assertEquals("", name4.getValue().toString());
Expand Down Expand Up @@ -678,20 +678,20 @@ private void verifyObjectDiagram(Diagram pDiagram)
NoteEdge ne2 = (NoteEdge) eIt.next();
ObjectCollaborationEdge cr1 = (ObjectCollaborationEdge) eIt.next();

assertEquals(new Rectangle(osDependent(339, 339, 329), osDependent(174, 179, 179), 32, osDependent(37, 35, 32)), getBounds(o1));
assertEquals(new Rectangle(osDependent(349, 339, 329), osDependent(179, 179, 179), 32, osDependent(35, 35, 32)), getBounds(o1));
assertEquals(name, o1.getStart());
assertEquals(type1, o1.getEnd());

assertEquals(new Rectangle(osDependent(339, 339, 329), 212, osDependent(102, 102, 112), 159), getBounds(o2));
assertEquals(new Rectangle(osDependent(349, 339, 329), 212, osDependent(92, 102, 112), osDependent(164, 159, 159)), getBounds(o2));
assertEquals(name, o2.getStart());
assertEquals(blank, o2.getEnd());

assertEquals(new Rectangle(osDependent(530, 535, 527), 208, osDependent(37, 33, 39), 82), getBounds(cr1));
assertEquals(new Rectangle(osDependent(536, 535, 527), 208, osDependent(32, 33, 39), 82), getBounds(cr1));
assertEquals(object2, cr1.getEnd());
assertEquals("e1", cr1.getMiddleLabel().toString());
assertEquals(blank, cr1.getStart());

assertEquals(new Rectangle(osDependent(549, 559, 539), 329, osDependent(62, 52, 72), 107), getBounds(o3));
assertEquals(new Rectangle(osDependent(559, 559, 539), 329, osDependent(52, 52, 72), osDependent(109, 107, 107)), getBounds(o3));
assertEquals(name4, o3.getStart());
assertEquals(type3, o3.getEnd());

Expand Down
Loading

0 comments on commit 9a7d177

Please sign in to comment.