sw/qa/extras/tiledrendering/tiledrendering.cxx | 38 +++++++ sw/qa/extras/tiledrendering/tiledrendering2.cxx | 19 +++ sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx | 59 ------------ 3 files changed, 55 insertions(+), 61 deletions(-)
New commits: commit 8f16b069d08bb5b17eb2220c380f7f45fa522358 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Jan 8 08:50:38 2025 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jan 8 09:58:28 2025 +0100 sw: stop including .cxx files in Writer tests The remaining 2 classes are not used in multiple .cxx files, so just move them closer to their only user. Change-Id: I7c7b295e21ea97acf33d7f4a60a61b25788ab5c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179926 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 284e2e46cdf4..8b9387d2afb1 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -7,17 +7,21 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "tiledrenderingmodeltestbase.cxx" +#include <swtiledrenderingtest.hxx> #include <string> #include <string_view> +#include <boost/property_tree/json_parser.hpp> + #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/text/AuthorDisplayFormat.hpp> #include <com/sun/star/datatransfer/XTransferable2.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/DispatchResultState.hpp> #include <test/helper/transferable.hxx> #include <comphelper/dispatchcommand.hxx> @@ -45,6 +49,10 @@ #include <unotools/mediadescriptor.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <sfx2/lokhelper.hxx> +#include <comphelper/lok.hxx> +#include <comphelper/string.hxx> #include <drawdoc.hxx> #include <ndtxt.hxx> @@ -59,7 +67,11 @@ #include <txtfrm.hxx> #include <rootfrm.hxx> #include <fmtanchr.hxx> +#include <docsh.hxx> +#include <wrtsh.hxx> +#include <unotxdoc.hxx> #include <textcontentcontrol.hxx> +#include <swtestviewcallback.hxx> static std::ostream& operator<<(std::ostream& os, ViewShellId id) { @@ -1713,6 +1725,30 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testPaintCallbacks) CPPUNIT_ASSERT(!aView1.m_bCalled); } +namespace +{ +class TestResultListener : public cppu::WeakImplHelper<css::frame::XDispatchResultListener> +{ +public: + sal_uInt32 m_nDocRepair; + + TestResultListener() + : m_nDocRepair(0) + { + } + + virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& rEvent) override + { + if (rEvent.State == frame::DispatchResultState::SUCCESS) + { + rEvent.Result >>= m_nDocRepair; + } + } + + virtual void SAL_CALL disposing(const css::lang::EventObject&) override {} +}; +} + CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testUndoRepairResult) { // Load a document and create two views. diff --git a/sw/qa/extras/tiledrendering/tiledrendering2.cxx b/sw/qa/extras/tiledrendering/tiledrendering2.cxx index b3512b700ed3..eedd023388ca 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering2.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering2.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "tiledrenderingmodeltestbase.cxx" +#include <swtiledrenderingtest.hxx> #include <com/sun/star/util/URLTransformer.hpp> @@ -20,11 +20,17 @@ #include <vcl/scheduler.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/dispatchcommand.hxx> +#include <sfx2/lokhelper.hxx> +#include <comphelper/lok.hxx> +#include <unotxdoc.hxx> #include <view.hxx> #include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> +#include <docsh.hxx> +#include <wrtsh.hxx> +#include <swtestviewcallback.hxx> namespace { @@ -188,6 +194,17 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testAsyncLayout) CPPUNIT_ASSERT(!pPage3->IsInvalidContent()); } +/// Test callback that works with comphelper::LibreOfficeKit::setAnyInputCallback(). +class AnyInputCallback final +{ +public: + static bool callback(void* /*pData*/) { return true; } + + AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(&callback, this); } + + ~AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(nullptr, nullptr); } +}; + CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testAnyInput) { // Given a document with 3 pages, the first page is visible: diff --git a/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx b/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx deleted file mode 100644 index df8cd65b8e5b..000000000000 --- a/sw/qa/extras/tiledrendering/tiledrenderingmodeltestbase.cxx +++ /dev/null @@ -1,59 +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 <swtiledrenderingtest.hxx> -#include <swtestviewcallback.hxx> - -#include <com/sun/star/frame/DispatchResultState.hpp> -#include <com/sun/star/frame/XDispatchResultListener.hpp> -#include <boost/property_tree/json_parser.hpp> -#include <swmodule.hxx> -#include <swdll.hxx> -#include <sfx2/lokhelper.hxx> -#include <test/lokcallback.hxx> -#include <LibreOfficeKit/LibreOfficeKitEnums.h> -#include <comphelper/lok.hxx> -#include <comphelper/string.hxx> -#include <docsh.hxx> -#include <unotxdoc.hxx> -#include <wrtsh.hxx> - -class TestResultListener : public cppu::WeakImplHelper<css::frame::XDispatchResultListener> -{ -public: - sal_uInt32 m_nDocRepair; - - TestResultListener() - : m_nDocRepair(0) - { - } - - virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent& rEvent) override - { - if (rEvent.State == frame::DispatchResultState::SUCCESS) - { - rEvent.Result >>= m_nDocRepair; - } - } - - virtual void SAL_CALL disposing(const css::lang::EventObject&) override {} -}; - -/// Test callback that works with comphelper::LibreOfficeKit::setAnyInputCallback(). -class AnyInputCallback final -{ -public: - static bool callback(void* /*pData*/) { return true; } - - AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(&callback, this); } - - ~AnyInputCallback() { comphelper::LibreOfficeKit::setAnyInputCallback(nullptr, nullptr); } -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */