Kaydet (Commit) 2a5ac6f6 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Thorsten Behrens

screenshots: unify dumping of dialog test batch file

Change-Id: Ia1e79216d9537c65f8b7362778a2e1ad3ec6c2c2
üst 51cd1024
......@@ -67,80 +67,8 @@ VclAbstractDialog* BasctlDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void BasctlDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("basctl/qa/unit/data/basctl-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("modules/BasicIDE/ui/organizedialog.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("basctl/qa/unit/data/basctl-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(BasctlDialogsTest);
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* Chart2DialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void Chart2DialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("chart2/qa/unit/data/chart2-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("modules/schart/ui/datarangedialog.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("chart2/qa/unit/data/chart2-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(Chart2DialogsTest);
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* CuiDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void CuiDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("cui/qa/unit/data/cui-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("cui/ui/customizedialog.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("cui/qa/unit/data/cui-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(CuiDialogsTest);
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* DbaccessDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void DbaccessDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("dbaccess/qa/unit/data/dbaccess-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("dbaccess/ui/advancedsettingsdialog.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("dbaccess/qa/unit/data/dbaccess-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(DbaccessDialogsTest);
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* DesktopDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void DesktopDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("desktop/qa/unit/data/desktop-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("desktop/ui/cmdlinehelp.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("desktop/qa/unit/data/desktop-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopDialogsTest);
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* FilterDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void FilterDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("filter/qa/unit/data/filter-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("filter/ui/pdfoptionsdialog.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("filter/qa/unit/data/filter-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(FilterDialogsTest);
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* FormulaDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void FormulaDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("formula/qa/unit/data/formula-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("formula/ui/functionpage.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("formula/qa/unit/data/formula-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(FormulaDialogsTest);
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* FpickerDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void FpickerDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("fpicker/qa/unit/data/fpicker-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
dumpDialogToPath(aNextUIFile);
}
}
}
}
/// example how to dump all known dialogs
if (false)
{
// example for SfxTabDialog: 5 -> "modules/sdraw/ui/drawpagedialog.ui"
// example for TabDialog: 22 -> "modules/simpress/ui/headerfooterdialog.ui"
// example for self-adapted wizard: 0 -> "modules/simpress/ui/publishingdialog.ui"
for (mapType::const_iterator i = getKnownDialogs().begin(); i != getKnownDialogs().end(); i++)
{
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByID((*i).second));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{
// unknown dialog, should not happen in this basic loop.
// You have probably forgotten to add a case and
// implementastion to createDialogByID, please do this
}
}
}
/// example how to dump a dialog using fallback functionality
if (false)
{
// unknown dialog, try fallback to generic created
// VclBuilder-generated instance. Keep in mind that Dialogs
// using this mechanism will probably not be layouted well
// since the setup/initialization part is missing. Thus,
// only use for fallback when only the UI file is available.
//
// Take any example here, it's only for demonstration - using
// even a known one to demonstrate the fallback possibility
const OString aUIXMLDescription("fps/ui/foldernamedialog.ui");
dumpDialogToPath(aUIXMLDescription);
}
/// process input file containing the UXMLDescriptions of the dialogs to dump
processDialogBatchFile("fpicker/qa/unit/data/fpicker-dialogs-test.txt");
}
CPPUNIT_TEST_SUITE_REGISTRATION(FpickerDialogsTest);
......
......@@ -68,6 +68,20 @@ public:
/// compared to the active dialog (can be compared with dialog previewer)
void dumpDialogToPath(const OString& rUIXMLDescription);
/// helper to process all known dialogs
void processAllKnownDialogs();
/// helper to process an input file containing the UXMLDescriptions
/// of the dialogs to dump. It will internally try to detect and open
/// as known dialog first. If not successful, it will then use the
/// fallback version to dump the dialog.
/// The syntax of the input file is as follows:
/// - emty lines are allowed
/// - lines starting with '#' are treated as comment
/// - all other lines should contain a *.ui filename in the same
/// notation as in the dialog constructors(see code)
void processDialogBatchFile(const OUString& rFile);
/// const access to known dialogs
const mapType& getKnownDialogs() const { return maKnownDialogs; }
};
......
......@@ -67,80 +67,8 @@ VclAbstractDialog* ReportdesignDialogsTest::createDialogByID(sal_uInt32 /*nID*/)
void ReportdesignDialogsTest::openAnyDialog()
{
/// example how to process an input file containing the UXMLDescriptions of the dialogs
/// to dump
if (true)
{
test::Directories aDirectories;
OUString aURL = aDirectories.getURLFromSrc("reportdesign/qa/unit/data/reportdesign-dialogs-test.txt");
SvFileStream aStream(aURL, StreamMode::READ);
OString aNextUIFile;
const OString aComment("#");
while (aStream.ReadLine(aNextUIFile))
{
if (!aNextUIFile.isEmpty() && !aNextUIFile.startsWith(aComment))
{
// first check if it's a known dialog
std::unique_ptr<VclAbstractDialog> pDlg(createDialogByName(aNextUIFile));
if (pDlg)
{
// known dialog, dump screenshot to path
dumpDialogToPath(*pDlg);
}
else
{