LibreOffice Module test (master) 1
|
#include <screenshot_test.hxx>
Public Member Functions | |
ScreenshotTest () | |
virtual | ~ScreenshotTest () override |
virtual void | setUp () override |
VclPtr< VclAbstractDialog > | createDialogByName (const OString &rName) |
Dialog creation for known dialogs by Name (path and UIXMLDescription, *.ui file). More... | |
void | dumpDialogToPath (VclAbstractDialog &rDialog) |
version for AbstractDialogs, the ones created in AbstractDialogFactories More... | |
void | dumpDialogToPath (std::string_view rUIXMLDescription) |
fallback version for dialogs for which only the UXMLDescription is known. More... | |
void | processAllKnownDialogs () |
helper to process all known dialogs More... | |
void | processDialogBatchFile (std::u16string_view rFile) |
helper to process an input file containing the UXMLDescriptions of the dialogs to dump. More... | |
const mapType & | getKnownDialogs () const |
const access to known dialogs More... | |
Public Member Functions inherited from test::BootstrapFixture | |
DECL_DLLPRIVATE_STATIC_LINK (BootstrapFixture, ImplInitFilterHdl, ConvertData &, bool) | |
BootstrapFixture (bool bAssertOnDialog=true, bool bNeedUCB=true) | |
virtual | ~BootstrapFixture () override |
virtual void | setUp () override |
void | validate (const OUString &rURL, ValidationFormat) const |
Public Member Functions inherited from test::BootstrapFixtureBase | |
BootstrapFixtureBase () | |
virtual | ~BootstrapFixtureBase () override |
const css::uno::Reference< css::uno::XComponentContext > & | getComponentContext () const |
const css::uno::Reference< css::lang::XMultiServiceFactory > & | getMultiServiceFactory () const |
virtual void | setUp () override |
virtual void | tearDown () override |
Public Member Functions inherited from unotest::MacrosTest | |
MacrosTest () | |
~MacrosTest () | |
css::uno::Reference< css::lang::XComponent > | loadFromDesktop (const OUString &rURL, const OUString &rDocService=OUString(), const css::uno::Sequence< css::beans::PropertyValue > &rExtra_args=css::uno::Sequence< css::beans::PropertyValue >()) |
void | setUpNssGpg (const test::Directories &rDirectories, const OUString &rTestName) |
void | tearDownNssGpg () |
Private Member Functions | |
void | implSaveScreenshot (const BitmapEx &rScreenshot, const OUString &rScreenshotId) |
helpers More... | |
void | saveScreenshot (VclAbstractDialog const &rDialog) |
void | saveScreenshot (weld::Window &rDialog) |
void | dumpDialogToPath (weld::Builder &rDialog) |
helper method to create and dump a dialog based on Builder contents. More... | |
virtual void | registerKnownDialogsByID (mapType &rKnownDialogs)=0 |
helper method to populate maKnownDialogs, called in setUp(). More... | |
virtual VclPtr< VclAbstractDialog > | createDialogByID (sal_uInt32 nID)=0 |
dialog creation for known dialogs by ID. More... | |
Private Attributes | |
OUString | maCurrentLanguage |
The current UI language. More... | |
mapType | maKnownDialogs |
the set of known dialogs and their ID for usage in createDialogByID More... | |
weld::GenericDialogController | maParent |
parent for non-dialog buildables More... | |
std::unique_ptr< weld::Container > | mxParentWidget |
Additional Inherited Members | |
Static Public Member Functions inherited from test::BootstrapFixture | |
static sal_uInt16 | getDefaultDeviceBitCount () |
Static Public Member Functions inherited from unotest::MacrosTest | |
static css::uno::Any | dispatchCommand (const css::uno::Reference< css::lang::XComponent > &xComponent, const OUString &rCommand, const css::uno::Sequence< css::beans::PropertyValue > &rPropertyValues) |
static std::unique_ptr< SvStream > | parseExportStream (const OUString &url, const OUString &rStreamName) |
static bool | IsValid (const css::uno::Reference< css::security::XCertificate > &cert, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment > &env) |
static css::uno::Reference< css::security::XCertificate > | GetValidCertificate (const css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > &certs, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment > &env, const css::uno::Sequence< css::beans::PropertyValue > &rFilterData={}) |
Static Protected Member Functions inherited from test::BootstrapFixture | |
static bool | IsDefaultDPI () |
static std::pair< double, double > | getDPIScaling () |
Protected Attributes inherited from test::BootstrapFixture | |
css::uno::Reference< css::uno::XComponentContext > | mxComponentContext |
Protected Attributes inherited from test::BootstrapFixtureBase | |
Directories | m_directories |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
css::uno::Reference< css::lang::XMultiServiceFactory > | m_xSFactory |
css::uno::Reference< css::lang::XMultiComponentFactory > | m_xFactory |
Protected Attributes inherited from unotest::MacrosTest | |
css::uno::Reference< css::frame::XDesktop2 > | mxDesktop |
Definition at line 26 of file screenshot_test.hxx.
ScreenshotTest::ScreenshotTest | ( | ) |
Definition at line 45 of file screenshot_test.cxx.
References env, and maCurrentLanguage.
|
overridevirtual |
Definition at line 54 of file screenshot_test.cxx.
|
privatepure virtual |
dialog creation for known dialogs by ID.
Has to be implemented for each registered known dialog
Referenced by createDialogByName(), and processAllKnownDialogs().
VclPtr< VclAbstractDialog > ScreenshotTest::createDialogByName | ( | const OString & | rName | ) |
Dialog creation for known dialogs by Name (path and UIXMLDescription, *.ui file).
This uses maKnownDialogs to check if known, and if so, calls createDialogByID with the ID from the map
Definition at line 127 of file screenshot_test.cxx.
References createDialogByID(), and maKnownDialogs.
Referenced by processDialogBatchFile().
void ScreenshotTest::dumpDialogToPath | ( | std::string_view | rUIXMLDescription | ) |
fallback version for dialogs for which only the UXMLDescription is known.
This should be used with care - no active layouting will be done, only the VclBuilder will be activated for layouting. Result can thus vary drastically compared to the active dialog (can be compared with dialog previewer)
Definition at line 199 of file screenshot_test.cxx.
References Application::CreateBuilder(), dumpDialogToPath(), and mxParentWidget.
void ScreenshotTest::dumpDialogToPath | ( | VclAbstractDialog & | rDialog | ) |
version for AbstractDialogs, the ones created in AbstractDialogFactories
Definition at line 139 of file screenshot_test.cxx.
References a, VclAbstractDialog::getAllPageUIXMLDescriptions(), saveScreenshot(), and VclAbstractDialog::selectPageByUIXMLDescription().
|
private |
helper method to create and dump a dialog based on Builder contents.
Definition at line 163 of file screenshot_test.cxx.
References weld::Builder::create_screenshot_window(), weld::Widget::get_buildable_name(), weld::Widget::get_help_id(), i, saveScreenshot(), and weld::Builder::weld_notebook().
Referenced by dumpDialogToPath(), processAllKnownDialogs(), and processDialogBatchFile().
|
inline |
const access to known dialogs
Definition at line 91 of file screenshot_test.hxx.
Referenced by processAllKnownDialogs().
|
private |
helpers
Definition at line 74 of file screenshot_test.cxx.
References g_aScreenshotDirectory(), SvStream::GetErrorCode(), test::Directories::getURLFromWorkdir(), SvFileStream::IsOpen(), test::BootstrapFixtureBase::m_directories, maCurrentLanguage, OUStringToOString(), and vcl::PngImageWriter::write().
Referenced by saveScreenshot().
void ScreenshotTest::processAllKnownDialogs | ( | ) |
helper to process all known dialogs
Definition at line 224 of file screenshot_test.cxx.
References createDialogByID(), dumpDialogToPath(), and getKnownDialogs().
void ScreenshotTest::processDialogBatchFile | ( | std::u16string_view | rFile | ) |
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:
Definition at line 244 of file screenshot_test.cxx.
References aURL, createDialogByName(), dumpDialogToPath(), test::Directories::getURLFromSrc(), and SvStream::ReadLine().
|
privatepure virtual |
|
private |
Definition at line 99 of file screenshot_test.cxx.
References VclAbstractDialog::createScreenshot(), VclAbstractDialog::GetScreenshotId(), implSaveScreenshot(), and BitmapEx::IsEmpty().
Referenced by dumpDialogToPath().
|
private |
Definition at line 114 of file screenshot_test.cxx.
References weld::Widget::get_help_id(), implSaveScreenshot(), BitmapEx::IsEmpty(), and weld::Window::screenshot().
|
overridevirtual |
Reimplemented from test::BootstrapFixture.
Definition at line 58 of file screenshot_test.cxx.
References g_aScreenshotDirectory(), comphelper::getComponentContext(), test::BootstrapFixtureBase::getMultiServiceFactory(), test::Directories::getURLFromWorkdir(), test::BootstrapFixtureBase::m_directories, maKnownDialogs, unotest::MacrosTest::mxDesktop, registerKnownDialogsByID(), and test::BootstrapFixture::setUp().
|
private |
The current UI language.
Definition at line 30 of file screenshot_test.hxx.
Referenced by implSaveScreenshot(), and ScreenshotTest().
|
private |
the set of known dialogs and their ID for usage in createDialogByID
Definition at line 33 of file screenshot_test.hxx.
Referenced by createDialogByName(), and setUp().
|
private |
parent for non-dialog buildables
Definition at line 36 of file screenshot_test.hxx.
|
private |
Definition at line 37 of file screenshot_test.hxx.
Referenced by dumpDialogToPath().