[Libreoffice-commits] core.git: Branch 'feature/dialog-screenshots' - 4 commits - include/sfx2 sd/qa sfx2/source
Katarina Behrens
Katarina.Behrens at cib.de
Mon Jun 27 12:58:38 UTC 2016
include/sfx2/tabdlg.hxx | 2 +
sd/qa/unit/dialogs-test.cxx | 61 ++++++++++++++++++++----------------------
sfx2/source/dialog/tabdlg.cxx | 15 ++++++++++
3 files changed, 47 insertions(+), 31 deletions(-)
New commits:
commit ac27b574278fda88081ac1b466a079e1d321e9c8
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Jun 27 14:50:44 2016 +0200
rPath argument is now unused
Change-Id: Icd3c66b83419f25b198937b05ede9b22f1344726
diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index 8813c99..0578fac 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -107,7 +107,7 @@ private:
/// central methods: dialog creation and dumping to target directory (path)
VclAbstractDialog* createDialogByID(sal_uInt32 nID);
- void dumpDialogToPath(VclAbstractDialog& rDlg, const OUString& rPath);
+ void dumpDialogToPath(VclAbstractDialog& rDlg);
void saveScreenshot( VclAbstractDialog& rDlg);
public:
@@ -644,7 +644,7 @@ void SdDialogsTest::saveScreenshot(VclAbstractDialog& rDlg)
}
}
-void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& rDlg, const OUString& rPath)
+void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& rDlg)
{
// for dumping, a lossless format is needed. It may be seen if the created data
@@ -689,7 +689,7 @@ void SdDialogsTest::openAnyDialog()
if (pDlg)
{
- dumpDialogToPath(*pDlg, aTempTargetPath + "/" + OUString::number(a));
+ dumpDialogToPath(*pDlg);
delete pDlg;
}
}
commit a698b27ec6389f78eb81e38cb0373e2512cae0cb
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Jun 27 14:26:36 2016 +0200
Screenshot names to copy screenshot IDs, part 2
for tab dialogs. While at it, factor out file-saving code into
a separate function
Change-Id: Ideffc9934c0d562fe365d0bb1942f31056d4a486
diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index 2295be4..8813c99 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -108,6 +108,7 @@ private:
/// central methods: dialog creation and dumping to target directory (path)
VclAbstractDialog* createDialogByID(sal_uInt32 nID);
void dumpDialogToPath(VclAbstractDialog& rDlg, const OUString& rPath);
+ void saveScreenshot( VclAbstractDialog& rDlg);
public:
SdDialogsTest();
@@ -619,6 +620,30 @@ VclAbstractDialog* SdDialogsTest::createDialogByID(sal_uInt32 nID)
return pRetval;
}
+void SdDialogsTest::saveScreenshot(VclAbstractDialog& rDlg)
+{
+ const Bitmap aScreenshot(rDlg.createScreenshot());
+
+ if (!aScreenshot.IsEmpty())
+ {
+ OString aScreenshotId = rDlg.GetScreenshotId();
+ OUString aDirname, aBasename;
+ splitHelpId( aScreenshotId, aDirname, aBasename );
+ aDirname = OUString::createFromAscii( SCREENSHOT_DIRECTORY ) + aDirname;
+
+ osl::FileBase::RC err = osl::Directory::createPath( m_directories.getURLFromSrc( aDirname ));
+ CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "Failed to create " + aDirname, RTL_TEXTENCODING_UTF8).getStr(),
+ (err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST) );
+
+ OUString aFullPath = m_directories.getSrcRootPath() + aDirname + "/" + aBasename + ".png";
+ SvFileStream aNew(aFullPath, StreamMode::WRITE | StreamMode::TRUNC);
+ CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "Failed to open " + OUString::number(aNew.GetErrorCode()), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen() );
+
+ vcl::PNGWriter aPNGWriter(aScreenshot);
+ aPNGWriter.Write(aNew);
+ }
+}
+
void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& rDlg, const OUString& rPath)
{
@@ -633,14 +658,7 @@ void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& rDlg, const OUString& rP
{
if (rDlg.selectPageByUIXMLDescription(aPageDescriptions[a]))
{
- const Bitmap aScreenshot(rDlg.createScreenshot());
-
- if (!aScreenshot.IsEmpty())
- {
- SvFileStream aNew(rPath + OUString("_") + OUString::number(a) + OUString(".png"), StreamMode::WRITE | StreamMode::TRUNC);
- vcl::PNGWriter aPNGWriter(aScreenshot);
- aPNGWriter.Write(aNew);
- }
+ saveScreenshot( rDlg );
}
else
{
@@ -650,26 +668,7 @@ void SdDialogsTest::dumpDialogToPath(VclAbstractDialog& rDlg, const OUString& rP
}
else
{
- const Bitmap aScreenshot(rDlg.createScreenshot());
-
- if (!aScreenshot.IsEmpty())
- {
- OString aScreenshotId = rDlg.GetScreenshotId();
- OUString aDirname, aBasename;
- splitHelpId( aScreenshotId, aDirname, aBasename );
- aDirname = OUString::createFromAscii( SCREENSHOT_DIRECTORY ) + aDirname;
-
- osl::FileBase::RC err = osl::Directory::createPath( m_directories.getURLFromSrc( aDirname ));
- CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "Failed to create " + aDirname, RTL_TEXTENCODING_UTF8).getStr(),
- (err == osl::FileBase::E_None || err == osl::FileBase::E_EXIST) );
-
- OUString aFullPath = m_directories.getSrcRootPath() + aDirname + "/" + aBasename + ".png";
- SvFileStream aNew(aFullPath, StreamMode::WRITE | StreamMode::TRUNC);
- CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "Failed to open " + OUString::number(aNew.GetErrorCode()), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen() );
-
- vcl::PNGWriter aPNGWriter(aScreenshot);
- aPNGWriter.Write(aNew);
- }
+ saveScreenshot( rDlg );
}
}
commit 980998585cb34ceb22af3b350a4e0093e79c0536
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Jun 27 14:22:49 2016 +0200
Modify tab dialog screenshot id slightly
use only ID of the current page
Change-Id: I27ef4d2112a047379cec6bc221ba403f1a0371e4
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 90d352f..1905ab6 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1233,7 +1233,7 @@ OString SfxTabDialog::GetScreenshotId() const
vcl::Window* pToplevelBox = pActiveTabPage->GetWindow( GetWindowType::FirstChild );
if ( pToplevelBox )
- aScreenshotId = aScreenshotId + OString("#") + pToplevelBox->GetHelpId();
+ aScreenshotId = pToplevelBox->GetHelpId();
}
return aScreenshotId;
commit 277477554203ea0bd109fbf102e2ef1c03f528a4
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Jun 10 11:14:02 2016 +0200
tdf#100068: ScreenshotId for tab dialogs
Change-Id: I80ec2cef190d106bb45455424a6a0ed901590221
Reviewed-on: https://gerrit.libreoffice.org/26155
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx
index 54f05d3..f4200cd 100644
--- a/include/sfx2/tabdlg.hxx
+++ b/include/sfx2/tabdlg.hxx
@@ -163,6 +163,8 @@ public:
return GetTabPage(m_pTabCtrl->GetCurPageId());
}
+ virtual OString GetScreenshotId() const override;
+
OUString GetPageText( sal_uInt16 nPageId ) const
{
return m_pTabCtrl->GetPageText(nPageId);
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 5228810..90d352f 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1223,6 +1223,21 @@ void SfxTabDialog::ShowPage( sal_uInt16 nId )
ActivatePageHdl( m_pTabCtrl );
}
+OString SfxTabDialog::GetScreenshotId() const
+{
+ SfxTabPage *pActiveTabPage = GetCurTabPage();
+ OString aScreenshotId = GetHelpId();
+
+ if ( pActiveTabPage )
+ {
+ vcl::Window* pToplevelBox = pActiveTabPage->GetWindow( GetWindowType::FirstChild );
+
+ if ( pToplevelBox )
+ aScreenshotId = aScreenshotId + OString("#") + pToplevelBox->GetHelpId();
+ }
+
+ return aScreenshotId;
+}
const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool )
More information about the Libreoffice-commits
mailing list