diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-08 14:33:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-08 19:12:46 +0200 |
commit | 9a02f4ed071f15908624fb1cafcf6dbb72b00a1b (patch) | |
tree | eddc701e80ca6a7488798687e3f6d109b8cdefb4 /test | |
parent | 52f50ffd67de9d2e2253226b2d7f590fe45c7313 (diff) |
make testCondFormatFormulaListenerXLSX reliable
Change-Id: Ibd8c9b7831af73967229c578b9dcf7217d800610
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157686
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/Library_test.mk | 1 | ||||
-rw-r--r-- | test/source/idletask.cxx | 50 |
2 files changed, 51 insertions, 0 deletions
diff --git a/test/Library_test.mk b/test/Library_test.mk index 268a68744eaf..951ddf6edab2 100644 --- a/test/Library_test.mk +++ b/test/Library_test.mk @@ -50,6 +50,7 @@ $(eval $(call gb_Library_add_exception_objects,test,\ test/source/callgrind \ test/source/xmltesttools \ test/source/htmltesttools \ + test/source/idletask \ test/source/screenshot_test \ test/source/unoapi_property_testers \ test/source/lokcallback \ diff --git a/test/source/idletask.cxx b/test/source/idletask.cxx new file mode 100644 index 000000000000..904d98eb1e24 --- /dev/null +++ b/test/source/idletask.cxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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 <test/idletask.hxx> +#include <vcl/svapp.hxx> + +//constructor of IdleTask Class +IdleTask::IdleTask() + : flag(false) +{ + //setting the Priority of Idle task to LOW, LOWEST + maIdle.SetPriority(TaskPriority::LOWEST); + //set idle for callback + maIdle.SetInvokeHandler(LINK(this, IdleTask, FlipFlag)); + //starting the idle + maIdle.Start(); +} + +//GetFlag() of IdleTask Class +bool IdleTask::GetFlag() const +{ + //returning the status of current flag + return flag; +} + +//Callback function of IdleTask Class +IMPL_LINK(IdleTask, FlipFlag, Timer*, , void) +{ + //setting the flag to make sure that low priority idle task has been dispatched + flag = true; +} + +void IdleTask::waitUntilIdleDispatched() +{ + //creating instance of IdleTask Class + IdleTask idleTask; + while (!idleTask.GetFlag()) + { + //dispatching all the events via VCL main-loop + Application::Yield(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |