summaryrefslogtreecommitdiff
path: root/oox/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-08-15 02:57:23 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-09-10 02:12:38 +0200
commitd53ac4d2711c5c1a7639739d34eaeaecc6a53b56 (patch)
tree3edf5118d3d5dda3d80032b2a7f8b5e2db1884ea /oox/qa
parentef1a6c7786eb16690c7d3a4dff86f0effe5a846b (diff)
add complext vba compression test
This is based on my real world test document. Change-Id: I6e6c38aa1ced7fe836a8926c26aa7d488d44e6d9
Diffstat (limited to 'oox/qa')
-rw-r--r--oox/qa/unit/data/vba/complex1.binbin0 -> 1086 bytes
-rw-r--r--oox/qa/unit/data/vba/reference/complex1.binbin0 -> 579 bytes
-rw-r--r--oox/qa/unit/vba_compression.cxx26
3 files changed, 26 insertions, 0 deletions
diff --git a/oox/qa/unit/data/vba/complex1.bin b/oox/qa/unit/data/vba/complex1.bin
new file mode 100644
index 000000000000..3902082903d6
--- /dev/null
+++ b/oox/qa/unit/data/vba/complex1.bin
Binary files differ
diff --git a/oox/qa/unit/data/vba/reference/complex1.bin b/oox/qa/unit/data/vba/reference/complex1.bin
new file mode 100644
index 000000000000..335b8e808e14
--- /dev/null
+++ b/oox/qa/unit/data/vba/reference/complex1.bin
Binary files differ
diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx
index 715a0e4cb089..4519700a1f94 100644
--- a/oox/qa/unit/vba_compression.cxx
+++ b/oox/qa/unit/vba_compression.cxx
@@ -27,6 +27,9 @@ public:
void testSimple3();
+ // real stream from a document
+ void testComplex1();
+
// avoid the BootstrapFixtureBase::setUp and tearDown
virtual void setUp() SAL_OVERRIDE;
virtual void tearDown() SAL_OVERRIDE;
@@ -35,6 +38,7 @@ public:
CPPUNIT_TEST(testSimple1);
CPPUNIT_TEST(testSimple2);
CPPUNIT_TEST(testSimple3);
+ CPPUNIT_TEST(testComplex1);
CPPUNIT_TEST_SUITE_END();
private:
@@ -130,6 +134,28 @@ void TestVbaCompression::testSimple3()
}
}
+void TestVbaCompression::testComplex1()
+{
+ OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/complex1.bin");
+ OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/complex1.bin");
+
+ SvMemoryStream aOutputMemoryStream(4096, 4096);
+ SvMemoryStream aReferenceMemoryStream(4096, 4096);
+ ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_complex1.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()
{
}