Skip to content

Commit

Permalink
Add tests for addClassAnnotation API.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost committed Nov 24, 2015
1 parent cf42914 commit 302a8b5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
56 changes: 56 additions & 0 deletions openmodelica/interactive-API/AddClassAnnotation.mos
@@ -0,0 +1,56 @@
// name: addClassAnnotation
// keywords:
// status: correct
//
// Tests the setComponentModifierValue API functions.
//

loadString("
model PA
annotation (Icon(graphics={Polygon(lineColor={0,0,127}, fillColor={0,0,127},
fillPattern=FillPattern.Solid, points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})}));
end PA;

model PB end PB;

type DA = Real annotation (Icon(graphics={Polygon(lineColor={0,0,127}, fillColor={0,0,127},
fillPattern=FillPattern.Solid, points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})}));

type DB = Real;

type EA = enumeration(a, b, c) annotation (Icon(graphics={Polygon(lineColor={0,0,127}, fillColor={0,0,127},
fillPattern=FillPattern.Solid, points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})}));

type EB = enumeration(x, y, z);
"); getErrorString();

addClassAnnotation(PA, annotate=Icon(graphics={Polygon(lineColor={0,0,127},fillColor={0,0,127},fillPattern=FillPattern.Solid,points={{0,50},{100,0},{0,-50},{0,50}}),Rectangle(lineColor={0,0,255},fillColor={0,0,255},extent={{-100,100},{100,-100}})}));
addClassAnnotation(PB, annotate=Icon(graphics={Polygon(lineColor={0,0,127},fillColor={0,0,127},fillPattern=FillPattern.Solid,points={{0,50},{100,0},{0,-50},{0,50}}),Rectangle(lineColor={0,0,255},fillColor={0,0,255},extent={{-100,100},{100,-100}})}));
addClassAnnotation(DA, annotate=Icon(graphics={Polygon(lineColor={0,0,127},fillColor={0,0,127},fillPattern=FillPattern.Solid,points={{0,50},{100,0},{0,-50},{0,50}}),Rectangle(lineColor={0,0,255},fillColor={0,0,255},extent={{-100,100},{100,-100}})}));
addClassAnnotation(DB, annotate=Icon(graphics={Polygon(lineColor={0,0,127},fillColor={0,0,127},fillPattern=FillPattern.Solid,points={{0,50},{100,0},{0,-50},{0,50}}),Rectangle(lineColor={0,0,255},fillColor={0,0,255},extent={{-100,100},{100,-100}})}));
addClassAnnotation(EA, annotate=Icon(graphics={Polygon(lineColor={0,0,127},fillColor={0,0,127},fillPattern=FillPattern.Solid,points={{0,50},{100,0},{0,-50},{0,50}}),Rectangle(lineColor={0,0,255},fillColor={0,0,255},extent={{-100,100},{100,-100}})}));
addClassAnnotation(EB, annotate=Icon(graphics={Polygon(lineColor={0,0,127},fillColor={0,0,127},fillPattern=FillPattern.Solid,points={{0,50},{100,0},{0,-50},{0,50}}),Rectangle(lineColor={0,0,255},fillColor={0,0,255},extent={{-100,100},{100,-100}})}));

getIconAnnotation(PA);
getIconAnnotation(PB);
getIconAnnotation(DA);
getIconAnnotation(DB);
getIconAnnotation(EA);
getIconAnnotation(EB);

// Result:
// true
// ""
// true
// true
// true
// true
// true
// true
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Polygon(true, {0.0, 0.0}, 0, {0, 0, 127}, {0, 0, 127}, LinePattern.Solid, FillPattern.Solid, 0.25, {{0, 50}, {100, 0}, {0, -50}, {0, 50}}, Smooth.None), Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.None, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Polygon(true, {0.0, 0.0}, 0, {0, 0, 127}, {0, 0, 127}, LinePattern.Solid, FillPattern.Solid, 0.25, {{0, 50}, {100, 0}, {0, -50}, {0, 50}}, Smooth.None), Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.None, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Polygon(true, {0.0, 0.0}, 0, {0, 0, 127}, {0, 0, 127}, LinePattern.Solid, FillPattern.Solid, 0.25, {{0, 50}, {100, 0}, {0, -50}, {0, 50}}, Smooth.None), Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.None, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Polygon(true, {0.0, 0.0}, 0, {0, 0, 127}, {0, 0, 127}, LinePattern.Solid, FillPattern.Solid, 0.25, {{0, 50}, {100, 0}, {0, -50}, {0, 50}}, Smooth.None), Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.None, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Polygon(true, {0.0, 0.0}, 0, {0, 0, 127}, {0, 0, 127}, LinePattern.Solid, FillPattern.Solid, 0.25, {{0, 50}, {100, 0}, {0, -50}, {0, 50}}, Smooth.None), Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.None, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Polygon(true, {0.0, 0.0}, 0, {0, 0, 127}, {0, 0, 127}, LinePattern.Solid, FillPattern.Solid, 0.25, {{0, 50}, {100, 0}, {0, -50}, {0, 50}}, Smooth.None), Rectangle(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 255}, LinePattern.Solid, FillPattern.None, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0)}}
// endResult
1 change: 1 addition & 0 deletions openmodelica/interactive-API/Makefile
@@ -1,6 +1,7 @@
TEST = ../../rtest -v

TESTFILES = \
AddClassAnnotation.mos \
ArraySlicing.mos \
Bug2871.mos \
Bug2943.mos \
Expand Down

0 comments on commit 302a8b5

Please sign in to comment.