diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-12-09 12:12:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-12-09 13:39:27 +0000 |
commit | 19a4eaab9a55a2ecb33b727bad6307c5a2badc23 (patch) | |
tree | d6ec1d1d22d29256e77cd62e89d9effa06dec46e /vcl/qa | |
parent | d96686e482d2f2649dbd87d7ed9db2775e5d22f5 (diff) |
tdf#100337 Message boxes showup empty with white background
the bug here was that we had, on the stack, going into the scheduler
THREE times. Two of those were idles.
The original code would end up always picking the first idle from inside
ImplSchedulerData::GetMostImportantTask
and then
ImplSchedulerData::Invoke
would just return because we were still inside that Idle, and the second
Idle would never get executed
Since the second Idle was responsible for painting the dialog in the
bug, sometimes the dialog would never get painted.
Change-Id: Ia15b98a06e231c8e1c29450e05a76ad427e41e36
Reviewed-on: https://gerrit.libreoffice.org/31785
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl/qa')
-rw-r--r-- | vcl/qa/cppunit/timer.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx index 07fdc92ffbac..ca7a0284e91a 100644 --- a/vcl/qa/cppunit/timer.cxx +++ b/vcl/qa/cppunit/timer.cxx @@ -66,6 +66,7 @@ public: #endif void testRecursiveTimer(); void testSlowTimerCallback(); + void testTriggerIdleFromIdle(); CPPUNIT_TEST_SUITE(TimerTest); CPPUNIT_TEST(testIdle); @@ -80,6 +81,7 @@ public: #endif CPPUNIT_TEST(testRecursiveTimer); CPPUNIT_TEST(testSlowTimerCallback); + CPPUNIT_TEST(testTriggerIdleFromIdle); CPPUNIT_TEST_SUITE_END(); }; @@ -353,6 +355,39 @@ void TimerTest::testSlowTimerCallback() Application::Yield(); } + +class TriggerIdleFromIdle : public Idle +{ + bool* mpTriggered; + TriggerIdleFromIdle* mpOther; +public: + explicit TriggerIdleFromIdle( bool* pTriggered, TriggerIdleFromIdle* pOther ) : + Idle(), mpTriggered(pTriggered), mpOther(pOther) + { + } + virtual void Invoke() override + { + Start(); + if (mpOther) + mpOther->Start(); + Application::Yield(); + if (mpTriggered) + *mpTriggered = true; + } +}; + +void TimerTest::testTriggerIdleFromIdle() +{ + bool bTriggered1 = false; + bool bTriggered2 = false; + TriggerIdleFromIdle aTest2( &bTriggered2, nullptr ); + TriggerIdleFromIdle aTest1( &bTriggered1, &aTest2 ); + aTest1.Start(); + Application::Yield(); + CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered1); + CPPUNIT_ASSERT_MESSAGE("idle triggered", bTriggered2); +} + CPPUNIT_TEST_SUITE_REGISTRATION(TimerTest); CPPUNIT_PLUGIN_IMPLEMENT(); |