diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-11-03 16:52:46 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-11-03 16:59:05 +0100 |
commit | b846b03c709130564527da8d264660a131361221 (patch) | |
tree | d0f4ec85738f8b90523631114dae9b2e52b8cce4 /desktop/qa | |
parent | a4988d227c3933721098b2a61a087ec18eaa6c8e (diff) |
lok: Fix crash due to non-initialized callback.
Yay for unit tests! :-)
Change-Id: I06b3f929b53d5c03f5722acfdaf0eaf841325e34
Diffstat (limited to 'desktop/qa')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index cc48f130db99..8a1947e123b3 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -394,16 +394,25 @@ void DesktopLOKTest::testRowColumnHeaders() void DesktopLOKTest::testCommandResult() { LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); - pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); // the postUnoCommand() is supposed to be async, let's test it safely // [no idea if it is async in reality - most probably we are operating // under some solar mutex or something anyway ;-) - but...] - m_aCommandResultCondition.reset(); + TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max + // nothing is triggered when we have no callback yet, we just time out on + // the condition var. + m_aCommandResultCondition.reset(); pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", 0, true); + m_aCommandResultCondition.wait(aTimeValue); - TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max + CPPUNIT_ASSERT(m_aCommandResult.isEmpty()); + + // but we get some real values when the callback is set up + pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); + + m_aCommandResultCondition.reset(); + pDocument->pClass->postUnoCommand(pDocument, ".uno:Bold", 0, true); m_aCommandResultCondition.wait(aTimeValue); boost::property_tree::ptree aTree; |