diff options
Diffstat (limited to 'oox/qa')
-rw-r--r-- | oox/qa/unit/data/vba/reference/spec322.bin | bin | 0 -> 51 bytes | |||
-rw-r--r-- | oox/qa/unit/data/vba/spec322.bin | 1 | ||||
-rw-r--r-- | oox/qa/unit/vba_compression.cxx | 25 |
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 Binary files differnew file mode 100644 index 000000000000..7724b62a4452 --- /dev/null +++ b/oox/qa/unit/data/vba/reference/spec322.bin 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"); |