summaryrefslogtreecommitdiff
path: root/oox/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-08-18 00:32:00 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-09-10 02:12:40 +0200
commit25bd36c63503c9461933032625808e1e197606d2 (patch)
treefa13c226c0aae818dd812b51feb55ce2c736a8e7 /oox/qa
parentcb2fadd35e2834a16c93c677fb3d0b2a39adb738 (diff)
add test from the VBA spec for the compression algorithm
Change-Id: I41d5aca8940e34b41e2cc70a72b6e076707bfac6
Diffstat (limited to 'oox/qa')
-rw-r--r--oox/qa/unit/data/vba/reference/spec323.binbin0 -> 7 bytes
-rw-r--r--oox/qa/unit/data/vba/spec323.bin1
-rw-r--r--oox/qa/unit/vba_compression.cxx29
3 files changed, 30 insertions, 0 deletions
diff --git a/oox/qa/unit/data/vba/reference/spec323.bin b/oox/qa/unit/data/vba/reference/spec323.bin
new file mode 100644
index 000000000000..51104ee0b4a2
--- /dev/null
+++ b/oox/qa/unit/data/vba/reference/spec323.bin
Binary files differ
diff --git a/oox/qa/unit/data/vba/spec323.bin b/oox/qa/unit/data/vba/spec323.bin
new file mode 100644
index 000000000000..9ca58b98a71d
--- /dev/null
+++ b/oox/qa/unit/data/vba/spec323.bin
@@ -0,0 +1 @@
+aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ No newline at end of file
diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx
index 4519700a1f94..79d394ba0f5f 100644
--- a/oox/qa/unit/vba_compression.cxx
+++ b/oox/qa/unit/vba_compression.cxx
@@ -30,6 +30,12 @@ public:
// real stream from a document
void testComplex1();
+ // tests taken from the VBA specification
+ // section 3.2
+
+ // section 3.2.3
+ void testSpec323();
+
// avoid the BootstrapFixtureBase::setUp and tearDown
virtual void setUp() SAL_OVERRIDE;
virtual void tearDown() SAL_OVERRIDE;
@@ -39,6 +45,7 @@ public:
CPPUNIT_TEST(testSimple2);
CPPUNIT_TEST(testSimple3);
CPPUNIT_TEST(testComplex1);
+ CPPUNIT_TEST(testSpec323);
CPPUNIT_TEST_SUITE_END();
private:
@@ -156,6 +163,28 @@ void TestVbaCompression::testComplex1()
}
}
+void TestVbaCompression::testSpec323()
+{
+ OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec323.bin");
+ OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/spec323.bin");
+
+ SvMemoryStream aOutputMemoryStream(4096, 4096);
+ SvMemoryStream aReferenceMemoryStream(4096, 4096);
+ ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec321.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::setUp()
{
}