summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/VSDParser.cpp4
-rw-r--r--src/test/data/Visio11PlanWithDimensions.pngbin0 -> 25609 bytes
-rw-r--r--src/test/data/Visio11PlanWithDimensions.vsdbin0 -> 224768 bytes
-rw-r--r--src/test/data/Visio5PlanWithDimensions.vsdbin0 -> 73216 bytes
-rw-r--r--src/test/data/Visio5PlanWithDimensions.wmfbin0 -> 35060 bytes
-rw-r--r--src/test/data/Visio6PlanWithDimensions.vsdbin0 -> 91136 bytes
-rw-r--r--src/test/data/Visio6PlanWithDimensions.wmfbin0 -> 40596 bytes
-rw-r--r--src/test/data/Visio6TextFieldsWithUnits.vsdbin37888 -> 30720 bytes
-rw-r--r--src/test/importtest.cpp65
9 files changed, 23 insertions, 46 deletions
diff --git a/src/lib/VSDParser.cpp b/src/lib/VSDParser.cpp
index 0f75fba..6df38b3 100644
--- a/src/lib/VSDParser.cpp
+++ b/src/lib/VSDParser.cpp
@@ -902,12 +902,16 @@ void libvisio::VSDParser::readTextBlock(librevenge::RVNGInputStream *input)
double bottomMargin = readDouble(input);
unsigned char verticalAlign = readU8(input);
const unsigned char bgColourIdx = readU8(input);
+ // The TextBkgnd cell can have any value from 0 through 24, or 255.
+ // The values 0 and 255 (visTxtBlklOpaque) both indicate a transparent text background.
const bool isBgFilled = bgColourIdx != 0 && bgColourIdx != 0xff;
Colour c;
c.r = readU8(input);
c.g = readU8(input);
c.b = readU8(input);
c.a = readU8(input);
+ if (isBgFilled)
+ c = _colourFromIndex(bgColourIdx - 1);
input->seek(1, librevenge::RVNG_SEEK_CUR);
double defaultTabStop = readDouble(input);
input->seek(12, librevenge::RVNG_SEEK_CUR);
diff --git a/src/test/data/Visio11PlanWithDimensions.png b/src/test/data/Visio11PlanWithDimensions.png
new file mode 100644
index 0000000..5926b92
--- /dev/null
+++ b/src/test/data/Visio11PlanWithDimensions.png
Binary files differ
diff --git a/src/test/data/Visio11PlanWithDimensions.vsd b/src/test/data/Visio11PlanWithDimensions.vsd
new file mode 100644
index 0000000..00db8d7
--- /dev/null
+++ b/src/test/data/Visio11PlanWithDimensions.vsd
Binary files differ
diff --git a/src/test/data/Visio5PlanWithDimensions.vsd b/src/test/data/Visio5PlanWithDimensions.vsd
new file mode 100644
index 0000000..c45348f
--- /dev/null
+++ b/src/test/data/Visio5PlanWithDimensions.vsd
Binary files differ
diff --git a/src/test/data/Visio5PlanWithDimensions.wmf b/src/test/data/Visio5PlanWithDimensions.wmf
new file mode 100644
index 0000000..cda1c0c
--- /dev/null
+++ b/src/test/data/Visio5PlanWithDimensions.wmf
Binary files differ
diff --git a/src/test/data/Visio6PlanWithDimensions.vsd b/src/test/data/Visio6PlanWithDimensions.vsd
new file mode 100644
index 0000000..cda70cc
--- /dev/null
+++ b/src/test/data/Visio6PlanWithDimensions.vsd
Binary files differ
diff --git a/src/test/data/Visio6PlanWithDimensions.wmf b/src/test/data/Visio6PlanWithDimensions.wmf
new file mode 100644
index 0000000..2cb797e
--- /dev/null
+++ b/src/test/data/Visio6PlanWithDimensions.wmf
Binary files differ
diff --git a/src/test/data/Visio6TextFieldsWithUnits.vsd b/src/test/data/Visio6TextFieldsWithUnits.vsd
index 463e000..737254f 100644
--- a/src/test/data/Visio6TextFieldsWithUnits.vsd
+++ b/src/test/data/Visio6TextFieldsWithUnits.vsd
Binary files differ
diff --git a/src/test/importtest.cpp b/src/test/importtest.cpp
index 2e1ca86..5bde3c1 100644
--- a/src/test/importtest.cpp
+++ b/src/test/importtest.cpp
@@ -200,6 +200,7 @@ class ImportTest : public CPPUNIT_NS::TestFixture
ImportTest &operator=(const ImportTest &);
CPPUNIT_TEST_SUITE(ImportTest);
+ CPPUNIT_TEST(testVsd6Textfields);
CPPUNIT_TEST(testVsdxMetadataTitle);
CPPUNIT_TEST(testVsdMetadataTitleMs1252);
CPPUNIT_TEST(testVsdMetadataTitleUtf8);
@@ -214,7 +215,6 @@ class ImportTest : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST(testVsdNumericFormat);
CPPUNIT_TEST(testVsdDateTimeFormatting);
CPPUNIT_TEST(testVsd11FormatLine);
- CPPUNIT_TEST(testVsd6TextfieldsWithUnits);
CPPUNIT_TEST(testVsd11TextfieldsWithAngle);
CPPUNIT_TEST(testVsd11TextfieldsWithUnits);
CPPUNIT_TEST(testVsd11DrawingUnitsType);
@@ -225,6 +225,7 @@ class ImportTest : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST(testVsdxQuickStyleFillStyle);
CPPUNIT_TEST_SUITE_END();
+ void testVsd6Textfields();
void testVsdxMetadataTitle();
void testVsdMetadataTitleMs1252();
void testVsdMetadataTitleUtf8();
@@ -237,7 +238,6 @@ class ImportTest : public CPPUNIT_NS::TestFixture
void testVsdNumericFormat();
void testVsd11FormatLine();
void testVsdDateTimeFormatting();
- void testVsd6TextfieldsWithUnits();
void testVsd11TextfieldsWithAngle();
void testVsd11TextfieldsWithUnits();
void testVsd11DrawingUnitsType();
@@ -281,6 +281,23 @@ void ImportTest::tearDown()
m_buffer = 0;
}
+// tdf#126292
+void ImportTest::testVsd6Textfields()
+{
+ m_doc = parse("Visio6PlanWithDimensions.vsd", m_buffer);
+ assertXPathContent(m_doc, "/document/page/layer[2]/textObject/paragraph[2]/span/insertText", "80,00 sq. ft.");
+ assertXPath(m_doc, "/document/page/layer[3]/textObject/paragraph/span[1]", "background-color", "#80c864");
+ assertXPathContent(m_doc, "/document/page/layer[3]/textObject/paragraph/span[1]/insertText", "Bold Custom Color ");
+ assertXPath(m_doc, "/document/page/layer[3]/textObject/paragraph/span[2]", "background-color", "#80c864");
+ assertXPathContent(m_doc, "/document/page/layer[3]/textObject/paragraph/span[2]/insertText", "10'-0\" ");
+ assertXPath(m_doc, "/document/page/layer[4]/textObject/paragraph/span", "background-color", "#ffffff");
+ assertXPathContent(m_doc, "/document/page/layer[4]/textObject/paragraph/span/insertText", "6'-0\"");
+ assertXPath(m_doc, "/document/page/layer[7]/textObject/paragraph/span", "background-color", "#ff00ff");
+ assertXPathContent(m_doc, "/document/page/layer[7]/textObject/paragraph/span/insertText", "Indexed color 5'-0\"");
+ assertXPath(m_doc, "/document/page/layer[8]/textObject/paragraph/span", "background-color", 0);
+ assertXPathContent(m_doc, "/document/page/layer[8]/textObject/paragraph/span/insertText", "Without Background color 10'-0\"");
+}
+
void ImportTest::testVsdxMetadataTitle()
{
m_doc = parse("fdo86664.vsdx", m_buffer);
@@ -439,50 +456,6 @@ void ImportTest::testVsd11TextfieldsWithAngle()
}
// tdf#126292
-void ImportTest::testVsd6TextfieldsWithUnits()
-{
- m_doc = parse("Visio11TextFieldsWithUnits.vsd", m_buffer);
- assertXPathContent(m_doc, "/document/page/textObject[2]/paragraph[1]/span/insertText", "Number1 with unit [cm] 1 cm");
- assertXPathContent(m_doc, "/document/page/textObject[3]/paragraph[1]/span/insertText", "Number 1 with unit [cm] hidden 1");
- assertXPathContent(m_doc, "/document/page/textObject[4]/paragraph[1]/span/insertText", "Number 1 without unit 1");
- assertXPathContent(m_doc, "/document/page/textObject[5]/paragraph[1]/span/insertText[2]", "with unit [mm] 1 mm");
- assertXPathContent(m_doc, "/document/page/textObject[6]/paragraph[1]/span/insertText", "Number 1 with [%] unit 1%");
- assertXPathContent(m_doc, "/document/page/textObject[7]/paragraph[1]/span/insertText", "Number -1 without unit -1");
- assertXPathContent(m_doc, "/document/page/textObject[8]/paragraph[1]/span/insertText", "1 Ciceros 1 c");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[9]/paragraph[1]/span/insertText", "1 (31.12.1899) date without unit 31.12.1899");
- assertXPathContent(m_doc, "/document/page/textObject[10]/paragraph[1]/span/insertText", "1 degrees 1 deg");
- assertXPathContent(m_doc, "/document/page/textObject[11]/paragraph[1]/span/insertText", "1 elapsed week 1 ew.");
- //TODO assertXPathContent(m_doc, "/document/page/textObject[12]/paragraph[1]/span/insertText", "1 Acre 1 acres");
- //TODO assertXPathContent(m_doc, "/document/page/textObject[13]/paragraph[1]/span/insertText", "1 sq. Centimeter 1 cm^2");
- //TODO assertXPathContent(m_doc, "/document/page/textObject[14]/paragraph[1]/span/insertText", "1 sq. hectares 1 ha");
- //TODO assertXPathContent(m_doc, "/document/page/textObject[15]/paragraph[1]/span/insertText", "1 sq inches 1 in^2");
- assertXPathContent(m_doc, "/document/page/textObject[16]/paragraph[1]/span/insertText", "Number 100 with [%] unit 100%");
- assertXPathContent(m_doc, "/document/page/textObject[17]/paragraph[1]/span/insertText", "Didots 1 d");
- //TODO Add check with 1000 didots
- assertXPathContent(m_doc, "/document/page/textObject[18]/paragraph[1]/span/insertText", "Points 1 pt");
- assertXPathContent(m_doc, "/document/page/textObject[19]/paragraph[1]/span/insertText", "Picas 1 p");
- assertXPathContent(m_doc, "/document/page/textObject[20]/paragraph[1]/span/insertText", "Inch 1 in");
- assertXPathContent(m_doc, "/document/page/textObject[21]/paragraph[1]/span/insertText", "Feet 1 ft");
- assertXPathContent(m_doc, "/document/page/textObject[22]/paragraph[1]/span/insertText", "1 elapsed day 1 ed.");
- assertXPathContent(m_doc, "/document/page/textObject[23]/paragraph[1]/span/insertText", "1 kilometer 1 km");
- assertXPathContent(m_doc, "/document/page/textObject[24]/paragraph[1]/span/insertText", "1 radians 1 rad");
- assertXPathContent(m_doc, "/document/page/textObject[25]/paragraph[1]/span/insertText", "1 yard 1 yd");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[26]/paragraph[1]/span/insertText", "1 sq Feet 1 ft^2");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[27]/paragraph[1]/span/insertText", "1 kilometers 1 km^2");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[28]/paragraph[1]/span/insertText", "1 miles 1 mi^2");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[29]/paragraph[1]/span/insertText", "1 Inches in fractions 1,5 in");
- assertXPathContent(m_doc, "/document/page/textObject[30]/paragraph[1]/span/insertText", "1 elapsed hours1 eh. ");
- assertXPathContent(m_doc, "/document/page/textObject[31]/paragraph[1]/span/insertText", "1 el. Minutes 1 em.");
- assertXPathContent(m_doc, "/document/page/textObject[32]/paragraph[1]/span/insertText", "1 el. Sec 1 es.");
- assertXPathContent(m_doc, "/document/page/textObject[33]/paragraph[1]/span/insertText", "1 miles 1 mi");
- assertXPathContent(m_doc, "/document/page/textObject[34]/paragraph[1]/span/insertText", "1 nautical miles 1 nm.");
- assertXPathContent(m_doc, "/document/page/textObject[37]/paragraph[1]/span/insertText", "1000 didots 1000 d");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[38]/paragraph[1]/span/insertText", "1 date with unitout unit 31.12.1899");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[39]/paragraph[1]/span/insertText", "1 date with radians unit 31.12.1899");
- // TODO assertXPathContent(m_doc, "/document/page/textObject[40]/paragraph[1]/span/insertText", "1 date with currency unit zł 1,00");
-}
-
-// tdf#126292
void ImportTest::testVsd11TextfieldsWithUnits()
{
m_doc = parse("Visio11TextFieldsWithUnits.vsd", m_buffer);