summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/CppunitTest_sd_theme_tests.mk78
-rw-r--r--sd/Module_sd.mk1
-rw-r--r--sd/qa/unit/ThemeTest.cxx (renamed from svx/qa/unit/styles.cxx)50
-rw-r--r--sd/qa/unit/data/theme.pptx (renamed from svx/qa/unit/data/theme.pptx)bin30646 -> 30646 bytes
-rw-r--r--svx/CppunitTest_svx_styles.mk50
-rw-r--r--svx/Module_svx.mk1
6 files changed, 105 insertions, 75 deletions
diff --git a/sd/CppunitTest_sd_theme_tests.mk b/sd/CppunitTest_sd_theme_tests.mk
new file mode 100644
index 000000000000..b5f70456dd92
--- /dev/null
+++ b/sd/CppunitTest_sd_theme_tests.mk
@@ -0,0 +1,78 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#*************************************************************************
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#*************************************************************************
+
+$(eval $(call gb_CppunitTest_CppunitTest,sd_theme_tests))
+
+$(eval $(call gb_CppunitTest_use_externals,sd_theme_tests,\
+ boost_headers \
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_use_common_precompiled_header,sd_theme_tests))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sd_theme_tests, \
+ sd/qa/unit/ThemeTest \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sd_theme_tests, \
+ basegfx \
+ comphelper \
+ cppu \
+ cppuhelper \
+ drawinglayer \
+ docmodel \
+ editeng \
+ for \
+ forui \
+ i18nlangtag \
+ sal \
+ salhelper \
+ sax \
+ sd \
+ sfx \
+ sot \
+ subsequenttest \
+ svl \
+ svt \
+ svx \
+ svxcore \
+ test \
+ tl \
+ tk \
+ ucbhelper \
+ unotest \
+ utl \
+ vcl \
+ xo \
+))
+
+$(eval $(call gb_CppunitTest_set_include,sd_theme_tests,\
+ -I$(SRCDIR)/sd/source/ui/inc \
+ -I$(SRCDIR)/sd/inc \
+ $$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sd_theme_tests))
+$(eval $(call gb_CppunitTest_use_ure,sd_theme_tests))
+$(eval $(call gb_CppunitTest_use_vcl,sd_theme_tests))
+$(eval $(call gb_CppunitTest_use_rdb,sd_theme_tests,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,sd_theme_tests,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,sd_theme_tests))
+
+$(eval $(call gb_CppunitTest_add_arguments,sd_theme_tests, \
+ -env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk
index ff09ee8c5ba3..766e5460c90a 100644
--- a/sd/Module_sd.mk
+++ b/sd/Module_sd.mk
@@ -51,6 +51,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sd,\
CppunitTest_sd_shape_import_export_tests \
CppunitTest_sd_a11y \
CppunitTest_sd_textfitting_tests \
+ CppunitTest_sd_theme_tests \
))
endif
diff --git a/svx/qa/unit/styles.cxx b/sd/qa/unit/ThemeTest.cxx
index 93b96eb68ead..98ffd6c1bbab 100644
--- a/svx/qa/unit/styles.cxx
+++ b/sd/qa/unit/ThemeTest.cxx
@@ -7,6 +7,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include "sdmodeltestbase.hxx"
+
#include <test/unoapi_test.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -15,20 +17,26 @@
#include <com/sun/star/text/XTextRange.hpp>
#include <docmodel/uno/UnoComplexColor.hxx>
-using namespace ::com::sun::star;
+#include <svx/unoapi.hxx>
-namespace
-{
-/// Tests for svx/source/styles/ code.
-class Test : public UnoApiTest
+#include <DrawDocShell.hxx>
+#include <unomodel.hxx>
+#include <sdpage.hxx>
+#include <ViewShell.hxx>
+
+using namespace css;
+
+class ThemeTest : public SdModelTestBase
{
public:
- Test()
- : UnoApiTest("svx/qa/unit/data/")
+ ThemeTest()
+ : SdModelTestBase("/sd/qa/unit/data/")
{
}
};
+namespace
+{
/// Get the character color of the first text portion in xShape.
Color GetShapeTextColor(const uno::Reference<text::XTextRange>& xShape)
{
@@ -50,24 +58,31 @@ Color GetShapeFillColor(const uno::Reference<beans::XPropertySet>& xShape)
return nColor;
}
-CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
+} // end anonymous namespace
+
+CPPUNIT_TEST_FIXTURE(ThemeTest, testThemeChange)
{
// Given a document, with a first slide and blue shape text from theme:
loadFromURL(u"theme.pptx");
+
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
// The draw page also contains a group shape to make sure we don't crash on group shapes.
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
uno::Reference<drawing::XShapes> xDrawPageShapes(xDrawPage, uno::UNO_QUERY);
+
uno::Reference<text::XTextRange> xShape(xDrawPageShapes->getByIndex(0), uno::UNO_QUERY);
// Blue.
CPPUNIT_ASSERT_EQUAL(Color(0x4472c4), GetShapeTextColor(xShape));
+
uno::Reference<text::XTextRange> xShape2(xDrawPageShapes->getByIndex(1), uno::UNO_QUERY);
// Blue, lighter.
CPPUNIT_ASSERT_EQUAL(Color(0xb4c7e7), GetShapeTextColor(xShape2));
+
uno::Reference<text::XTextRange> xShape3(xDrawPageShapes->getByIndex(2), uno::UNO_QUERY);
// Blue, darker.
CPPUNIT_ASSERT_EQUAL(Color(0x2f5597), GetShapeTextColor(xShape3));
+
// Shape fill:
uno::Reference<beans::XPropertySet> xShape4(xDrawPageShapes->getByIndex(4), uno::UNO_QUERY);
// Blue.
@@ -81,6 +96,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aComplexColor.getThemeColorType());
}
+
uno::Reference<beans::XPropertySet> xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY);
// Blue, lighter.
CPPUNIT_ASSERT_EQUAL(Color(0xb4c7e7), GetShapeFillColor(xShape5));
@@ -98,41 +114,27 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
aComplexColor.getTransformations()[1].meType);
CPPUNIT_ASSERT_EQUAL(sal_Int16(6000), aComplexColor.getTransformations()[1].mnValue);
}
+
// When changing the master slide of slide 1 to use the theme of the second master slide:
uno::Reference<drawing::XMasterPageTarget> xDrawPage2(
xDrawPagesSupplier->getDrawPages()->getByIndex(1), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xMasterPage2(xDrawPage2->getMasterPage(), uno::UNO_QUERY);
uno::Any aTheme = xMasterPage2->getPropertyValue("Theme");
+
uno::Reference<beans::XPropertySet> xMasterPage(xDrawPage->getMasterPage(), uno::UNO_QUERY);
xMasterPage->setPropertyValue("Theme", aTheme);
// Then make sure the shape text color is now green:
- // Without the accompanying fix in place, this test would have failed with:
- // - Expected: 9486886 (#90c226, green)
- // - Actual : 4485828 (#4472c4, blue)
- // i.e. shape text was not updated on theme change.
CPPUNIT_ASSERT_EQUAL(Color(0x90c226), GetShapeTextColor(xShape));
// Green, lighter:
- // Without the accompanying fix in place, this test would have failed with:
- // - Expected: 14020002 (#d5eda2, light green)
- // - Actual : 9486886 (#90c226, stock green)
- // i.e. the "light" effect on green was not applied.
CPPUNIT_ASSERT_EQUAL(Color(0xd5eda2), GetShapeTextColor(xShape2));
// Green, darker.
CPPUNIT_ASSERT_EQUAL(Color(0x6c911d), GetShapeTextColor(xShape3));
// Shape fill:
- // Without the accompanying fix in place, this test would have failed with:
- // - Expected: 9486886 (#90c226, green)
- // - Actual : 4485828 (#4472c4, blue)
CPPUNIT_ASSERT_EQUAL(Color(0x90c226), GetShapeFillColor(xShape4));
// Green, lighter:
- // Without the accompanying fix in place, this test would have failed with:
- // - Expected: 14020002 (#d5eda2, light green)
- // - Actual : 9486886 (#90c226, green)
- // i.e. the "light" effect on green was not applied.
CPPUNIT_ASSERT_EQUAL(Color(0xd5eda2), GetShapeFillColor(xShape5));
}
-}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/svx/qa/unit/data/theme.pptx b/sd/qa/unit/data/theme.pptx
index 08e4a3b6f130..08e4a3b6f130 100644
--- a/svx/qa/unit/data/theme.pptx
+++ b/sd/qa/unit/data/theme.pptx
Binary files differ
diff --git a/svx/CppunitTest_svx_styles.mk b/svx/CppunitTest_svx_styles.mk
deleted file mode 100644
index 69f6a0953850..000000000000
--- a/svx/CppunitTest_svx_styles.mk
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#*************************************************************************
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-#*************************************************************************
-
-$(eval $(call gb_CppunitTest_CppunitTest,svx_styles))
-
-$(eval $(call gb_CppunitTest_use_externals,svx_styles,\
- boost_headers \
-))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,svx_styles, \
- svx/qa/unit/styles \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,svx_styles, \
- comphelper \
- cppu \
- cppuhelper \
- docmodel \
- editeng \
- svx \
- sal \
- subsequenttest \
- test \
- unotest \
- utl \
- tl \
-))
-
-$(eval $(call gb_CppunitTest_use_sdk_api,svx_styles))
-
-$(eval $(call gb_CppunitTest_use_ure,svx_styles))
-$(eval $(call gb_CppunitTest_use_vcl,svx_styles))
-
-$(eval $(call gb_CppunitTest_use_rdb,svx_styles,services))
-
-$(eval $(call gb_CppunitTest_use_custom_headers,svx_styles,\
- officecfg/registry \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,svx_styles))
-
-# vim: set noet sw=4 ts=4:
diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk
index 40e65bd70d0d..ddf824cdf4bc 100644
--- a/svx/Module_svx.mk
+++ b/svx/Module_svx.mk
@@ -39,7 +39,6 @@ $(eval $(call gb_Module_add_check_targets,svx,\
CppunitTest_svx_unit \
CppunitTest_svx_gallery_test \
CppunitTest_svx_removewhichrange \
- CppunitTest_svx_styles \
CppunitTest_svx_core \
))