summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx34
-rw-r--r--desktop/source/lib/init.cxx3
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 29b3d0224b73..ffacd4c8458a 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -30,6 +30,9 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <unotools/tempfile.hxx>
#include <vcl/svapp.hxx>
+#include <sfx2/viewsh.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/bindings.hxx>
#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(testModifiedStatus);
@@ -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:
@@ -793,6 +802,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 cc2ab9f5d101..0a9f2b2a3018 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1046,7 +1046,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;