[Libreoffice-commits] core.git: 2 commits - sw/qa

Varun varun.dhall at studentpartner.com
Wed Jun 10 07:57:57 PDT 2015


 sw/qa/extras/uiwriter/uiwriter.cxx |   69 +++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

New commits:
commit c979a944c7a00a35293d1de3c32b06f90e0bfa5f
Author: Varun <varun.dhall at studentpartner.com>
Date:   Tue Jun 9 03:48:32 2015 +0530

    Added Test for Export to Picture
    
    Change-Id: I62d44e29cd4376f17270cef548d2cec6f4b621b9
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index f48dd91..acc31ae 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 <osl/file.hxx>
 
 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<beans::PropertyValue> 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<beans::PropertyValue> 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<frame::XStorable> 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();
commit 4deaf89bbeadf0395810ab5f1213aecf2b078c8b
Author: Varun <varun.dhall at studentpartner.com>
Date:   Tue Jun 9 04:01:32 2015 +0530

    Added Test for tdf#91145 Set Cell Background Color
    
    Change-Id: I7c41f1d596946706dde4adbeb5434ae0be58b04b
    
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 57af4a8..f48dd91 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -91,6 +91,7 @@ public:
     void testCp1000115();
     void testTdf90003();
     void testSearchWithTransliterate();
+    void testTableBackgroundColor();
     void testTdf90362();
     void testUndoCharAttribute();
     void testTdf86639();
@@ -130,6 +131,7 @@ public:
     CPPUNIT_TEST(testCp1000115);
     CPPUNIT_TEST(testTdf90003);
     CPPUNIT_TEST(testSearchWithTransliterate);
+    CPPUNIT_TEST(testTableBackgroundColor);
     CPPUNIT_TEST(testTdf90362);
     CPPUNIT_TEST(testUndoCharAttribute);
     CPPUNIT_TEST(testTdf86639);
@@ -904,6 +906,44 @@ void SwUiWriterTest::testSearchWithTransliterate()
     CPPUNIT_ASSERT_EQUAL(1,(int)case2);
 }
 
+void SwUiWriterTest::testTableBackgroundColor()
+{
+    SwDoc* pDoc = createDoc();
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    SwInsertTableOptions TableOpt(tabopts::DEFAULT_BORDER, 0);
+    pWrtShell->InsertTable(TableOpt, 3, 3); //Inserting Table
+    //Checking Rows and Columns of Inserted Table
+    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getRows()->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount());
+    pWrtShell->SttDoc();
+    pWrtShell->SelTableRow(); //Selecting First Row
+    pWrtShell->ClearMark();
+    //Modifying the color of Table Box
+    Color colour = sal_Int32(0xFF00FF);
+    pWrtShell->SetBoxBackground(SvxBrushItem(colour, sal_Int16(RES_BACKGROUND)));
+    //Checking cells for background color only A1 should be modified
+    uno::Reference<table::XCell> xCell;
+   xCell = xTable->getCellByName("A1");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFF00FF), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("A2");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("A3");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("B1");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("B2");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("B3");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("C1");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("C2");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+    xCell = xTable->getCellByName("C3");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(xCell, "BackColor"));
+}
+
 void SwUiWriterTest::testTdf90362()
 {
     // First check if the end of the second paragraph is indeed protected.


More information about the Libreoffice-commits mailing list