From 77dd7f82911b2e8cd076dd71f3b3901b84fb98d6 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 30 Mar 2016 05:14:50 +0200 Subject: uitest: a slightly better approach for the factory problem in the ui testing Change-Id: I15dbf2446791c4be9be4e18e63c0d03104d8d405 --- sfx2/Library_sfx.mk | 1 - sfx2/inc/uitest/uitest_factory.hxx | 21 --------------------- sfx2/source/dialog/tabdlg.cxx | 14 ++++++-------- sfx2/source/uitest/factory.cxx | 26 -------------------------- sfx2/source/uitest/sfx_uiobject.cxx | 9 ++------- 5 files changed, 8 insertions(+), 63 deletions(-) delete mode 100644 sfx2/inc/uitest/uitest_factory.hxx delete mode 100644 sfx2/source/uitest/factory.cxx (limited to 'sfx2') diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index ac848db0356c..696402b6eb0b 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -286,7 +286,6 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/styles/StyleManager \ sfx2/source/toolbox/imgmgr \ sfx2/source/toolbox/tbxitem \ - sfx2/source/uitest/factory \ sfx2/source/uitest/sfx_uiobject \ sfx2/source/view/classificationcontroller \ sfx2/source/view/classificationhelper \ diff --git a/sfx2/inc/uitest/uitest_factory.hxx b/sfx2/inc/uitest/uitest_factory.hxx deleted file mode 100644 index b2d298f5a6eb..000000000000 --- a/sfx2/inc/uitest/uitest_factory.hxx +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- 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 - -class SfxUITestFactory -{ -public: - - static void registerSfxTabDialog(); - - static void registerSfxTabPage(); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index c61c1e285f13..4b33e3171006 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -37,7 +37,7 @@ #include #include -#include "uitest/uitest_factory.hxx" +#include "uitest/sfx_uiobject.hxx" #include "dialog.hrc" #include "helpid.hrc" @@ -329,13 +329,6 @@ SfxTabDialog::SfxTabDialog , m_pExampleSet(nullptr) { Init_Impl(bEditFmt); - - static bool bRegisterUITest = false; - if (!bRegisterUITest) - { - SfxUITestFactory::registerSfxTabDialog(); - bRegisterUITest = true; - } } @@ -1334,4 +1327,9 @@ void SfxTabDialog::SetInputSet( const SfxItemSet* pInSet ) } } +FactoryFunction SfxTabDialog::GetUITestFactory() const +{ + return SfxTabDialogUIObject::create; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/uitest/factory.cxx b/sfx2/source/uitest/factory.cxx deleted file mode 100644 index 447943706ed1..000000000000 --- a/sfx2/source/uitest/factory.cxx +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- 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 -#include - -#include - - -void SfxUITestFactory::registerSfxTabDialog() -{ - registerUITestFactory(WINDOW_TABDIALOG, FactoryFunction(SfxTabDialogUIObject::create)); -} - -void SfxUITestFactory::registerSfxTabPage() -{ - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/uitest/sfx_uiobject.cxx b/sfx2/source/uitest/sfx_uiobject.cxx index 590ffd3a95ac..d42798781e1a 100644 --- a/sfx2/source/uitest/sfx_uiobject.cxx +++ b/sfx2/source/uitest/sfx_uiobject.cxx @@ -37,13 +37,8 @@ UIObjectType SfxTabDialogUIObject::get_type() const std::unique_ptr SfxTabDialogUIObject::create(vcl::Window* pWindow) { SfxTabDialog* pDialog = dynamic_cast(pWindow); - - if (pDialog) - { - return std::unique_ptr(new SfxTabDialogUIObject(pDialog)); - } - - return nullptr; + assert(pDialog); + return std::unique_ptr(new SfxTabDialogUIObject(pDialog)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit