summaryrefslogtreecommitdiff
path: root/oox/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-08-18 03:27:09 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-09-10 02:12:40 +0200
commit33c3c4256c71462350f05d6cdc816d09f550daaf (patch)
treeff9ef08e8398ccca7a8e33cd2525ddaa9f85ee84 /oox/qa
parent25bd36c63503c9461933032625808e1e197606d2 (diff)
add another test from the VBA spec for the compression code
Change-Id: I5368e30bbb383621153c31ae8705cff6df7dad90
Diffstat (limited to 'oox/qa')
-rw-r--r--oox/qa/unit/data/vba/reference/spec322.binbin0 -> 51 bytes
-rw-r--r--oox/qa/unit/data/vba/spec322.bin1
-rw-r--r--oox/qa/unit/vba_compression.cxx25
3 files changed, 26 insertions, 0 deletions
diff --git a/oox/qa/unit/data/vba/reference/spec322.bin b/oox/qa/unit/data/vba/reference/spec322.bin
new file mode 100644
index 000000000000..7724b62a4452
--- /dev/null
+++ b/oox/qa/unit/data/vba/reference/spec322.bin
Binary files differ
diff --git a/oox/qa/unit/data/vba/spec322.bin b/oox/qa/unit/data/vba/spec322.bin
new file mode 100644
index 000000000000..781c426c0ae3
--- /dev/null
+++ b/oox/qa/unit/data/vba/spec322.bin
@@ -0,0 +1 @@
+#aaabcdefaaaaghijaaaaaklaaamnopqaaaaaaaaaaaarstuvwxyzaaa \ No newline at end of file
diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx
index 79d394ba0f5f..abf2b29ecadd 100644
--- a/oox/qa/unit/vba_compression.cxx
+++ b/oox/qa/unit/vba_compression.cxx
@@ -33,6 +33,8 @@ public:
// tests taken from the VBA specification
// section 3.2
+ // section 3.2.2
+ void testSpec322();
// section 3.2.3
void testSpec323();
@@ -45,6 +47,7 @@ public:
CPPUNIT_TEST(testSimple2);
CPPUNIT_TEST(testSimple3);
CPPUNIT_TEST(testComplex1);
+ CPPUNIT_TEST(testSpec322);
CPPUNIT_TEST(testSpec323);
CPPUNIT_TEST_SUITE_END();
@@ -163,6 +166,28 @@ void TestVbaCompression::testComplex1()
}
}
+void TestVbaCompression::testSpec322()
+{
+ OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec322.bin");
+ OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/spec322.bin");
+
+ SvMemoryStream aOutputMemoryStream(4096, 4096);
+ SvMemoryStream aReferenceMemoryStream(4096, 4096);
+ ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec322.bin");
+
+ CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize());
+
+ const sal_uInt8* pReferenceData = (const sal_uInt8*) aReferenceMemoryStream.GetData();
+ const sal_uInt8* pData = (const sal_uInt8*)aOutputMemoryStream.GetData();
+
+ size_t nSize = std::min(aReferenceMemoryStream.GetSize(),
+ aOutputMemoryStream.GetSize());
+ for (size_t i = 0; i < nSize; ++i)
+ {
+ CPPUNIT_ASSERT_EQUAL((int)pReferenceData[i], (int)pData[i]);
+ }
+}
+
void TestVbaCompression::testSpec323()
{
OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec323.bin");