diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-01-23 09:50:28 +0100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-03-04 12:30:13 +0100 |
commit | 2e77a44ea1ea810b598907bffeba0e7ac3a93161 (patch) | |
tree | 87404ab98b231c83e3145fd79017aff2c60c0ffe | |
parent | f08c5964f6c2143a28969f10dcc1269cfcb7e64a (diff) |
Update WidgetDefinitionTest for RadioButton and button value
Change-Id: I04fde55661f81d3d230cda3eb5cc2dcec72a1309
Reviewed-on: https://gerrit.libreoffice.org/68655
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx | 53 | ||||
-rw-r--r-- | vcl/qa/cppunit/widgetdraw/data/definition1.xml | 110 |
2 files changed, 111 insertions, 52 deletions
diff --git a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx index e58770706535..d6dad8dca74a 100644 --- a/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx +++ b/vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx @@ -37,19 +37,52 @@ public: void WidgetDefinitionReaderTest::testRead() { - vcl::WidgetDefinitionReader aWidgetDefinitionReader(getFullUrl("definition1.xml")); + vcl::WidgetDefinitionReader aReader(getFullUrl("definition1.xml")); - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aWidgetDefinitionReader.maFaceColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("000000"), - aWidgetDefinitionReader.maCheckedColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("000000"), aWidgetDefinitionReader.maLightColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("000000"), aReader.maFaceColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("000000"), aReader.maCheckedColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("000000"), aReader.maLightColor.AsRGBHexString()); - aWidgetDefinitionReader.read(); + aReader.read(); - CPPUNIT_ASSERT_EQUAL(OUString("f7f7f7"), aWidgetDefinitionReader.maFaceColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("c0c0c0"), - aWidgetDefinitionReader.maCheckedColor.AsRGBHexString()); - CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aWidgetDefinitionReader.maLightColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("123456"), aReader.maFaceColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("234567"), aReader.maCheckedColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("345678"), aReader.maLightColor.AsRGBHexString()); + + CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aReader.maVisitedLinkColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aReader.maToolTextColor.AsRGBHexString()); + CPPUNIT_ASSERT_EQUAL(OUString("ffffff"), aReader.maFontColor.AsRGBHexString()); + + { + std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates + = aReader.getPushButtonDefinition(ControlPart::Entire) + ->getStates(ControlState::DEFAULT | ControlState::ENABLED + | ControlState::ROLLOVER, + ImplControlValue()); + + CPPUNIT_ASSERT_EQUAL(size_t(2), aStates.size()); + + CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpDrawCommands.size()); + CPPUNIT_ASSERT_EQUAL(vcl::DrawCommandType::RECTANGLE, + aStates[0]->mpDrawCommands[0]->maType); + CPPUNIT_ASSERT_EQUAL(vcl::DrawCommandType::CIRCLE, aStates[0]->mpDrawCommands[1]->maType); + } + + { + std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates + = aReader.getRadioButtonDefinition(ControlPart::Entire) + ->getStates(ControlState::NONE, ImplControlValue(ButtonValue::On)); + CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); + CPPUNIT_ASSERT_EQUAL(size_t(2), aStates[0]->mpDrawCommands.size()); + } + + { + std::vector<std::shared_ptr<vcl::WidgetDefinitionState>> aStates + = aReader.getRadioButtonDefinition(ControlPart::Entire) + ->getStates(ControlState::NONE, ImplControlValue(ButtonValue::Off)); + CPPUNIT_ASSERT_EQUAL(size_t(1), aStates.size()); + CPPUNIT_ASSERT_EQUAL(size_t(1), aStates[0]->mpDrawCommands.size()); + } } } // namespace diff --git a/vcl/qa/cppunit/widgetdraw/data/definition1.xml b/vcl/qa/cppunit/widgetdraw/data/definition1.xml index 0dd3a94f38b7..4fb1c4230853 100644 --- a/vcl/qa/cppunit/widgetdraw/data/definition1.xml +++ b/vcl/qa/cppunit/widgetdraw/data/definition1.xml @@ -1,56 +1,82 @@ <?xml version="1.0" encoding="UTF-8"?> - <widgets> <style> - <faceColor value="#F7F7F7"/> - <checkedColor value="#C0C0C0"/> - <lightColor value="#FFFFFF"/> - <lightBorderColor value="#F7F7F7"/> - <shadowColor value="#808080"/> - <darkShadowColor value="#000000"/> - <buttonTextColor value="#000000"/> - <buttonRolloverTextColor value="#000000"/> - <radioCheckTextColor value="#000000"/> - <groupTextColor value="#000000"/> - <labelTextColor value="#000000"/> + <faceColor value="#123456"/> + <checkedColor value="#234567"/> + <lightColor value="#345678"/> + <lightBorderColor value="#FFFFFF"/> + <shadowColor value="#FFFFFF"/> + <darkShadowColor value="#FFFFFF"/> + <buttonTextColor value="#FFFFFF"/> + <buttonRolloverTextColor value="#FFFFFF"/> + <radioCheckTextColor value="#FFFFFF"/> + <groupTextColor value="#FFFFFF"/> + <labelTextColor value="#FFFFFF"/> <windowColor value="#FFFFFF"/> - <windowTextColor value="#000000"/> + <windowTextColor value="#FFFFFF"/> <dialogColor value="#FFFFFF"/> - <dialogTextColor value="#000000"/> - <workspaceColor value="#F7F7F7"/> - <monoColor value="#000000"/> + <dialogTextColor value="#FFFFFF"/> + <workspaceColor value="#FFFFFF"/> + <monoColor value="#FFFFFF"/> <fieldColor value="#FFFFFF"/> - <fieldTextColor value="#000000"/> - <fieldRolloverTextColor value="#000000"/> - <activeColor value="#0B87E7"/> + <fieldTextColor value="#FFFFFF"/> + <fieldRolloverTextColor value="#FFFFFF"/> + <activeColor value="#FFFFFF"/> <activeTextColor value="#FFFFFF"/> - <activeBorderColor value="#C0C0C0"/> - <deactiveColor value="#808080"/> - <deactiveTextColor value="#C0C0C0"/> - <deactiveBorderColor value="#C0C0C0"/> + <activeBorderColor value="#FFFFFF"/> + <deactiveColor value="#FFFFFF"/> + <deactiveTextColor value="#FFFFFF"/> + <deactiveBorderColor value="#FFFFFF"/> <menuColor value="#FFFFFF"/> <menuBarColor value="#FFFFFF"/> - <menuBarRolloverColor value="#0B87E7"/> - <menuBorderColor value="#C0C0C0"/> - <menuTextColor value="#000000"/> - <menuBarTextColor value="#000000"/> - <menuBarRolloverTextColor value="#000000"/> - <menuBarHighlightTextColor value="#000000"/> - <menuHighlightColor value="#0B87E7"/> + <menuBarRolloverColor value="#FFFFFF"/> + <menuBorderColor value="#FFFFFF"/> + <menuTextColor value="#FFFFFF"/> + <menuBarTextColor value="#FFFFFF"/> + <menuBarRolloverTextColor value="#FFFFFF"/> + <menuBarHighlightTextColor value="#FFFFFF"/> + <menuHighlightColor value="#FFFFFF"/> <menuHighlightTextColor value="#FFFFFF"/> - <highlightColor value="#0B87E7"/> + <highlightColor value="#FFFFFF"/> <highlightTextColor value="#FFFFFF"/> <activeTabColor value="#FFFFFF"/> - <inactiveTabColor value="#C0C0C0"/> - <tabTextColor value="#000000"/> - <tabRolloverTextColor value="#000000"/> - <tabHighlightTextColor value="#000000"/> - <disableColor value="#808080"/> - <helpColor value="#FFFFE0"/> - <helpTextColor value="#000000"/> - <linkColor value="#0B87E7"/> - <visitedLinkColor value="#0464AA"/> - <toolTextColor value="#000000"/> - <fontColor value="#000000"/> + <inactiveTabColor value="#FFFFFF"/> + <tabTextColor value="#FFFFFF"/> + <tabRolloverTextColor value="#FFFFFF"/> + <tabHighlightTextColor value="#FFFFFF"/> + <disableColor value="#FFFFFF"/> + <helpColor value="#FFFFFF"/> + <helpTextColor value="#FFFFFF"/> + <linkColor value="#FFFFFF"/> + <visitedLinkColor value="#FFFFFF"/> + <toolTextColor value="#FFFFFF"/> + <fontColor value="#FFFFFF"/> </style> + <pushbutton> + <part value="Entire"> + <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any"> + <rect stroke="#808080" fill="#FFFFFF" stroke-width="1.0" rx="5" ry="5" margin="1"/> + <circ stroke="#808080" fill="#808080" stroke-width="1.0" margin="1"/> + </state> + <state enabled="true" focused="any" pressed="any" rollover="true" default="true" selected="any" button-value="any"> + <rect stroke="#808080" fill="#808080" stroke-width="1.0" rx="5" ry="5" margin="1"/> + </state> + </part> + <part value="Focus"> + <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="any"> + <rect stroke="#808080" fill="#FFFFFF" stroke-width="1.0" rx="5" ry="5" margin="1"/> + </state> + </part> + </pushbutton> + <radiobutton> + <part value="Entire"> + <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="false"> + <circ stroke="#007AFF" fill="#FFFFFF" stroke-width="1" margin="0"/> + </state> + <state enabled="any" focused="any" pressed="any" rollover="any" default="any" selected="any" button-value="true"> + <circ stroke="#007AFF" fill="#FFFFFF" stroke-width="1" margin="0"/> + <circ stroke="#007AFF" fill="#007AFF" stroke-width="1" margin="3"/> + </state> + </part> + </radiobutton> </widgets> |