add geometry tests

This commit is contained in:
Alexey Fedoseev
2024-04-25 10:54:23 +03:00
parent d4d7872713
commit cab6585b01
24 changed files with 87 additions and 21 deletions

View File

@@ -37,5 +37,8 @@ eventPropagation/ block
</graph>
<graph id="G1" edgedefault="directed">
<data key="dName">SM2</data>
<data key="dGeometry">
<rect x="1.000000" y="2.000000" width="300.000000" height="40.000000"/>
</data>
</graph>
</graphml>

View File

@@ -1 +1 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM1'}, State Machine: {id: 'G1', name: 'SM2'}}
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM1'}, State Machine: {id: 'G1', name: 'SM2', geometry: (1; 2; 300; 40)}}

View File

@@ -34,7 +34,7 @@ int main(int argc, char** argv)
d.new_state_machine("G0", "SM2");
} catch (const Cyberiada::ParametersException&){
}
d.new_state_machine("SM2");
d.new_state_machine("SM2", Rect(1, 2, 300, 40));
try {
cout << d << endl;
d.save(string(argv[0]) + ".graphml", formatCyberiada10);

View File

@@ -36,6 +36,9 @@ eventPropagation/ block
</node>
<node id="n0">
<data key="dName">First state</data>
<data key="dGeometry">
<rect x="0.000000" y="50.000000" width="100.000000" height="25.000000"/>
</data>
</node>
</graph>
</graphml>

View File

@@ -1 +1 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Simple State: {id: 'n0', name: 'First state'}}}}
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Simple State: {id: 'n0', name: 'First state', geometry: (0; 50; 100; 25)}}}}

View File

@@ -30,7 +30,7 @@ int main(int argc, char** argv)
{
Document d;
StateMachine* sm = d.new_state_machine("SM");
d.new_state(sm, "First state");
d.new_state(sm, "First state", Action(), Rect(0, 50, 100, 25));
try {
cout << d << endl;
d.save(string(argv[0]) + ".graphml", formatCyberiada10);

View File

@@ -43,7 +43,7 @@ int main(int argc, char** argv)
d.new_initial(sm, "");
} catch (const Cyberiada::ParametersException&){
}
d.new_initial(parent, "Local init");
d.new_initial(parent, "Local init", Point(30, 40));
try {
// check double initial
d.new_initial(parent);

View File

@@ -40,6 +40,9 @@ eventPropagation/ block
<node id="n0::n0">
<data key="dVertex">initial</data>
<data key="dName">Local init</data>
<data key="dGeometry">
<point x="30.000000" y="40.000000"/>
</data>
</node>
</graph>
</node>

View File

@@ -1 +1 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Composite State: {id: 'n0', name: 'State', elements: {Initial: {id: 'n0::n0', name: 'Local init'}}}, Initial: {id: 'n1'}}}}
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Composite State: {id: 'n0', name: 'State', elements: {Initial: {id: 'n0::n0', name: 'Local init', geometry: (30; 40)}}}, Initial: {id: 'n1'}}}}

View File

@@ -45,7 +45,7 @@ int main(int argc, char** argv)
}
State* parent = d.new_state(sm, "State");
d.new_final(parent, "Local exit");
d.new_final(parent, "Local exit", Point(30, 40));
try {
cout << d << endl;

View File

@@ -43,6 +43,9 @@ eventPropagation/ block
<node id="n1::n0">
<data key="dVertex">final</data>
<data key="dName">Local exit</data>
<data key="dGeometry">
<point x="30.000000" y="40.000000"/>
</data>
</node>
</graph>
</node>

View File

@@ -1 +1 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Final: {id: 'n0'}, Composite State: {id: 'n1', name: 'State', elements: {Final: {id: 'n1::n0', name: 'Local exit'}}}}}}
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Final: {id: 'n0'}, Composite State: {id: 'n1', name: 'State', elements: {Final: {id: 'n1::n0', name: 'Local exit', geometry: (30; 40)}}}}}}

View File

@@ -45,7 +45,7 @@ int main(int argc, char** argv)
}
State* parent = d.new_state(sm, "State");
d.new_choice(parent, "Local choice");
d.new_choice(parent, "Local choice", Rect(0, 5, 100, 50));
try {
cout << d << endl;

View File

@@ -43,6 +43,9 @@ eventPropagation/ block
<node id="n1::n0">
<data key="dVertex">choice</data>
<data key="dName">Local choice</data>
<data key="dGeometry">
<rect x="0.000000" y="5.000000" width="100.000000" height="50.000000"/>
</data>
</node>
</graph>
</node>

View File

@@ -1 +1 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Choice: {id: 'n0'}, Composite State: {id: 'n1', name: 'State', elements: {Choice: {id: 'n1::n0', name: 'Local choice'}}}}}}
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Choice: {id: 'n0'}, Composite State: {id: 'n1', name: 'State', elements: {Choice: {id: 'n1::n0', name: 'Local choice', geometry: (0; 5; 100; 50)}}}}}}

