Skip to content

Commit

Permalink
fix ticket:5571
Browse files Browse the repository at this point in the history
- give default BitMap(imageSource = "")
- add test, update test
  • Loading branch information
adrpo committed Jul 12, 2019
1 parent ef78cd2 commit 53467af
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/FrontEnd/Constants.mo
Expand Up @@ -350,7 +350,7 @@ record Bitmap
Real extent[2,2]/*(each final unit=\"mm\")*/;
String fileName = \"\" \"Name of bitmap file\";
String imageSource \"Base64 representation of bitmap\";
String imageSource = \"\" \"Base64 representation of bitmap\";
end Bitmap;
// dynamic annotations
Expand Down
1 change: 1 addition & 0 deletions testsuite/openmodelica/interactive-API/Makefile
Expand Up @@ -78,6 +78,7 @@ Ticket4674.mos \
UsesAnnotation1.mos \
Ticket5506.mos \
Ticket5548.mos \
Ticket5571.mos


# test that currently fail. Move up when fixed.
Expand Down
26 changes: 26 additions & 0 deletions testsuite/openmodelica/interactive-API/Ticket5571.mos
@@ -0,0 +1,26 @@
// name: Ticket5571.mos
// keywords: test fix for but 5571
// status: correct
//
//


loadModel(Modelica, {"3.2.3"});
getErrorString();
getIconAnnotation(Modelica.Mechanics.MultiBody.Examples.Loops.Utilities.EngineV6_analytic);
getErrorString();
setCommandLineOptions("-d=nfAPI");
getErrorString();
getIconAnnotation(Modelica.Mechanics.MultiBody.Examples.Loops.Utilities.EngineV6_analytic);
getErrorString();

