Skip to content
Snippets Groups Projects
Commit 64da7945 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

fixed state xml reader test

parent cf2347c8
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="utf-8"?>
<State version="1.0" name="RootStateName" uuid="09F54A1A-3A29-4560-B20C-299069288823" width="500" height="456">
<Description>Test description
Line 2</Description>
<InputParameters>
<Parameter name="InputParameter1Name" type="string" optional="no">
<Description>Input Parameter 1 Description</Description>
<DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"DefaultValue"}}'/>
</Parameter><Parameter name="InputParameter2Name" type="float" optional="yes">
<DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::FloatVariantData","value":13.36999988555908}}'/>
</Parameter>
</InputParameters>
<OutputParameters>
<Parameter name="OutputParameter1Name" type="string" optional="yes"/>
</OutputParameters>
<LocalParameters>
<Parameter name="LocalParameter1Name" type="int" optional="no">
<DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::IntVariantData","value":1}}'/>
<DefaultValue profile="TestProfileA" value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::IntVariantData","value":2}}'/>
</Parameter>
</LocalParameters>
<Substates>
<EndState name="EndSubstateName" event="Success" left="160" top="150" boundingSquareSize="50"/>
<LocalState name="LocalSubstateName" refuuid="CF3662A8-9234-46BD-82C1-856344108823" left="160" top="150" boundingSquareSize="50"/>
<RemoteState name="RemoteSubstateName" refuuid="148C7D1D-1DB4-4A67-893F-D22D36A88823" proxyName="RemoteSubstateProxyName" left="160" top="150" boundingSquareSize="50"/>
</Substates>
<Events>
<Event name="Success">
<Description>Event Description</Description>
</Event>
<Event name="Failure"/>
</Events>
<StartState substateName="LocalSubstateName">
<ParameterMappings>
<ParameterMapping sourceType="Parent" from="StartParameterMapping1SourceKey" to="StartParameterMapping1DestinationKey"/>
<ParameterMapping sourceType="Output" from="StartParameterMapping2SourceKey" to="StartParameterMapping2DestinationKey"/>
</ParameterMappings>
</StartState>
<Transitions>
<Transition from="LocalSubstateName" to="RemoteSubstateName" eventName="Transition1EventName">
<ParameterMappings>
<ParameterMapping sourceType="Event" from="Transition1ParameterMappingSourceKey" to="Transition1ParameterMappingDestinationKey"/>
</ParameterMappings>
<SupportPoints>
<SupportPoint posX="12" posY="34"/>
<SupportPoint posX="56" posY="78"/>
</SupportPoints>
</Transition>
<Transition from="RemoteSubstateName" to="EndSubstateName" eventName="Transition2EventName">
<ParameterMappings/>
<SupportPoints/>
</Transition>
</Transitions>
</State>
......@@ -32,6 +32,7 @@
#include "../../StatechartViewerPlugin/model/stateinstance/RemoteState.h"
#include <ArmarXCore/core/ArmarXManager.h>
#include <ArmarXCore/core/system/cmake/CMakePackageFinder.h>
#include <ArmarXCore/observers/variant/VariantContainer.h>
......@@ -46,62 +47,10 @@ BOOST_AUTO_TEST_CASE(testParseXml)
armarx::ArmarXManager::RegisterKnownObjectFactoriesWithIce(ic);
//at this point, maybe just read from a file?..
QString xmlInput =
R"xml(<?xml version="1.0" encoding="utf-8"?>
<State version="1.0" name="RootStateName" uuid="09F54A1A-3A29-4560-B20C-299069288823" width="500" height="456">
<Description>Test description
Line 2</Description>
<InputParameters>
<Parameter name="InputParameter1Name" type="string" optional="no">
<Description>Input Parameter 1 Description</Description>
<DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"DefaultValue"}}'/>
</Parameter><Parameter name="InputParameter2Name" type="float" optional="yes">
<DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::FloatVariantData","value":13.36999988555908}}'/>
</Parameter>
</InputParameters>
<OutputParameters>
<Parameter name="OutputParameter1Name" type="string" optional="yes"/>
</OutputParameters>
<LocalParameters>
<Parameter name="LocalParameter1Name" type="int" optional="no">
<DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::IntVariantData","value":1}}'/>
<DefaultValue profile="TestProfileA" value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::IntVariantData","value":2}}'/>
</Parameter>
</LocalParameters>
<Substates>
<EndState name="EndSubstateName" event="Success" left="160" top="150" boundingSquareSize="50"/>
<LocalState name="LocalSubstateName" refuuid="CF3662A8-9234-46BD-82C1-856344108823" left="160" top="150" boundingSquareSize="50"/>
<RemoteState name="RemoteSubstateName" refuuid="148C7D1D-1DB4-4A67-893F-D22D36A88823" proxyName="RemoteSubstateProxyName" left="160" top="150" boundingSquareSize="50"/>
</Substates>
<Events>
<Event name="Success">
<Description>Event Description</Description>
</Event>
<Event name="Failure"/>
</Events>
<StartState substateName="LocalSubstateName">
<ParameterMappings>
<ParameterMapping sourceType="Parent" from="StartParameterMapping1SourceKey" to="StartParameterMapping1DestinationKey"/>
<ParameterMapping sourceType="Output" from="StartParameterMapping2SourceKey" to="StartParameterMapping2DestinationKey"/>
</ParameterMappings>
</StartState>
<Transitions>
<Transition from="LocalSubstateName" to="RemoteSubstateName" eventName="Transition1EventName">
<ParameterMappings>
<ParameterMapping sourceType="Event" from="Transition1ParameterMappingSourceKey" to="Transition1ParameterMappingDestinationKey"/>
</ParameterMappings>
<SupportPoints>
<SupportPoint posX="12" posY="34"/>
<SupportPoint posX="56" posY="78"/>
</SupportPoints>
</Transition>
<Transition from="RemoteSubstateName" to="EndSubstateName" eventName="Transition2EventName">
<ParameterMappings/>
<SupportPoints/>
</Transition>
</Transitions>
</State>)xml";
armarx::CMakePackageFinder finder("ArmarXGui");
armarx::ArmarXDataPath::addDataPaths(finder.getDataDir());
QString xmlInput = armarx::RapidXmlReader::ReadFileContents("ArmarXGui/Teststate.xml").c_str();
XmlReader xmlReader(ic);
xmlReader.parseXml(xmlInput);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment