diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-19 09:58:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-19 09:02:32 +0000 |
commit | d890ec2f130188af9d998abf5968f06e7218b7a4 (patch) | |
tree | bb3e4416c1d39c508cf2fd7a83f186722a716cb1 /desktop | |
parent | e420085f6f106cd78b70ffc3abd02e32123230f4 (diff) |
tdf#101592 sw: track changes state is doc-specific, not view-specific
So update the bindings of all views after changing it.
Change-Id: I5355f40ba27be521dcdf343b08305f3736979bbb
Reviewed-on: https://gerrit.libreoffice.org/28233
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 34 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 3 |
2 files changed, 35 insertions, 2 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a1e7cc04df93..b356535e1a4d 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -29,6 +29,9 @@ #include <svl/srchitem.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <unotools/tempfile.hxx> +#include <sfx2/viewsh.hxx> +#include <sfx2/viewfrm.hxx> +#include <sfx2/bindings.hxx> #include <cairo.h> #include <lib/init.hxx> @@ -42,7 +45,8 @@ public: DesktopLOKTest() : UnoApiTest("/desktop/qa/data/"), m_nSelectionBeforeSearchResult(0), m_nSelectionAfterSearchResult(0), - m_bModified(false) + m_bModified(false), + m_nTrackChanges(0) { } @@ -93,6 +97,7 @@ public: void testContextMenuImpress(); void testNotificationCompression(); void testRedlineWriter(); + void testTrackChanges(); CPPUNIT_TEST_SUITE(DesktopLOKTest); CPPUNIT_TEST(testGetStyles); @@ -121,6 +126,7 @@ public: CPPUNIT_TEST(testContextMenuImpress); CPPUNIT_TEST(testNotificationCompression); CPPUNIT_TEST(testRedlineWriter); + CPPUNIT_TEST(testTrackChanges); CPPUNIT_TEST_SUITE_END(); uno::Reference<lang::XComponent> mxComponent; @@ -137,6 +143,7 @@ public: // for testModifiedStatus osl::Condition m_aStateChangedCondition; bool m_bModified; + int m_nTrackChanges; // for testContextMenu{Calc, Writer} osl::Condition m_aContextMenuCondition; @@ -226,6 +233,8 @@ void DesktopLOKTest::callbackImpl(int nType, const char* pPayload) m_bModified = aPayload.copy(aPrefix.getLength()).toBoolean(); m_aStateChangedCondition.set(); } + else if (aPayload.startsWith(".uno:TrackChanges=") && aPayload.endsWith("=true")) + ++m_nTrackChanges; } break; case LOK_CALLBACK_CONTEXT_MENU: @@ -790,6 +799,29 @@ void DesktopLOKTest::testModifiedStatus() comphelper::LibreOfficeKit::setActive(false); } +void DesktopLOKTest::testTrackChanges() +{ + // Load a document and create two views. + LibLibreOffice_Impl aOffice; + comphelper::LibreOfficeKit::setActive(); + LibLODocument_Impl* pDocument = loadDoc("blank_text.odt"); + pDocument->pClass->initializeForRendering(pDocument, nullptr); + pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); + pDocument->pClass->createView(pDocument); + pDocument->pClass->initializeForRendering(pDocument, nullptr); + pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this); + Scheduler::ProcessEventsToIdle(); + + // Enable trak changes and assert that both views get notified. + m_nTrackChanges = 0; + pDocument->pClass->postUnoCommand(pDocument, ".uno:TrackChanges", nullptr, false); + Scheduler::ProcessEventsToIdle(); + // This was 1, only the active view was notified. + CPPUNIT_ASSERT_EQUAL(2, m_nTrackChanges); + + comphelper::LibreOfficeKit::setActive(false); +} + void DesktopLOKTest::testSheetOperations() { comphelper::LibreOfficeKit::setActive(); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 17955e850197..6199979fa094 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1032,7 +1032,8 @@ static void doc_iniUnoCommands () OUString(".uno:NumberFormatPercent"), OUString(".uno:NumberFormatDate"), OUString(".uno:SortAscending"), - OUString(".uno:SortDescending") + OUString(".uno:SortDescending"), + OUString(".uno:TrackChanges"), }; util::URL aCommandURL; |