View File

@@ -55,12 +55,38 @@ eventPropagation/ block
</edge>
<edge id="n0::n0-n0::n0" source="n0::n0" target="n0::n0">
<data key="dData">IDLE/</data>
<data key="dGeometry">
<point x="0.000000" y="0.000000"/>
<point x="5.000000" y="10.000000"/>
<point x="15.000000" y="20.000000"/>
</data>
<data key="dSourcePoint">
<point x="-1.000000" y="-2.000000"/>
</data>
<data key="dTargetPoint">
<point x="3.000000" y="4.000000"/>
</data>
</edge>
<edge id="n0-n0::n0" source="n0" target="n0::n0">
<data key="dData">INSIDE/</data>
<data key="dSourcePoint">
<point x="-1.000000" y="-2.000000"/>
</data>
<data key="dTargetPoint">
<point x="3.000000" y="4.000000"/>
</data>
</edge>
<edge id="n0::n1-n0" source="n0::n1" target="n0">
<data key="dData">OUTSIDE/</data>
<data key="dSourcePoint">
<point x="-1.000000" y="-2.000000"/>
</data>
<data key="dTargetPoint">
<point x="3.000000" y="4.000000"/>
</data>
<data key="dLabelGeometry">
<point x="5.000000" y="6.000000"/>
</data>
</edge>
<edge id="n0::n1-n1" source="n0::n1" target="n1">
<data key="dData">EVENT [guard()]/

View File

@@ -1 +1 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Composite State: {id: 'n0', name: 'Parent 0', elements: {Simple State: {id: 'n0::n0', name: 'State 0'}, Simple State: {id: 'n0::n1', name: 'State 1'}}}, Simple State: {id: 'n1', name: 'Parent 1'}, Transition: {id: 'n0::n0-n0::n1', source: 'n0::n0', target: 'n0::n1'}, Transition: {id: 'n0::n0-n0::n1#0', source: 'n0::n0', target: 'n0::n1', action: {trigger: 'A'}}, Transition: {id: 'n0::n0-n0::n0', source: 'n0::n0', target: 'n0::n0', action: {trigger: 'IDLE'}}, Transition: {id: 'n0-n0::n0', source: 'n0', target: 'n0::n0', action: {trigger: 'INSIDE'}}, Transition: {id: 'n0::n1-n0', source: 'n0::n1', target: 'n0', action: {trigger: 'OUTSIDE'}}, Transition: {id: 'n0::n1-n1', source: 'n0::n1', target: 'n1', action: {trigger: 'EVENT', guard: 'guard()', behavior: 'action();'}}}}}
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Composite State: {id: 'n0', name: 'Parent 0', elements: {Simple State: {id: 'n0::n0', name: 'State 0'}, Simple State: {id: 'n0::n1', name: 'State 1'}}}, Simple State: {id: 'n1', name: 'Parent 1'}, Transition: {id: 'n0::n0-n0::n1', source: 'n0::n0', target: 'n0::n1'}, Transition: {id: 'n0::n0-n0::n1#0', source: 'n0::n0', target: 'n0::n1', action: {trigger: 'A'}}, Transition: {id: 'n0::n0-n0::n0', source: 'n0::n0', target: 'n0::n0', action: {trigger: 'IDLE'}, sp: (-1; -2), tp: (3; 4), polyline: [ (0; 0), (5; 10), (15; 20) ]}, Transition: {id: 'n0-n0::n0', source: 'n0', target: 'n0::n0', action: {trigger: 'INSIDE'}, sp: (-1; -2), tp: (3; 4)}, Transition: {id: 'n0::n1-n0', source: 'n0::n1', target: 'n0', action: {trigger: 'OUTSIDE'}, sp: (-1; -2), tp: (3; 4), label: (5; 6)}, Transition: {id: 'n0::n1-n1', source: 'n0::n1', target: 'n1', action: {trigger: 'EVENT', guard: 'guard()', behavior: 'action();'}}}}}

View File

