summaryrefslogtreecommitdiff
path: root/desktop/qa/desktop_lib/test_desktop_lib.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/qa/desktop_lib/test_desktop_lib.cxx')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx37
1 files changed, 28 insertions, 9 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index ad0412251455..0475e6c460e4 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -46,6 +46,8 @@
#include <sfx2/viewsh.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
+#include <sfx2/sidebar/SidebarController.hxx>
+#include <sfx2/sidebar/SidebarDockingWindow.hxx>
#include <unotools/datetime.hxx>
#include <unotools/syslocaleoptions.hxx>
#include <comphelper/string.hxx>
@@ -3267,10 +3269,35 @@ void DesktopLOKTest::testMultiDocuments()
}
}
+namespace
+{
+ SfxChildWindow* lcl_initializeSidebar()
+ {
+ // in init.cxx we do setupSidebar which creaes the controller, do it here
+
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ CPPUNIT_ASSERT(pViewShell);
+
+ SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+ CPPUNIT_ASSERT(pViewFrame);
+
+ SfxChildWindow* pSideBar = pViewFrame->GetChildWindow(SID_SIDEBAR);
+ CPPUNIT_ASSERT(pSideBar);
+
+ auto pDockingWin = dynamic_cast<sfx2::sidebar::SidebarDockingWindow *>(pSideBar->GetWindow());
+ CPPUNIT_ASSERT(pDockingWin);
+
+ pDockingWin->GetOrCreateSidebarController(); // just to create the controller
+
+ return pSideBar;
+ }
+};
+
void DesktopLOKTest::testControlState()
{
LibLODocument_Impl* pDocument = loadDoc("search.ods");
pDocument->pClass->postUnoCommand(pDocument, ".uno:StarShapes", nullptr, false);
+ lcl_initializeSidebar();
Scheduler::ProcessEventsToIdle();
boost::property_tree::ptree aState;
@@ -3284,17 +3311,9 @@ void DesktopLOKTest::testMetricField()
{
LibLODocument_Impl* pDocument = loadDoc("search.ods");
pDocument->pClass->postUnoCommand(pDocument, ".uno:StarShapes", nullptr, false);
+ SfxChildWindow* pSideBar = lcl_initializeSidebar();
Scheduler::ProcessEventsToIdle();
- SfxViewShell* pViewShell = SfxViewShell::Current();
- CPPUNIT_ASSERT(pViewShell);
-
- SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
- CPPUNIT_ASSERT(pViewFrame);
-
- SfxChildWindow* pSideBar = pViewFrame->GetChildWindow(SID_SIDEBAR);
- CPPUNIT_ASSERT(pSideBar);
-
vcl::Window* pWin = pSideBar->GetWindow();
CPPUNIT_ASSERT(pWin);