From 26be5f21cebfe9acad088a1086f97eebdb437b7c Mon Sep 17 00:00:00 2001 From: Juergen Funk Date: Wed, 20 Dec 2017 13:09:40 +0100 Subject: unotools: don't go belly-up if temp dir is wrong or empty When a wrong temp directory was set (e.g. wrong path in xcu ist set), you get a assert in the LO-Debug Version, this patch avoid this assertion. Change-Id: I192f682860ad9cddf907e4b239eff36b4bd6072d Reviewed-on: https://gerrit.libreoffice.org/46846 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens --- sal/qa/osl/file/osl_old_test_file.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'sal/qa') diff --git a/sal/qa/osl/file/osl_old_test_file.cxx b/sal/qa/osl/file/osl_old_test_file.cxx index f093d5fe1bb8..fbbefbb03884 100644 --- a/sal/qa/osl/file/osl_old_test_file.cxx +++ b/sal/qa/osl/file/osl_old_test_file.cxx @@ -32,6 +32,9 @@ #include #include +#include + + namespace osl_test_file { @@ -137,8 +140,30 @@ void oldtestfile::test_file_004() #endif } +class TempFileTest : public CppUnit::TestFixture +{ + +public: + TempFileTest() {} + + void SetTempNameBaseDirectory() + { // only testing: of not found the directory + OUString path = utl::TempFile::SetTempNameBaseDirectory("file:///not/found/dir"); + + CPPUNIT_ASSERT_MESSAGE("SetTempNameBaseDirectory must give a empty string back", + path.isEmpty()); + } + + + CPPUNIT_TEST_SUITE(TempFileTest); + CPPUNIT_TEST(SetTempNameBaseDirectory); + CPPUNIT_TEST_SUITE_END(); +}; + + } // namespace osl_test_file CPPUNIT_TEST_SUITE_REGISTRATION( osl_test_file::oldtestfile); +CPPUNIT_TEST_SUITE_REGISTRATION( osl_test_file::TempFileTest); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit