summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga@collabora.com>2025-09-19 16:01:33 +0200
committerMiklos Vajna <vmiklos@collabora.com>2025-09-19 16:54:58 +0200
commitbc054fcd9de142eaa513ebaf5689e0bc84958f46 (patch)
tree015fd627d4c13ca132c4c57fc605842803ede3df
parent6f6165796d4de297fa7b65a5bc18002ff03bfcad (diff)
Related tdf#168475 libvisio: Unit tests for vsdx theme colorsHEADmaster
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 <vmiklos@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--src/test/data/office_varient4.vsdxbin0 -> 21225 bytes
-rw-r--r--src/test/data/testfile1.vsdxbin0 -> 43669 bytes
-rw-r--r--src/test/data/testfile3.vsdxbin0 -> 43054 bytes
-rw-r--r--src/test/data/testfile4.vsdxbin0 -> 33175 bytes
-rw-r--r--src/test/data/testfile5.vsdxbin0 -> 20687 bytes
-rw-r--r--src/test/importtest.cpp47
6 files changed, 47 insertions, 0 deletions
diff --git a/src/test/data/office_varient4.vsdx b/src/test/data/office_varient4.vsdx
new file mode 100644
index 0000000..c31f622
--- /dev/null
+++ b/src/test/data/office_varient4.vsdx
Binary files differ
diff --git a/src/test/data/testfile1.vsdx b/src/test/data/testfile1.vsdx
new file mode 100644
index 0000000..96e545a
--- /dev/null
+++ b/src/test/data/testfile1.vsdx
Binary files differ
diff --git a/src/test/data/testfile3.vsdx b/src/test/data/testfile3.vsdx
new file mode 100644
index 0000000..4dd6bf8
--- /dev/null
+++ b/src/test/data/testfile3.vsdx
Binary files differ
diff --git a/src/test/data/testfile4.vsdx b/src/test/data/testfile4.vsdx
new file mode 100644
index 0000000..10b76e4
--- /dev/null
+++ b/src/test/data/testfile4.vsdx
Binary files differ
diff --git a/src/test/data/testfile5.vsdx b/src/test/data/testfile5.vsdx
new file mode 100644
index 0000000..807da46
--- /dev/null
+++ b/src/test/data/testfile5.vsdx
Binary files 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: */