[Libreoffice-commits] core.git: Branch 'feature/dialog-screenshots' - 2 commits - sd/qa

Katarina Behrens Katarina.Behrens at cib.de
Thu Jun 30 08:19:52 UTC 2016


 sd/qa/unit/dialogs-test.cxx |   36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

New commits:
commit 7c5941768400e4186937e8c07bbd846ac01958e5
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jun 30 01:11:05 2016 +0200

    It is really unused
    
    Change-Id: Iaaf171f7b91476be0f2d668402e6f309b81d53c3

diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index d86e7bc..f3e51d2 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -665,8 +665,6 @@ void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& rDlg)
 
 void SdDialogsTest::openAnyDialog()
 {
-    const OUString aTempTargetPath = m_directories.getPathFromSrc( SCREENSHOT_DIRECTORY );
-
     // example for SfxTabDialog: 5
     // example for TabDialog: 23
     // example for self-adapted wizard: 0
commit e54a683377c0f73ab63521505f9c3c3a01f6cfff
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Thu Jun 30 01:08:06 2016 +0200

    Use smart pointers
    
    Change-Id: I7b3780aecc7807e5905865f8d7eca816993ab148

diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index 0578fac..d86e7bc 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -91,9 +91,10 @@ private:
     ::sd::DrawDocShell*                     mpDocShell;
     ::sd::ViewShell*                        mpViewShell;
     ::sd::DrawView*                         mpDrawView;
-    const SfxItemSet*                       mpSfxItemSetFromSdrObject;
-    const SfxItemSet*                       mpEmptySfxItemSet;
-    SfxItemSet*                             mpEmptyFillStyleSfxItemSet;
+
+    std::unique_ptr<SfxItemSet>             mpSfxItemSetFromSdrObject;
+    std::unique_ptr<SfxItemSet>             mpEmptySfxItemSet;
+    std::unique_ptr<SfxItemSet>             mpEmptyFillStyleSfxItemSet;
 
     /// helpers
     SdAbstractDialogFactory* getSdAbstractDialogFactory();
@@ -162,20 +163,10 @@ void SdDialogsTest::setUp()
 
 void SdDialogsTest::tearDown()
 {
-    if (mpEmptySfxItemSet)
-    {
-        delete mpEmptySfxItemSet;
-    }
-
-    if (mpEmptyFillStyleSfxItemSet)
-    {
-        delete mpEmptyFillStyleSfxItemSet;
-    }
-
-    if (mxComponent.is())
-    {
-        mxComponent->dispose();
-    }
+    //if (mxComponent.is())
+    //{
+    //    mxComponent->dispose();
+    //}
 
     test::BootstrapFixture::tearDown();
 }
@@ -233,7 +224,7 @@ const SfxItemSet& SdDialogsTest::getSfxItemSetFromSdrObject()
         CPPUNIT_ASSERT(pSdPage);
         SdrObject* pSdrObj = pSdPage->GetObj(0);
         CPPUNIT_ASSERT(pSdrObj);
-        mpSfxItemSetFromSdrObject = &pSdrObj->GetMergedItemSet();
+        mpSfxItemSetFromSdrObject.reset( new SfxItemSet( pSdrObj->GetMergedItemSet() ) );
         CPPUNIT_ASSERT(mpSfxItemSetFromSdrObject);
     }
 
@@ -247,7 +238,7 @@ const SfxItemSet& SdDialogsTest::getEmptySfxItemSet()
         // needs an SfxItemSet, use the one from the 1st object
         SdDrawDocument* pDrawDoc = getSdXImpressDocument()->GetDoc();
         CPPUNIT_ASSERT(pDrawDoc);
-        mpEmptySfxItemSet = new SfxItemSet(pDrawDoc->GetItemPool());
+        mpEmptySfxItemSet.reset( new SfxItemSet(pDrawDoc->GetItemPool()) );
         CPPUNIT_ASSERT(mpEmptySfxItemSet);
     }
 
@@ -260,7 +251,7 @@ const SfxItemSet& SdDialogsTest::getEmptyFillStyleSfxItemSet()
     {
         SdDrawDocument* pDrawDoc = getSdXImpressDocument()->GetDoc();
         CPPUNIT_ASSERT(pDrawDoc);
-        mpEmptyFillStyleSfxItemSet = new SfxItemSet(pDrawDoc->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST);
+        mpEmptyFillStyleSfxItemSet.reset( new SfxItemSet(pDrawDoc->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST) );
         CPPUNIT_ASSERT(mpEmptyFillStyleSfxItemSet);
         mpEmptyFillStyleSfxItemSet->Put(XFillStyleItem(drawing::FillStyle_NONE));
     }
@@ -685,12 +676,11 @@ void SdDialogsTest::openAnyDialog()
     // loop and dump all Dialogs from SD for now
     for (sal_uInt32 a(nStartValue); a < nEndValue; a++)
     {
-        VclAbstractDialog* pDlg = createDialogByID(a);
+        std::unique_ptr<VclAbstractDialog> pDlg( createDialogByID(a) );
 
         if (pDlg)
         {
             dumpDialogToPath(*pDlg);
-            delete pDlg;
         }
     }
 


More information about the Libreoffice-commits mailing list