diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-11-15 15:13:35 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-11-15 15:13:35 +0100 |
commit | e6aec5ad0a0db4f41f90b39971c296732372cadf (patch) | |
tree | 62a82d1679f182cd95b245e241b4a3a0b8f77fc8 /oox/qa | |
parent | 43540adb76f764522344c5d66ebc63f7cb0f9c1c (diff) |
Don't pollute /tmp with vba_debug* files
...put them at workdir/CppunitTest/oox_vba_compression.test.user/debug/ instead.
Change-Id: I067a82c05e2f91969d70cb582d69c4c1de13951c
Diffstat (limited to 'oox/qa')
-rw-r--r-- | oox/qa/unit/vba_compression.cxx | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/oox/qa/unit/vba_compression.cxx b/oox/qa/unit/vba_compression.cxx index 6541c8517411..2c083e8a8c95 100644 --- a/oox/qa/unit/vba_compression.cxx +++ b/oox/qa/unit/vba_compression.cxx @@ -10,8 +10,9 @@ #include <cppunit/plugin/TestPlugIn.h> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/TestFixture.h> - +#include <osl/file.hxx> #include <oox/ole/vbaexport.hxx> +#include <rtl/bootstrap.hxx> #include <tools/stream.hxx> #include <unotest/directories.hxx> #include <algorithm> @@ -19,7 +20,6 @@ class TestVbaCompression : public CppUnit::TestFixture { public: - // just a sequence of bytes that should not be compressed at all void testSimple1(); @@ -52,6 +52,22 @@ public: CPPUNIT_TEST_SUITE_END(); private: + static OUString const & getDebugDirUrl() { + struct DebugDirUrl { + DebugDirUrl() { + url = "$UserInstallation/debug/"; + rtl::Bootstrap::expandMacros(url); + //TODO: provide an OUString -> OUString expansion function, and which throws on + // failure + auto e = osl::Directory::create(url); + CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, e); + } + OUString url; + }; + static DebugDirUrl url; + return url.url; + } + test::Directories m_directories; }; @@ -86,7 +102,7 @@ void TestVbaCompression::testSimple1() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); ReadFiles(aTestFile, aReference, aOutputMemoryStream, - aReferenceMemoryStream, "/tmp/vba_debug.bin"); + aReferenceMemoryStream, getDebugDirUrl() + "vba_debug.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -108,7 +124,7 @@ void TestVbaCompression::testSimple2() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); - ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug2.bin"); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug2.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -130,7 +146,7 @@ void TestVbaCompression::testSimple3() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); - ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug3.bin"); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug3.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -152,7 +168,7 @@ void TestVbaCompression::testComplex1() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); - ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_complex1.bin"); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug_complex1.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -174,7 +190,7 @@ void TestVbaCompression::testSpec321() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); - ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec321.bin"); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug_spec321.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -196,7 +212,7 @@ void TestVbaCompression::testSpec322() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); - ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec322.bin"); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug_spec322.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); @@ -218,7 +234,7 @@ void TestVbaCompression::testSpec323() SvMemoryStream aOutputMemoryStream(4096, 4096); SvMemoryStream aReferenceMemoryStream(4096, 4096); - ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, "/tmp/vba_debug_spec323.bin"); + ReadFiles(aTestFile, aReference, aOutputMemoryStream, aReferenceMemoryStream, getDebugDirUrl() + "vba_debug_spec323.bin"); CPPUNIT_ASSERT_EQUAL(aReferenceMemoryStream.GetSize(), aOutputMemoryStream.GetSize()); |