@@ -45,10 +45,14 @@ int main(int argc, char** argv)
d.new_transition(sm, sm, s1, Action());
} catch (const Cyberiada::ParametersException&){
}
d.new_transition(sm, s1, s1, Action("IDLE"));
d.new_transition(sm, parent1, s1, Action("INSIDE"));
d.new_transition(sm, s2, parent1, Action("OUTSIDE"));
Polyline pl;
pl.push_back(Point(0, 0));
pl.push_back(Point(5, 10));
pl.push_back(Point(15, 20));
d.new_transition(sm, s1, s1, Action("IDLE"), pl, Point(-1, -2), Point(3, 4));
d.new_transition(sm, parent1, s1, Action("INSIDE"), Polyline(), Point(-1, -2), Point(3, 4));
d.new_transition(sm, s2, parent1, Action("OUTSIDE"), Polyline(), Point(-1, -2), Point(3, 4), Point(5, 6));
try {
// check transition action

View File

@@ -39,11 +39,15 @@ int main(int argc, char** argv)
}
State* state = d.new_state(sm, "State", Action(actionEntry, "action();"));
Comment* comm2 = d.new_comment(state, "Comment inside a state\nwith two lines");
d.new_formal_comment(sm, "Name", "Named formal comment");
d.new_formal_comment(sm, "Name", "Named formal comment", Rect(0, 5, 100, 50));
d.add_comment_to_element(comm, state);
d.add_comment_to_element_name(comm2, state, "S");
d.add_comment_to_element_body(comm2, state, "action");
d.add_comment_to_element_name(comm2, state, "S", Point(-1, -2), Point(3, 4));
Polyline pl;
pl.push_back(Point(0, 0));
pl.push_back(Point(5, 10));
pl.push_back(Point(15, 20));
d.add_comment_to_element_body(comm2, state, "action", Point(), Point(), pl);
try {
cout << d << endl;

View File

@@ -55,6 +55,9 @@ with two lines</data>
<data key="dNote">formal</data>
<data key="dName">Name</data>
<data key="dData">Named formal comment</data>
<data key="dGeometry">
<rect x="0.000000" y="5.000000" width="100.000000" height="50.000000"/>
</data>
</node>
<edge id="n0-n1" source="n0" target="n1">
<data key="dPivot"/>
@@ -62,10 +65,21 @@ with two lines</data>
<edge id="n1::n0-n1" source="n1::n0" target="n1">
<data key="dPivot">dName</data>
<data key="dChunk">S</data>
<data key="dSourcePoint">
<point x="-1.000000" y="-2.000000"/>
</data>
<data key="dTargetPoint">
<point x="3.000000" y="4.000000"/>
</data>
</edge>
<edge id="n1::n0-n1" source="n1::n0" target="n1">
<data key="dPivot">dData</data>
<data key="dChunk">action</data>
<data key="dGeometry">
<point x="0.000000" y="0.000000"/>
<point x="5.000000" y="10.000000"/>
<point x="15.000000" y="20.000000"/>
</data>
</edge>
</graph>
</graphml>

View File

@@ -1,2 +1,2 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Comment: {id: 'n0', body: 'Top level', subjects: {{id: 'n0-n1', type: element, to: 'n1'}}}, Composite State: {id: 'n1', name: 'State', actions: {a {entry, behavior: 'action();'}}, elements: {Comment: {id: 'n1::n0', body: 'Comment inside a state
with two lines', subjects: {{id: 'n1::n0-n1', type: name, to: 'n1', fragment: 'S'}, {id: 'n1::n0-n1', type: data, to: 'n1', fragment: 'action'}}}}}, Formal Comment: {id: 'n2', name: 'Name', body: 'Named formal comment'}}}}
with two lines', subjects: {{id: 'n1::n0-n1', type: name, to: 'n1', fragment: 'S', source point: (-1; -2), target point: (3; 4)}, {id: 'n1::n0-n1', type: data, to: 'n1', fragment: 'action', polyline: [ (0; 0), (5; 10), (15; 20) ]}}}}}, Formal Comment: {id: 'n2', name: 'Name', body: 'Named formal comment', geometry: (0; 5; 100; 50)}}}}

View File

@@ -43,6 +43,9 @@ eventPropagation/ block
<node id="n1::n0">
<data key="dVertex">terminate</data>
<data key="dName">Local term</data>
<data key="dGeometry">
<point x="30.000000" y="40.000000"/>
</data>
</node>
</graph>
</node>

View File

@@ -1 +1 @@
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Terminate: {id: 'n0'}, Composite State: {id: 'n1', name: 'State', elements: {Terminate: {id: 'n1::n0', name: 'Local term'}}}}}}
Document: {id: '', name: '', format: 'Cyberiada-GraphML-1.0', meta: {standard version: '1.0', transition order: transition first, event propagation: block events}, elements: {State Machine: {id: 'G0', name: 'SM', elements: {Terminate: {id: 'n0'}, Composite State: {id: 'n1', name: 'State', elements: {Terminate: {id: 'n1::n0', name: 'Local term', geometry: (30; 40)}}}}}}

View File

@@ -45,7 +45,7 @@ int main(int argc, char** argv)
}
State* parent = d.new_state(sm, "State");
d.new_terminate(parent, "Local term");
d.new_terminate(parent, "Local term", Point(30, 40));
try {
cout << d << endl;