diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-08-18 13:17:02 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-10 02:12:40 +0200 |
commit | 4389db13ed20a85fbe2d213ddc833b39e572936d (patch) | |
tree | 435fe1a8bb6d3fcf4d521b02854a7c8b5b099169 /oox/qa/unit | |
parent | 33c3c4256c71462350f05d6cdc816d09f550daaf (diff) |
add remaining test from spec for vba compression
That test is testing the case that a sequence can not be compressed at
all.
Change-Id: I98d1065919acc9688d713ea09bf578c325b1f821
Diffstat (limited to 'oox/qa/unit')
-rw-r--r-- | oox/qa/unit/data/vba/reference/spec321.bin | bin | 0 -> 29 bytes | |||
-rw-r--r-- | oox/qa/unit/data/vba/spec321.bin | 1 | ||||
-rw-r--r-- | oox/qa/unit/vba_compression.cxx | 27 |
3 files changed, 27 insertions, 1 deletions
diff --git a/oox/qa/unit/data/vba/reference/spec321.bin b/oox/qa/unit/data/vba/reference/spec321.bin Binary files differnew file mode 100644 index 000000000000..3120c7f501fa --- /dev/null +++ b/oox/qa/unit/data/vba/reference/spec321.bin diff --git a/oox/qa/unit/data/vba/spec321.bin b/oox/qa/unit/data/vba/spec321.bin new file mode 100644 index 000000000000..c5d48c9fc296 --- /dev/null +++ b/oox/qa/unit/data/vba/spec321.bin @@ -0,0 +1 @@ +abcdefghijklmnopqrstuv.
\ No newline at end of file diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index abf2b29ecadd..0247fb9e9ebb 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.1 + void testSpec321(); // section 3.2.2 void testSpec322(); // section 3.2.3 @@ -47,6 +49,7 @@ public: CPPUNIT_TEST(testSimple2); CPPUNIT_TEST(testSimple3); CPPUNIT_TEST(testComplex1); + CPPUNIT_TEST(testSpec321); CPPUNIT_TEST(testSpec322); CPPUNIT_TEST(testSpec323); CPPUNIT_TEST_SUITE_END(); @@ -166,6 +169,28 @@ void TestVbaCompression::testComplex1() } } +void TestVbaCompression::testSpec321() +{ + OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec321.bin"); + OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/spec321.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::testSpec322() { OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/spec322.bin"); @@ -195,7 +220,7 @@ void TestVbaCompression::testSpec323() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); - ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec321.bin"); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec323.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); |