[Libreoffice-commits] libvisio.git: 2 commits - src/lib src/test
David Tardon
dtardon at redhat.com
Tue Nov 29 18:43:42 UTC 2016
src/lib/VSDParser.cpp | 3 ++-
src/test/Makefile.am | 1 +
src/test/data/no-bgcolor.vsd |binary
src/test/importtest.cpp | 8 ++++++++
4 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 079034b8aa1d4b7bd07a81ef46059cdb6b2f4b38
Author: David Tardon <dtardon at redhat.com>
Date: Tue Nov 29 15:22:53 2016 +0100
add test for text block with no bg color
Change-Id: Ic6177cbea568c80d93774a95a3704077db42f62f
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 48ffaa4..54fbf78 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -27,6 +27,7 @@ EXTRA_DIST = \
data/fdo86729-utf8.vsd \
data/dwg.vsd \
data/dwg.vsdx \
+ data/no-bgcolor.vsd \
$(test_SOURCES)
# ImportTest::testVsdMetadataTitleUtf8 checks formatted date string
diff --git a/src/test/data/no-bgcolor.vsd b/src/test/data/no-bgcolor.vsd
new file mode 100644
index 0000000..1bc9c6c
Binary files /dev/null and b/src/test/data/no-bgcolor.vsd differ
diff --git a/src/test/importtest.cpp b/src/test/importtest.cpp
index 32fb185..1cbfc9d 100644
--- a/src/test/importtest.cpp
+++ b/src/test/importtest.cpp
@@ -163,6 +163,7 @@ class ImportTest : public CPPUNIT_NS::TestFixture
#if LIBXML_VERSION >= 20902
CPPUNIT_TEST(testVsdxCharBgColor);
#endif
+ CPPUNIT_TEST(testVsdTextBlockWithoutBgColor);
CPPUNIT_TEST_SUITE_END();
void testVsdxMetadataTitle();
@@ -172,6 +173,7 @@ class ImportTest : public CPPUNIT_NS::TestFixture
void testVsdxUserDefinedMetadata();
void testVsdxImportBgColorFromTheme();
void testVsdxCharBgColor();
+ void testVsdTextBlockWithoutBgColor();
xmlBufferPtr m_buffer;
xmlDocPtr m_doc;
@@ -286,6 +288,12 @@ void ImportTest::testVsdxCharBgColor()
assertXPath(m_doc, "/document/page/layer[3]/textObject/paragraph[2]/span", "background-color", "#9dbb61");
}
+void ImportTest::testVsdTextBlockWithoutBgColor()
+{
+ m_doc = parse("no-bgcolor.vsd", m_buffer);
+ assertXPathNoAttribute(m_doc, "/document/page/layer[5]/textObject/paragraph[1]/span", "background-color");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ImportTest);
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
commit a3cf2c6d02c29e0a69794ead64dd932fa9e3f24b
Author: David Tardon <dtardon at redhat.com>
Date: Tue Nov 29 15:05:20 2016 +0100
fix parsing of text block bg color in some cases
It appears that if the color index is 0xff, no color should be set.
Change-Id: I0dcea16ed5d61292d84e82904b863c1ccafd9d7a
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 26b1d9c..680e14b 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -877,7 +877,8 @@ void libvisio::VSDParser::readTextBlock(librevenge::RVNGInputStream *input)
input->seek(1, librevenge::RVNG_SEEK_CUR);
double bottomMargin = readDouble(input);
unsigned char verticalAlign = readU8(input);
- bool isBgFilled = (!!readU8(input));
+ const unsigned char bgColourIdx = readU8(input);
+ const bool isBgFilled = bgColourIdx != 0 && bgColourIdx != 0xff;
Colour c;
c.r = readU8(input);
c.g = readU8(input);
More information about the Libreoffice-commits
mailing list