diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-08-15 02:42:28 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-10 02:12:38 +0200 |
commit | ef1a6c7786eb16690c7d3a4dff86f0effe5a846b (patch) | |
tree | b7557b3429d8d5f13cec2f676daf31ffaedf01b7 /oox | |
parent | 6917cd98ca6b6fd2d495d0257c7fe50611982d34 (diff) |
fix some of the vba compression tests
Change-Id: Icfb9b63206fe22641ebdef76619fe70e1f5d5e04
Diffstat (limited to 'oox')
-rw-r--r-- | oox/qa/unit/data/vba/reference/simple1.bin | bin | 50 -> 18 bytes | |||
-rw-r--r-- | oox/qa/unit/data/vba/reference/simple2.bin | bin | 32 -> 13 bytes | |||
-rw-r--r-- | oox/qa/unit/data/vba/reference/simple3.bin | 1 | ||||
-rw-r--r-- | oox/qa/unit/data/vba/simple1.bin | bin | 52 -> 13 bytes | |||
-rw-r--r-- | oox/qa/unit/data/vba/simple2.bin | bin | 48 -> 11 bytes | |||
-rw-r--r-- | oox/qa/unit/data/vba/simple3.bin | 1 | ||||
-rw-r--r-- | oox/qa/unit/vba_compression.cxx | 31 |
7 files changed, 30 insertions, 3 deletions
diff --git a/oox/qa/unit/data/vba/reference/simple1.bin b/oox/qa/unit/data/vba/reference/simple1.bin Binary files differindex bd55e2ef5f19..a4644fbb721d 100644 --- a/oox/qa/unit/data/vba/reference/simple1.bin +++ b/oox/qa/unit/data/vba/reference/simple1.bin diff --git a/oox/qa/unit/data/vba/reference/simple2.bin b/oox/qa/unit/data/vba/reference/simple2.bin Binary files differindex 89f448a9acaa..5de3f5ae057c 100644 --- a/oox/qa/unit/data/vba/reference/simple2.bin +++ b/oox/qa/unit/data/vba/reference/simple2.bin diff --git a/oox/qa/unit/data/vba/reference/simple3.bin b/oox/qa/unit/data/vba/reference/simple3.bin new file mode 100644 index 000000000000..a38e8a86866b --- /dev/null +++ b/oox/qa/unit/data/vba/reference/simple3.bin @@ -0,0 +1 @@ + diff --git a/oox/qa/unit/data/vba/simple1.bin b/oox/qa/unit/data/vba/simple1.bin Binary files differindex 61dbbebf1c3f..d59c1d5ef020 100644 --- a/oox/qa/unit/data/vba/simple1.bin +++ b/oox/qa/unit/data/vba/simple1.bin diff --git a/oox/qa/unit/data/vba/simple2.bin b/oox/qa/unit/data/vba/simple2.bin Binary files differindex 9843ad2c731f..1b9b88b16d4c 100644 --- a/oox/qa/unit/data/vba/simple2.bin +++ b/oox/qa/unit/data/vba/simple2.bin diff --git a/oox/qa/unit/data/vba/simple3.bin b/oox/qa/unit/data/vba/simple3.bin new file mode 100644 index 000000000000..72060e8a2d39 --- /dev/null +++ b/oox/qa/unit/data/vba/simple3.bin @@ -0,0 +1 @@ + diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index 6a7133187d7e..715a0e4cb089 100644 --- a/oox/qa/unit/vba_compression.cxx +++ b/oox/qa/unit/vba_compression.cxx @@ -25,6 +25,8 @@ public: // a sequence containing one subsequence that can be compressed void testSimple2(); + void testSimple3(); + // avoid the BootstrapFixtureBase::setUp and tearDown virtual void setUp() SAL_OVERRIDE; virtual void tearDown() SAL_OVERRIDE; @@ -32,6 +34,7 @@ public: CPPUNIT_TEST_SUITE(TestVbaCompression); CPPUNIT_TEST(testSimple1); CPPUNIT_TEST(testSimple2); + CPPUNIT_TEST(testSimple3); CPPUNIT_TEST_SUITE_END(); private: @@ -70,7 +73,7 @@ void TestVbaCompression::testSimple1() ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug.bin"); - // CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); + 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(); @@ -91,8 +94,30 @@ void TestVbaCompression::testSimple2() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug2.bin"); - // - // CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); + + 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::testSimple3() +{ + OUString aTestFile = getPathFromSrc("/oox/qa/unit/data/vba/simple3.bin"); + OUString aReference = getPathFromSrc("/oox/qa/unit/data/vba/reference/simple3.bin"); + + SvMemoryStream aOutputMemoryStream(4096, 4096); + SvMemoryStream aReferenceMemoryStream(4096, 4096); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug3.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(); |