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

2016-06-23 Thread Katarina Behrens
Rebased ref, commits from common ancestor:
commit a16b3794fc862c98ce536812cb25c57c464fcfc7
Author: Katarina Behrens 
Date:   Thu Jun 23 23:06:35 2016 +0200

Put created screenshots into workdir

use osl file abstractions for that

Change-Id: I876ca61e1d42b29f7c592b2778d8847b15513b98

diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index 93d3cf0..59f1cc4 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -32,6 +32,7 @@
 
 #include 
 #include 
+#include 
 
 #include "sdabstdlg.hxx"
 #include 
@@ -59,6 +60,8 @@
 
 using namespace ::com::sun::star;
 
+static const char* SCREENSHOT_DIRECTORY = "/workdir/screenshots";
+
 /// Test opening a dialog in sd
 class SdDialogsTest : public test::BootstrapFixture, public unotest::MacrosTest
 {
@@ -135,6 +138,10 @@ void SdDialogsTest::setUp()
 mpFact = SdAbstractDialogFactory::Create();
 mxComponent = loadFromDesktop("private:factory/simpress", 
"com.sun.star.presentation.PresentationDocument");
 CPPUNIT_ASSERT(mxComponent.is());
+
+osl::FileBase::RC err = osl::Directory::create( 
m_directories.getURLFromSrc( SCREENSHOT_DIRECTORY ) );
+CPPUNIT_ASSERT_MESSAGE( "Failed to create screenshot directory", (err == 
osl::FileBase::E_None || err == osl::FileBase::E_EXIST) );
+
 mpImpressDocument = dynamic_cast(mxComponent.get());
 CPPUNIT_ASSERT(mpImpressDocument);
 }
@@ -601,6 +608,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 
 void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& rDlg, const OUString& 
rPath)
 {
+
 // for dumping, a lossless format is needed. It may be seen if the created 
data
 // will be further modified/reduced, but for a input creating step it is
 // unavoidable to use a lossless format initially
@@ -633,7 +641,10 @@ void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& 
rDlg, const OUString& rP
 
 if (!aScreenshot.IsEmpty())
 {
-SvFileStream aNew(rPath + OUString(".png"), StreamMode::WRITE | 
StreamMode::TRUNC);
+const OUString aPath = rPath + ".png";
+SvFileStream aNew(aPath, StreamMode::WRITE | StreamMode::TRUNC);
+CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "Failed to create " + 
aPath, RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen() );
+
 vcl::PNGWriter aPNGWriter(aScreenshot);
 aPNGWriter.Write(aNew);
 }
