oox/qa/unit/vba_compression.cxx | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
New commits: commit e6aec5ad0a0db4f41f90b39971c296732372cadf Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Nov 15 15:13:35 2017 +0100 Don't pollute /tmp with vba_debug* files ...put them at workdir/CppunitTest/oox_vba_compression.test.user/debug/ instead. Change-Id: I067a82c05e2f91969d70cb582d69c4c1de13951c 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()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits