From c979a944c7a00a35293d1de3c32b06f90e0bfa5f Mon Sep 17 00:00:00 2001 From: Varun Date: Tue, 9 Jun 2015 03:48:32 +0530 Subject: Added Test for Export to Picture Change-Id: I62d44e29cd4376f17270cef548d2cec6f4b621b9 Reviewed-by: Michael Stahl --- sw/qa/extras/uiwriter/uiwriter.cxx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index f48dd91293dd..acc31ae19e8d 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -51,6 +51,7 @@ #include "com/sun/star/util/SearchAlgorithms.hpp" #include "com/sun/star/i18n/TransliterationModulesExtra.hpp" #include "com/sun/star/sdbcx/XTablesSupplier.hpp" +#include static const char* DATA_DIRECTORY = "/sw/qa/extras/uiwriter/data/"; @@ -90,6 +91,7 @@ public: void testTdf68183(); void testCp1000115(); void testTdf90003(); + void testExportToPicture(); void testSearchWithTransliterate(); void testTableBackgroundColor(); void testTdf90362(); @@ -130,6 +132,7 @@ public: CPPUNIT_TEST(testTdf68183); CPPUNIT_TEST(testCp1000115); CPPUNIT_TEST(testTdf90003); + CPPUNIT_TEST(testExportToPicture); CPPUNIT_TEST(testSearchWithTransliterate); CPPUNIT_TEST(testTableBackgroundColor); CPPUNIT_TEST(testTdf90362); @@ -872,6 +875,32 @@ void SwUiWriterTest::testTdf90003() assertXPath(pXmlDoc, "//Special[@nType='POR_FLY']", 0); } +void SwUiWriterTest::testExportToPicture() +{ + createDoc(); + uno::Sequence aFilterData = + { + beans::PropertyValue("PixelWidth", sal_Int32(0), uno::makeAny(sal_Int32(610)), beans::PropertyState_DIRECT_VALUE), + beans::PropertyValue("PixelHeight", sal_Int32(0), uno::makeAny(sal_Int32(610)), beans::PropertyState_DIRECT_VALUE) + }; + uno::Sequence aDescriptor = + { + beans::PropertyValue("FilterName", sal_Int32(0), uno::makeAny(OUString("writer_png_Export")), beans::PropertyState_DIRECT_VALUE), + beans::PropertyValue("FilterData", sal_Int32(0), uno::makeAny(aFilterData), beans::PropertyState_DIRECT_VALUE) + }; + utl::TempFile aTempFile; + uno::Reference xStorable(mxComponent, uno::UNO_QUERY); + xStorable->storeToURL(aTempFile.GetURL(), aDescriptor); + sal_Bool extchk = aTempFile.IsValid(); + CPPUNIT_ASSERT_EQUAL(sal_Bool(true), extchk); + osl::File tmpFile(aTempFile.GetURL()); + tmpFile.open(sal_uInt32(osl_File_OpenFlag_Read)); + sal_uInt64 val; + CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, tmpFile.getSize(val)); + CPPUNIT_ASSERT(val > 100); + aTempFile.EnableKillingFile(); +} + void SwUiWriterTest::testSearchWithTransliterate() { SwDoc* pDoc = createDoc(); -- cgit