@@ -642,20 +653,7 @@ void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& 
rDlg, const OUString& rP
 
 void SdDialogsTest::openAnyDialog()
 {
-// activate for debug using attach
-//while (true)
-//{
-//Sound::Beep();
-//}
-
-// current target for png's is defined here
-const OUString aTempTargetPath(
-#ifdef _WIN32
-"c:\\test_dlgF_"
-#else
-"~/test_dlgF_"
-#endif
-);
+const OUString aTempTargetPath = m_directories.getPathFromSrc( 
SCREENSHOT_DIRECTORY );
 
 // example for SfxTabDialog: 5
 // example for TabDialog: 23
@@ -670,7 +668,7 @@ void SdDialogsTest::openAnyDialog()
 
 if (pDlg)
 {
-dumpDialogToPath(*pDlg, aTempTargetPath + OUString::number(a));
+dumpDialogToPath(*pDlg, aTempTargetPath + "/" + 
OUString::number(a));
 delete pDlg;
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-06-17 Thread Katarina Behrens
 sd/qa/unit/dialogs-test.cxx   |   20 ++--
 sfx2/source/dialog/tabdlg.cxx |4 ++--
 2 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit bae9bd0c7d096dcf0f8ef0806f918acc77f2fa07
Author: Katarina Behrens 
Date:   Fri Jun 17 16:03:34 2016 +0200

Fix build after rebase

Change-Id: I882c9fa6349d59419be5a5b2ed49a712eb4c07f1

diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index 2103a13..c5a6d4d 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -37,6 +37,7 @@
 #include 
 #include "unomodel.hxx"
 #include "ViewShell.hxx"
+#include "Window.hxx"
 #include "drawview.hxx"
 #include "DrawViewShell.hxx"
 #include 
@@ -290,6 +291,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 
 // needs an SfxItemSet, use the one from the 1st object
 pRetval = getSdAbstractDialogFactory()->CreateCopyDlg(
+getViewShell()->GetActiveWindow(),
 getSfxItemSetFromSdrObject(),
 pColorList,
 getDrawView());
@@ -302,6 +304,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 CPPUNIT_ASSERT(pDrawDoc);
 
 pRetval = getSdAbstractDialogFactory()->CreateSdCustomShowDlg(
+getViewShell()->GetActiveWindow(),
 *pDrawDoc);
 break;
 }
@@ -311,6 +314,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 // needs an SfxItemSet, use an empty constructed one
 // needs a 'SfxObjectShell* pDocShell', crashes without
 pRetval = getSdAbstractDialogFactory()->CreateSdTabCharDialog(
+getViewShell()->GetActiveWindow(),
 (),
 getDocShell());
 break;
@@ -321,6 +325,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 // needs a special SfxItemSet with merged content from page and 
other stuff, crashes without that (2nd page)
 // needs a 'SfxObjectShell* pDocShell', crashes without. Also 
sufficient: FillStyleItemSet with XFILL_NONE set
 pRetval = getSdAbstractDialogFactory()->CreateSdTabPageDialog(
+getViewShell()->GetActiveWindow(),
 (),
 getDocShell(),
 true);
@@ -328,11 +333,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 }
 case 6:
 {
-// CreateAssistentDlg(bool bAutoPilot) override;
-// This is also a 'wizard' in that it has prev/next buttons and 
implicitly
-// multiple pages. To make use of that it is necessary that the 
implementation
-// supports the 'Screenshot interface', see AssistentDlg class
-pRetval = getSdAbstractDialogFactory()->CreateAssistentDlg(true);
+// CreateAssistentDlg(bool bAutoPilot) has been dropped
 break;
 }
 case 7:
@@ -353,6 +354,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 aNewAttr.Put(SfxInt32Item(ATTR_SNAPLINE_X, 0));
 aNewAttr.Put(SfxInt32Item(ATTR_SNAPLINE_Y, 0));
 pRetval = getSdAbstractDialogFactory()->CreateSdSnapLineDlg(
+getViewShell()->GetActiveWindow(),
 aNewAttr,
 getDrawView());
 break;
@@ -372,6 +374,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 aNewAttr.Put(SdAttrLayerLocked());
 aNewAttr.Put(SdAttrLayerThisPage());
 pRetval = getSdAbstractDialogFactory()->CreateSdInsertLayerDlg(
+getViewShell()->GetActiveWindow(),
 aNewAttr,
 true, // alternative: false
 SD_RESSTR(STR_INSERTLAYER) /* alternative: STR_MODIFYLAYER */);
@@ -384,6 +387,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 CPPUNIT_ASSERT(pDrawDoc);
 const OUString aFileName("foo");
 pRetval = getSdAbstractDialogFactory()->CreateSdInsertPagesObjsDlg(
+getViewShell()->GetActiveWindow(),
 pDrawDoc,
 nullptr,
 aFileName);
@@ -409,6 +413,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 {
 // CreateSdOutlineBulletTabDlg(const SfxItemSet* pAttr, 
::sd::View* pView = nullptr) override;
 pRetval = 
getSdAbstractDialogFactory()->CreateSdOutlineBulletTabDlg(
+getViewShell()->GetActiveWindow(),
 (),
 getDrawView());
 break;
@@ -417,6 +422,7 @@ VclAbstractDialog* 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
 {
 // CreateSdParagraphTabDlg(const SfxItemSet* pAttr) override;
 pRetval = getSdAbstractDialogFactory()->CreateSdParagraphTabDlg(
+