diff options
23 files changed, 126 insertions, 1358 deletions
diff --git a/basctl/qa/unit/basctl-dialogs-test.cxx b/basctl/qa/unit/basctl-dialogs-test.cxx index 629cf4c7cf51..e0af831b4700 100644 --- a/basctl/qa/unit/basctl-dialogs-test.cxx +++ b/basctl/qa/unit/basctl-dialogs-test.cxx @@ -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); diff --git a/chart2/qa/unit/chart2-dialogs-test.cxx b/chart2/qa/unit/chart2-dialogs-test.cxx index 9a9921f1a3ea..112adbf4698f 100644 --- a/chart2/qa/unit/chart2-dialogs-test.cxx +++ b/chart2/qa/unit/chart2-dialogs-test.cxx @@ -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); diff --git a/cui/qa/unit/cui-dialogs-test.cxx b/cui/qa/unit/cui-dialogs-test.cxx index 5e819ce1304a..58cc3b9fcd04 100644 --- a/cui/qa/unit/cui-dialogs-test.cxx +++ b/cui/qa/unit/cui-dialogs-test.cxx @@ -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); diff --git a/dbaccess/qa/unit/dbaccess-dialogs-test.cxx b/dbaccess/qa/unit/dbaccess-dialogs-test.cxx index 6ebecd3e9c5a..a95a8cea5949 100644 --- a/dbaccess/qa/unit/dbaccess-dialogs-test.cxx +++ b/dbaccess/qa/unit/dbaccess-dialogs-test.cxx @@ -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); diff --git a/desktop/qa/unit/desktop-dialogs-test.cxx b/desktop/qa/unit/desktop-dialogs-test.cxx index 5768b43eec45..ff654ff44424 100644 --- a/desktop/qa/unit/desktop-dialogs-test.cxx +++ b/desktop/qa/unit/desktop-dialogs-test.cxx @@ -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); diff --git a/filter/qa/unit/filter-dialogs-test.cxx b/filter/qa/unit/filter-dialogs-test.cxx index 91a891de022f..8cc149777ef8 100644 --- a/filter/qa/unit/filter-dialogs-test.cxx +++ b/filter/qa/unit/filter-dialogs-test.cxx @@ -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); diff --git a/formula/qa/unit/formula-dialogs-test.cxx b/formula/qa/unit/formula-dialogs-test.cxx index 80d2d3fadc77..97f3c90a49eb 100644 --- a/formula/qa/unit/formula-dialogs-test.cxx +++ b/formula/qa/unit/formula-dialogs-test.cxx @@ -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); diff --git a/fpicker/qa/unit/fpicker-dialogs-test.cxx b/fpicker/qa/unit/fpicker-dialogs-test.cxx index 82269a13b4ed..622138d496c3 100644 --- a/fpicker/qa/unit/fpicker-dialogs-test.cxx +++ b/fpicker/qa/unit/fpicker-dialogs-test.cxx @@ -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); diff --git a/include/test/screenshot_test.hxx b/include/test/screenshot_test.hxx index 443db3102bd5..473d44a4c20b 100644 --- a/include/test/screenshot_test.hxx +++ b/include/test/screenshot_test.hxx @@ -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; } }; diff --git a/reportdesign/qa/unit/reportdesign-dialogs-test.cxx b/reportdesign/qa/unit/reportdesign-dialogs-test.cxx index ac59b80260f3..3f3736412c98 100644 --- a/reportdesign/qa/unit/reportdesign-dialogs-test.cxx +++ b/reportdesign/qa/unit/reportdesign-dialogs-test.cxx @@ -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 - { - // 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/dbreport/ui/background.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("reportdesign/qa/unit/data/reportdesign-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(ReportdesignDialogsTest); diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 255fe9ca580c..c52bbc533eaf 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -275,61 +275,8 @@ void ScScreenshotTest::testOpeningModalDialogs() { initializeWithDoc("empty.ods"); - /// example how to process an input file containing the UXMLDescriptions of the dialogs - /// to dump - if (true) - { - test::Directories aDirectories; - OUString aURL = aDirectories.getURLFromSrc("sc/qa/unit/screenshots/data/screenshots.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) - { - 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 - } - } - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("sc/qa/unit/screenshots/data/screenshots.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(ScScreenshotTest); diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx index 1b0cf2b4cc1e..92e3da5e9b2d 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -608,58 +608,33 @@ void SdDialogsTest::openAnyDialog() /// to dump if (true) { - test::Directories aDirectories; - OUString aURL = aDirectories.getURLFromSrc("sd/qa/unit/data/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); - } - } - } + processDialogBatchFile("sd/qa/unit/data/dialogs-test.txt"); } /// example how to dump all known dialogs if (false) { + processAllKnownDialogs(); + } + + /// example how to dump exactly one known dialog + 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(5)); + + if (pDlg) + { + // known dialog, dump screenshot to path + dumpDialogToPath(*pDlg); + } + else { - 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 - } + // unknown dialog, should not happen in this basic loop. + // You have probably forgotten to add a case and + // implementastion to createDialogByID, please do this } } diff --git a/sfx2/qa/unit/sfx2-dialogs-test.cxx b/sfx2/qa/unit/sfx2-dialogs-test.cxx index 8e144eb2f69c..42fb59e3cc6a 100644 --- a/sfx2/qa/unit/sfx2-dialogs-test.cxx +++ b/sfx2/qa/unit/sfx2-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* Sfx2DialogsTest::createDialogByID(sal_uInt32 /*nID*/) void Sfx2DialogsTest::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("sfx2/qa/unit/data/sfx2-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("sfx/ui/documentpropertiesdialog.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("sfx2/qa/unit/data/sfx2-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(Sfx2DialogsTest); diff --git a/starmath/qa/unit/starmath-dialogs-test.cxx b/starmath/qa/unit/starmath-dialogs-test.cxx index 82f576be2302..2bd480d57503 100644 --- a/starmath/qa/unit/starmath-dialogs-test.cxx +++ b/starmath/qa/unit/starmath-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* StarmathDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void StarmathDialogsTest::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("starmath/qa/unit/data/starmath-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/smath/ui/printeroptions.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("starmath/qa/unit/data/starmath-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(StarmathDialogsTest); diff --git a/svtools/qa/unit/svtools-dialogs-test.cxx b/svtools/qa/unit/svtools-dialogs-test.cxx index 1bc1a8c46fe6..9be029e6941f 100644 --- a/svtools/qa/unit/svtools-dialogs-test.cxx +++ b/svtools/qa/unit/svtools-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* SvtoolsDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void SvtoolsDialogsTest::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("svtools/qa/unit/data/svtools-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("svt/ui/addresstemplatedialog.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("svtools/qa/unit/data/svtools-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(SvtoolsDialogsTest); diff --git a/svx/qa/unit/svx-dialogs-test.cxx b/svx/qa/unit/svx-dialogs-test.cxx index 17bbfd2e5d67..fec1e180a280 100644 --- a/svx/qa/unit/svx-dialogs-test.cxx +++ b/svx/qa/unit/svx-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* SvxDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void SvxDialogsTest::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("svx/qa/unit/data/svx-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("svx/ui/textcontrolchardialog.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("svx/qa/unit/data/svx-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(SvxDialogsTest); diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk index 5d07ee3011e7..d3cf68be3ec1 100644 --- a/sw/CppunitTest_sw_filters_test.mk +++ b/sw/CppunitTest_sw_filters_test.mk @@ -16,11 +16,9 @@ $(eval $(call gb_CppunitTest_use_externals,sw_filters_test,\ libxml2 \ )) -ifneq ($(DISABLE_CVE_TESTS),TRUE) $(eval $(call gb_CppunitTest_add_exception_objects,sw_filters_test, \ sw/qa/core/filters-test \ )) -endif $(eval $(call gb_CppunitTest_use_libraries,sw_filters_test, \ sw \ diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index 890a0514ab25..d635f4c569f0 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -79,8 +79,13 @@ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ )) endif +ifneq ($(DISABLE_CVE_TESTS),TRUE) $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_filters_test \ +)) +endif + +$(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_dialogs_test \ )) diff --git a/sw/qa/unit/sw-dialogs-test.cxx b/sw/qa/unit/sw-dialogs-test.cxx index 651482f02a6f..ee9a8559f5e7 100644 --- a/sw/qa/unit/sw-dialogs-test.cxx +++ b/sw/qa/unit/sw-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* SwDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void SwDialogsTest::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("sw/qa/unit/data/sw-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/swriter/ui/abstractdialog.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("sw/qa/unit/data/sw-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(SwDialogsTest); diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx index dfbd2cee257c..a700b8d928e8 100644 --- a/test/source/screenshot_test.cxx +++ b/test/source/screenshot_test.cxx @@ -199,4 +199,57 @@ void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription) } } +void ScreenshotTest::processAllKnownDialogs() +{ + 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 + } + } +} + +void ScreenshotTest::processDialogBatchFile(const OUString& rFile) +{ + test::Directories aDirectories; + const OUString aURL(aDirectories.getURLFromSrc(rFile)); + 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); + } + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/qa/unit/uui-dialogs-test.cxx b/uui/qa/unit/uui-dialogs-test.cxx index f3a7d0c665ce..c4fab13f21c5 100644 --- a/uui/qa/unit/uui-dialogs-test.cxx +++ b/uui/qa/unit/uui-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* UuiDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void UuiDialogsTest::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("uui/qa/unit/data/uui-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("uui/ui/authfallback.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("uui/qa/unit/data/uui-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(UuiDialogsTest); diff --git a/vcl/qa/unit/vcl-dialogs-test.cxx b/vcl/qa/unit/vcl-dialogs-test.cxx index 914c52db550f..5ad8e1099a0c 100644 --- a/vcl/qa/unit/vcl-dialogs-test.cxx +++ b/vcl/qa/unit/vcl-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* VclDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void VclDialogsTest::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("vcl/qa/unit/data/vcl-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("vcl/ui/printerpropertiesdialog.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("vcl/qa/unit/data/vcl-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(VclDialogsTest); diff --git a/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx b/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx index 95be0dce17ba..ecb04955baf5 100644 --- a/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx +++ b/xmlsecurity/qa/unit/xmlsecurity-dialogs-test.cxx @@ -67,80 +67,8 @@ VclAbstractDialog* XmlsecurityDialogsTest::createDialogByID(sal_uInt32 /*nID*/) void XmlsecurityDialogsTest::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("xmlsecurity/qa/unit/data/xmlsecurity-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("xmlsec/ui/viewcertdialog.ui"); - - dumpDialogToPath(aUIXMLDescription); - } + /// process input file containing the UXMLDescriptions of the dialogs to dump + processDialogBatchFile("xmlsecurity/qa/unit/data/xmlsecurity-dialogs-test.txt"); } CPPUNIT_TEST_SUITE_REGISTRATION(XmlsecurityDialogsTest); |