Kaydet (Commit) e6aec5ad authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Don't pollute /tmp with vba_debug* files

...put them at workdir/CppunitTest/oox_vba_compression.test.user/debug/ instead.

Change-Id: I067a82c05e2f91969d70cb582d69c4c1de13951c
üst 43540adb
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment