[Libreoffice-commits] core.git: Branch 'feature/vba-export' - oox/qa

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Aug 18 04:18:16 PDT 2015


 oox/qa/unit/data/vba/reference/spec321.bin |binary
 oox/qa/unit/data/vba/spec321.bin           |    1 +
 oox/qa/unit/vba_compression.cxx            |   27 ++++++++++++++++++++++++++-
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 40b8f4d7b23e3ab297cd6d006bba1ad6a081b2fa
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Aug 18 13:17:02 2015 +0200

    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

diff --git a/oox/qa/unit/data/vba/reference/spec321.bin b/oox/qa/unit/data/vba/reference/spec321.bin
new file mode 100644
index 0000000..3120c7f
Binary files /dev/null and b/oox/qa/unit/data/vba/reference/spec321.bin differ
diff --git a/oox/qa/unit/data/vba/spec321.bin b/oox/qa/unit/data/vba/spec321.bin
new file mode 100644
index 0000000..c5d48c9
--- /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 abf2b29..0247fb9 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());
 


More information about the Libreoffice-commits mailing list