// Result:
// true
// ""
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 0}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-150, 145}, {150, 105}}, "%name", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Bitmap(true, {0.0, 0.0}, 0, {{-97, -39}, {99, 75}}, "modelica://Modelica/Resources/Images/Mechanics/MultiBody/Examples/Loops/EngineV6_CAD.png", "")}}
// ""
// true
// ""
// {-100.0,-100.0,100.0,100.0,true,0.1,2.0,2.0, {Rectangle(true, {0.0, 0.0}, 0.0, {0, 0, 0}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-100.0, 100.0}, {100.0, -100.0}}, 0.0), Text(true, {0.0, 0.0}, 0.0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-150.0, 145.0}, {150.0, 105.0}}, "%name", 0.0, {-1, -1, -1}, "", {}, TextAlignment.Center), Bitmap(true, {0.0, 0.0}, 0.0, {{-97.0, -39.0}, {99.0, 75.0}}, "modelica://Modelica/Resources/Images/Mechanics/MultiBody/Examples/Loops/EngineV6_CAD.png", "")}}
// ""
// endResult
Expand Up @@ -20712,7 +20712,7 @@ getDocumentationAnnotation(Modelica.UsersGuide.Contact); getErrorString();
// Evaluating: getErrorString()
// ""
// Evaluating: getIconAnnotation(Modelica.Mechanics.MultiBody.Examples.Loops.Utilities.EngineV6_analytic)
// {-100.0,-100.0,100.0,100.0,true,0.1,1.0,1.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 0}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-137, 160}, {137, 104}}, "%name", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Bitmap(true, {0.0, 0.0}, 0, {{-97, 75}, {99, -39}}, "../../../../Images/MultiBody/Examples/Loops/EngineV6_CAD.png")}}
// {-100.0,-100.0,100.0,100.0,true,0.1,1.0,1.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 0}, {255, 255, 255}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-100, 100}, {100, -100}}, 0), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-137, 160}, {137, 104}}, "%name", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Bitmap(true, {0.0, 0.0}, 0, {{-97, 75}, {99, -39}}, "../../../../Images/MultiBody/Examples/Loops/EngineV6_CAD.png", "")}}
// Evaluating: getErrorString()
// ""
// Evaluating: getDiagramAnnotation(Modelica.Mechanics.MultiBody.Examples.Loops.Utilities.EngineV6_analytic)
Expand Down Expand Up @@ -20781,7 +20781,7 @@ getDocumentationAnnotation(Modelica.UsersGuide.Contact); getErrorString();
// Evaluating: getErrorString()
// ""
// Evaluating: getIconAnnotation(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.fullRobot)
// {-100.0,-100.0,100.0,100.0,true,0.1,0.5,0.5,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 0}, {192, 192, 192}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-99.5, 100.0}, {100.0, -100.0}}, 0), Bitmap(true, {0.0, 0.0}, 0, {{-75.5, 98.25}, {87.0, -96.75}}, "../../../../Images/MultiBody/Examples/Systems/robot_kr15.bmp"), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-111.5, 130.0}, {108.5, 100.0}}, "%name", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 0}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-104.5, -104.0}, {115.0, -128.0}}, "mLoad=%mLoad", 0, {-1, -1, -1}, "", {}, TextAlignment.Center)}}
// {-100.0,-100.0,100.0,100.0,true,0.1,0.5,0.5,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 0}, {192, 192, 192}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-99.5, 100.0}, {100.0, -100.0}}, 0), Bitmap(true, {0.0, 0.0}, 0, {{-75.5, 98.25}, {87.0, -96.75}}, "../../../../Images/MultiBody/Examples/Systems/robot_kr15.bmp", ""), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-111.5, 130.0}, {108.5, 100.0}}, "%name", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 0}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-104.5, -104.0}, {115.0, -128.0}}, "mLoad=%mLoad", 0, {-1, -1, -1}, "", {}, TextAlignment.Center)}}
// Evaluating: getErrorString()
// ""
// Evaluating: getDiagramAnnotation(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.fullRobot)
Expand Down Expand Up @@ -21050,7 +21050,7 @@ getDocumentationAnnotation(Modelica.UsersGuide.Contact); getErrorString();
// Evaluating: getErrorString()
// ""
// Evaluating: getIconAnnotation(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.Components.MechanicalStructure)
// {-200.0,-200.0,200.0,200.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 0}, {192, 192, 192}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-200, 200}, {200, -200}}, 0), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, 280}, {200, 200}}, "%name", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, -150}, {-140, -190}}, "1", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, -30}, {-140, -70}}, "3", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, -90}, {-140, -130}}, "2", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, 90}, {-140, 50}}, "5", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, 28}, {-140, -12}}, "4", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-198, 150}, {-138, 110}}, "6", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Bitmap(true, {0.0, 0.0}, 0, {{-130, 195}, {195, -195}}, "../../../../Images/MultiBody/Examples/Systems/robot_kr15.bmp")}}
// {-200.0,-200.0,200.0,200.0,true,0.1,2.0,2.0,{Rectangle(true, {0.0, 0.0}, 0, {0, 0, 0}, {192, 192, 192}, LinePattern.Solid, FillPattern.Solid, 0.25, BorderPattern.None, {{-200, 200}, {200, -200}}, 0), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, 280}, {200, 200}}, "%name", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, -150}, {-140, -190}}, "1", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, -30}, {-140, -70}}, "3", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, -90}, {-140, -130}}, "2", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, 90}, {-140, 50}}, "5", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-200, 28}, {-140, -12}}, "4", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Text(true, {0.0, 0.0}, 0, {0, 0, 255}, {0, 0, 0}, LinePattern.Solid, FillPattern.None, 0.25, {{-198, 150}, {-138, 110}}, "6", 0, {-1, -1, -1}, "", {}, TextAlignment.Center), Bitmap(true, {0.0, 0.0}, 0, {{-130, 195}, {195, -195}}, "../../../../Images/MultiBody/Examples/Systems/robot_kr15.bmp", "")}}
// Evaluating: getErrorString()
// ""
// Evaluating: getDiagramAnnotation(Modelica.Mechanics.MultiBody.Examples.Systems.RobotR3.Components.MechanicalStructure)
Expand Down

0 comments on commit 53467af

Please sign in to comment.