src/test/data/office_varient4.vsdx |binary src/test/data/testfile1.vsdx |binary src/test/data/testfile3.vsdx |binary src/test/data/testfile4.vsdx |binary src/test/data/testfile5.vsdx |binary src/test/importtest.cpp | 47 +++++++++++++++++++++++++++++++++++++ 6 files changed, 47 insertions(+)
New commits: commit bc054fcd9de142eaa513ebaf5689e0bc84958f46 Author: Balazs Varga <[email protected]> AuthorDate: Fri Sep 19 16:01:33 2025 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Sep 19 16:54:58 2025 +0200 Related tdf#168475 libvisio: Unit tests for vsdx theme colors Add unit tests after commits: Follow-up of: 6f6165796d4de297fa7b65a5bc18002ff03bfcad Follow-up of: a33deeb4b905ab9bad4caa1c9393ab7af1027f69 Change-Id: I5cd1d074d0b7c0570b4700f2e8ab7858f5cec261 Reviewed-on: https://gerrit.libreoffice.org/c/libvisio/+/191203 Tested-by: Miklos Vajna <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/src/test/data/office_varient4.vsdx b/src/test/data/office_varient4.vsdx new file mode 100644 index 0000000..c31f622 Binary files /dev/null and b/src/test/data/office_varient4.vsdx differ diff --git a/src/test/data/testfile1.vsdx b/src/test/data/testfile1.vsdx new file mode 100644 index 0000000..96e545a Binary files /dev/null and b/src/test/data/testfile1.vsdx differ diff --git a/src/test/data/testfile3.vsdx b/src/test/data/testfile3.vsdx new file mode 100644 index 0000000..4dd6bf8 Binary files /dev/null and b/src/test/data/testfile3.vsdx differ diff --git a/src/test/data/testfile4.vsdx b/src/test/data/testfile4.vsdx new file mode 100644 index 0000000..10b76e4 Binary files /dev/null and b/src/test/data/testfile4.vsdx differ diff --git a/src/test/data/testfile5.vsdx b/src/test/data/testfile5.vsdx new file mode 100644 index 0000000..807da46 Binary files /dev/null and b/src/test/data/testfile5.vsdx differ diff --git a/src/test/importtest.cpp b/src/test/importtest.cpp index 4e0d533..1fb4981 100644 --- a/src/test/importtest.cpp +++ b/src/test/importtest.cpp @@ -228,6 +228,12 @@ class ImportTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testVsdxImportDefaultFillColour); CPPUNIT_TEST(testVsdxQuickStyleFillMatrix); CPPUNIT_TEST(testVsdxQuickStyleFillStyle); + CPPUNIT_TEST(testVsdxFillStylesFromTheme1); + CPPUNIT_TEST(testVsdxFillStylesFromTheme2); + CPPUNIT_TEST(testVsdxFillStylesFromTheme3); + CPPUNIT_TEST(testVsdxFillStylesFromTheme4); + CPPUNIT_TEST(testVsdxFillStylesFromTheme5); + CPPUNIT_TEST_SUITE_END(); void testVsd6Textfields(); @@ -253,6 +259,12 @@ class ImportTest : public CPPUNIT_NS::TestFixture void testVsdxQuickStyleFillMatrix(); void testVsdxQuickStyleFillStyle(); + void testVsdxFillStylesFromTheme1(); + void testVsdxFillStylesFromTheme2(); + void testVsdxFillStylesFromTheme3(); + void testVsdxFillStylesFromTheme4(); + void testVsdxFillStylesFromTheme5(); + xmlBufferPtr m_buffer; xmlDocPtr m_doc; @@ -594,6 +606,41 @@ void ImportTest::testVsdxQuickStyleFillStyle() assertXPath(m_doc, "/document/page/layer[1]//setStyle[2]", "fill-color", "#ffffff"); } +void ImportTest::testVsdxFillStylesFromTheme1() +{ + m_doc = parse("testfile1.vsdx", m_buffer); + assertXPath(m_doc, "/document/page/layer[1]//setStyle[2]", "fill-color", "#000000"); + assertXPath(m_doc, "/document/page/layer[2]//setStyle[2]", "fill-color", "#45b664"); +} + +void ImportTest::testVsdxFillStylesFromTheme2() +{ + m_doc = parse("testfile3.vsdx", m_buffer); + assertXPath(m_doc, "/document/page/layer[1]//setStyle[2]", "fill-color", "#b43500"); + assertXPath(m_doc, "/document/page/layer[2]//setStyle[2]", "fill-color", "#ffc000"); + assertXPath(m_doc, "/document/page/layer[3]//setStyle[2]", "fill-color", "#000000"); + assertXPath(m_doc, "/document/page/layer[4]//setStyle[2]", "fill-color", "#ffffff"); +} + +void ImportTest::testVsdxFillStylesFromTheme3() +{ + m_doc = parse("testfile4.vsdx", m_buffer); + assertXPath(m_doc, "/document/page/layer[1]//setStyle[2]", "fill-color", "#000000"); + assertXPath(m_doc, "/document/page/layer[2]//setStyle[2]", "fill-color", "#ffffff"); +} + +void ImportTest::testVsdxFillStylesFromTheme4() +{ + m_doc = parse("testfile5.vsdx", m_buffer); + assertXPath(m_doc, "/document/page/layer[1]//setStyle[2]", "fill-color", "#ffffff"); +} + +void ImportTest::testVsdxFillStylesFromTheme5() +{ + m_doc = parse("office_varient4.vsdx", m_buffer); + assertXPath(m_doc, "/document/page/layer[1]//setStyle[2]", "fill-color", "#4372c4"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ImportTest); /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
