tdf#119114 Add writerperfect / epub screenshot

Create writerperfect screenshot

Change-Id: I59d33d7e60cbe7326f3ebd8fbe57e1a4545c31c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95008
Tested-by: Jenkins
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
diff --git a/writerperfect/CppunitTest_writerperfect_dialogs_test.mk b/writerperfect/CppunitTest_writerperfect_dialogs_test.mk
new file mode 100644
index 0000000..1052d77
--- /dev/null
+++ b/writerperfect/CppunitTest_writerperfect_dialogs_test.mk
@@ -0,0 +1,68 @@
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#*************************************************************************

$(eval $(call gb_CppunitTest_CppunitScreenShot,writerperfect_dialogs_test))

$(eval $(call gb_CppunitTest_add_exception_objects,writerperfect_dialogs_test, \
    writerperfect/qa/unit/writerperfect-dialogs-test \
))

$(eval $(call gb_CppunitTest_use_sdk_api,writerperfect_dialogs_test))

$(eval $(call gb_CppunitTest_set_include,desktop_dialogs_test,\
    -I$(SRCDIR)/writerperfect/inc \
    $$(INCLUDE) \
))

$(eval $(call gb_CppunitTest_use_libraries,writerperfect_dialogs_test, \
    basegfx \
    comphelper \
    cppu \
    cppuhelper \
    drawinglayer \
    editeng \
    i18nlangtag \
    i18nutil \
    msfilter \
    oox \
    sal \
    salhelper \
    sax \
    sfx \
    sot \
    svl \
    svt \
    test \
    tl \
    tk \
    ucbhelper \
    unotest \
    utl \
    vcl \
    xo \
))

$(eval $(call gb_CppunitTest_use_external,writerperfect_dialogs_test,boost_headers))

$(eval $(call gb_CppunitTest_use_sdk_api,writerperfect_dialogs_test))

$(eval $(call gb_CppunitTest_use_ure,writerperfect_dialogs_test))
$(eval $(call gb_CppunitTest_use_vcl_non_headless_with_windows,writerperfect_dialogs_test))

$(eval $(call gb_CppunitTest_use_rdb,writerperfect_dialogs_test,services))

$(eval $(call gb_CppunitTest_use_configuration,writerperfect_dialogs_test))

$(eval $(call gb_CppunitTest_use_uiconfigs,writerperfect_dialogs_test,\
	writerperfect \
))

# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Module_writerperfect.mk b/writerperfect/Module_writerperfect.mk
index 01f8a0d..c24b0dd 100644
--- a/writerperfect/Module_writerperfect.mk
+++ b/writerperfect/Module_writerperfect.mk
@@ -51,4 +51,8 @@
    UITest_writerperfect_epubexport \
))

# screenshots
$(eval $(call gb_Module_add_screenshot_targets,writerperfect,\
    CppunitTest_writerperfect_dialogs_test \
))
# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/qa/unit/data/writerperfect-dialogs-test.txt b/writerperfect/qa/unit/data/writerperfect-dialogs-test.txt
new file mode 100644
index 0000000..3a0cdf5
--- /dev/null
+++ b/writerperfect/qa/unit/data/writerperfect-dialogs-test.txt
@@ -0,0 +1,38 @@
# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

# This file contains all dialogs that the unit tests in the module
# will work on if it is in script mode. It will read one-by-one,
# try to open it and create a screenshot that will be saved in
# workdir/screenshots using the pattern of the ui-file name.
#
# Syntax:
# - empty 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)

#
# The 'known' dialogs which have a hard-coded representation
# in registerKnownDialogsByID/createDialogByID
#

# No known dialogs in writerperfect for now

#
# Dialogs without a hard-coded representation. These will
# be visualized using a fallback based on VclBuilder
#

# currently deactivated, leads to problems and the test to not work
# This is typically a hint that these should be hard-coded in the
# test case since they need some document and model data to work

writerperfect/ui/exportepub.ui
#writerperfect/ui/wpfencodingdialog.ui
diff --git a/writerperfect/qa/unit/writerperfect-dialogs-test.cxx b/writerperfect/qa/unit/writerperfect-dialogs-test.cxx
new file mode 100644
index 0000000..7dc5f9f
--- /dev/null
+++ b/writerperfect/qa/unit/writerperfect-dialogs-test.cxx
@@ -0,0 +1,58 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <sal/config.h>
#include <test/screenshot_test.hxx>
#include <vcl/abstdlg.hxx>

using namespace ::com::sun::star;

/// Test opening a dialog in writerperfect
class WpfDialogsTest : public ScreenshotTest
{
private:
    /// helper method to populate KnownDialogs, called in setUp(). Needs to be
    /// written and has to add entries to KnownDialogs
    virtual void registerKnownDialogsByID(mapType& rKnownDialogs) override;

    /// dialog creation for known dialogs by ID. Has to be implemented for
    /// each registered known dialog
    virtual VclPtr<VclAbstractDialog> createDialogByID(sal_uInt32 nID) override;

public:
    WpfDialogsTest();

    // try to open a dialog
    void openAnyDialog();

    CPPUNIT_TEST_SUITE(WpfDialogsTest);
    CPPUNIT_TEST(openAnyDialog);
    CPPUNIT_TEST_SUITE_END();
};

WpfDialogsTest::WpfDialogsTest() {}

void WpfDialogsTest::registerKnownDialogsByID(mapType& /*rKnownDialogs*/)
{
    // fill map of known dialogs
}

VclPtr<VclAbstractDialog> WpfDialogsTest::createDialogByID(sal_uInt32 /*nID*/) { return nullptr; }

void WpfDialogsTest::openAnyDialog()
{
    /// process input file containing the UXMLDescriptions of the dialogs to dump
    processDialogBatchFile("writerperfect/qa/unit/data/writerperfect-dialogs-test.txt");
}

CPPUNIT_TEST_SUITE_REGISTRATION(WpfDialogsTest);

CPPUNIT_PLUGIN_IMPLEMENT();

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */