Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / extras / ooxmlexport / ooxml_ThemeExport.cxx
blobf9e7155859ea61053979101aeaa1d23d3bc12516
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <swmodeltestbase.hxx>
11 #include <o3tl/string_view.hxx>
12 #include <docmodel/uno/UnoComplexColor.hxx>
13 #include <docmodel/color/ComplexColor.hxx>
15 class Test : public SwModelTestBase
17 public:
18 Test()
19 : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open XML Text")
24 DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_ODF,
25 "Test_ThemePortionLevel_CharColor.fodt", nullptr, Test)
27 auto xParagraph = getParagraph(1);
28 CPPUNIT_ASSERT(xParagraph.is());
29 auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>(getRun(xParagraph, 1),
30 "CharComplexColor");
31 auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
32 CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType());
33 auto const& rTransforms = aComplexColor.getTransformations();
34 CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
35 CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType);
36 CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
39 DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_DOCX,
40 "Test_ThemePortionLevel_CharColor.docx", nullptr, Test)
42 auto xParagraph = getParagraph(1);
43 CPPUNIT_ASSERT(xParagraph.is());
44 auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>(getRun(xParagraph, 1),
45 "CharComplexColor");
46 auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
47 CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType());
48 auto const& rTransforms = aComplexColor.getTransformations();
49 CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
50 CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType);
51 CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
54 DECLARE_SW_ROUNDTRIP_TEST(testThemePortionBorderColor_DOCX, "Test_ThemeBorderColor.docx", nullptr,
55 Test)
57 auto xParagraph = getParagraph(1);
58 CPPUNIT_ASSERT(xParagraph.is());
60 auto xComplexColor
61 = getProperty<uno::Reference<util::XComplexColor>>(xParagraph, "TopBorderComplexColor");
62 auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
63 CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent2, aComplexColor.getSchemeType());
64 auto const& rTransforms = aComplexColor.getTransformations();
65 CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
66 CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType);
67 CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
70 auto xComplexColor = getProperty<uno::Reference<util::XComplexColor>>(
71 xParagraph, "BottomBorderComplexColor");
72 auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
73 CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent4, aComplexColor.getSchemeType());
74 auto const& rTransforms = aComplexColor.getTransformations();
75 CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
76 CPPUNIT_ASSERT_EQUAL(model::TransformationType::Tint, rTransforms[0].meType);
77 CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
80 CPPUNIT_ASSERT(isPropertyVoid(xParagraph, "LeftBorderComplexColor"));
81 CPPUNIT_ASSERT(isPropertyVoid(xParagraph, "RightBorderComplexColor"));
84 DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, "Test_CharUnderlineThemeColor.docx", nullptr,
85 Test)
87 auto xParagraph = getParagraph(1);
88 CPPUNIT_ASSERT(xParagraph.is());
89 auto xRun = getRun(xParagraph, 1);
90 auto xComplexColor
91 = getProperty<uno::Reference<util::XComplexColor>>(xRun, "CharUnderlineComplexColor");
92 auto aComplexColor = model::color::getFromXComplexColor(xComplexColor);
93 CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent1, aComplexColor.getSchemeType());
94 auto const& rTransforms = aComplexColor.getTransformations();
95 CPPUNIT_ASSERT_EQUAL(size_t(1), rTransforms.size());
96 CPPUNIT_ASSERT_EQUAL(model::TransformationType::Shade, rTransforms[0].meType);
97 CPPUNIT_ASSERT_EQUAL(sal_Int16(2509), rTransforms[0].mnValue);
100 CPPUNIT_PLUGIN_IMPLEMENT();
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */