diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-17 22:10:02 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-17 22:15:26 +0100 |
commit | c1ed56802e640b52674c62426b1e7507d09ddbf1 (patch) | |
tree | bfe2540e67ae448abc12cef39e2092fc7595da5c /src | |
parent | c31e6cf3618f40ab4d1ec655e4e6f7c7590834ab (diff) |
VSD: test metadata import
Only title as a start.
Change-Id: Ic7a4cc8ddd1f781466d7a113bf3a925ae112e874
Diffstat (limited to 'src')
-rw-r--r-- | src/test/Makefile.am | 2 | ||||
-rw-r--r-- | src/test/data/fdo86729-ms1252.vsd | bin | 0 -> 39936 bytes | |||
-rw-r--r-- | src/test/data/fdo86729-utf8.vsd | bin | 0 -> 39936 bytes | |||
-rw-r--r-- | src/test/importtest.cpp | 18 |
4 files changed, 20 insertions, 0 deletions
diff --git a/src/test/Makefile.am b/src/test/Makefile.am index d136ecf..9285cbf 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -21,6 +21,8 @@ test_SOURCES = \ EXTRA_DIST = \ data/fdo86664.vsdx \ + data/fdo86729-ms1252.vsd \ + data/fdo86729-utf8.vsd \ $(test_SOURCES) TESTS = test diff --git a/src/test/data/fdo86729-ms1252.vsd b/src/test/data/fdo86729-ms1252.vsd Binary files differnew file mode 100644 index 0000000..d459406 --- /dev/null +++ b/src/test/data/fdo86729-ms1252.vsd diff --git a/src/test/data/fdo86729-utf8.vsd b/src/test/data/fdo86729-utf8.vsd Binary files differnew file mode 100644 index 0000000..06ca155 --- /dev/null +++ b/src/test/data/fdo86729-utf8.vsd diff --git a/src/test/importtest.cpp b/src/test/importtest.cpp index d9100bc..d25380d 100644 --- a/src/test/importtest.cpp +++ b/src/test/importtest.cpp @@ -94,9 +94,13 @@ class ImportTest : public CPPUNIT_NS::TestFixture { CPPUNIT_TEST_SUITE(ImportTest); CPPUNIT_TEST(testVsdxMetadataTitle); + CPPUNIT_TEST(testVsdMetadataTitleMs1252); + CPPUNIT_TEST(testVsdMetadataTitleUtf8); CPPUNIT_TEST_SUITE_END(); void testVsdxMetadataTitle(); + void testVsdMetadataTitleMs1252(); + void testVsdMetadataTitleUtf8(); xmlBufferPtr m_buffer; xmlDocPtr m_doc; @@ -141,6 +145,20 @@ void ImportTest::testVsdxMetadataTitle() assertXPath(m_doc, "/document/setDocumentMetaData", "date", "2014-11-24T10:41:22Z"); } +void ImportTest::testVsdMetadataTitleMs1252() +{ + m_doc = parse("fdo86729-ms1252.vsd", m_buffer); + // Test windows-1252 -> UTF-8 conversion, provided by ICU. + assertXPath(m_doc, "/document/setDocumentMetaData", "title", "mytitle\xC3\xA9\xC3\xA1"); +} + +void ImportTest::testVsdMetadataTitleUtf8() +{ + m_doc = parse("fdo86729-utf8.vsd", m_buffer); + // Test the case when the string is UTF-8 encoded already in the file. + assertXPath(m_doc, "/document/setDocumentMetaData", "title", "mytitle\xC3\xA9\xC3\xA1\xC5\x91\xC5\xB1"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ImportTest); /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ |