desktop/qa/desktop_lib/test_desktop_lib.cxx  |   90 +--------------------------
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   59 -----------------
 uitest/calc_tests/create_chart.py            |   29 +++-----
 3 files changed, 18 insertions(+), 160 deletions(-)

New commits:
commit 13fb343e3c48439c6cd7365f9a69ba2261885beb
Author:     Ashod Nakashian <ashod.nakash...@collabora.co.uk>
AuthorDate: Sun Nov 11 16:54:59 2018 -0500
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Wed Oct 2 16:50:13 2019 +0200

    LOK: disable LOKit in unit-tests only after destroying all
    
    When we disable LOKit at the end of a unit-test, we do so
    before any of the smart-pointers go out of scope. These
    instances are then destroyed when LOKit is no longer active,
    in spite of the fact that they were created while it was.
    
    This leaves some dialog/window routing notifiers dangling,
    which cause assertion failures and access-after-free (when
    they are invoked on destruction inadvertently). The latter
    issue was found with 'make CppunitTest_sd_tiledrendering
    VALGRIND=memcheck'.
    
    The fix is to move these flags to the setup and teardown
    stages of cpp-unit.
    
    Change-Id: Ic4481305ca1a5cca14d70a4ebbc820a3fdeea9cc
    Reviewed-on: https://gerrit.libreoffice.org/80028
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index eb3c713560ee..e16bc91aecb7 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -72,7 +72,10 @@ public:
 
     virtual void setUp() override
     {
+        comphelper::LibreOfficeKit::setActive(true);
+
         UnoApiTest::setUp();
+
         
mxDesktop.set(frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
         SfxApplication::GetOrCreate();
     };
@@ -82,9 +85,9 @@ public:
         if (m_pDocument)
             m_pDocument->pClass->registerCallback(m_pDocument.get(), nullptr, 
nullptr);
         closeDoc();
-        comphelper::LibreOfficeKit::setActive(false);
-
         UnoApiTest::tearDown();
+
+        comphelper::LibreOfficeKit::setActive(false);
     };
 
     LibLODocument_Impl* loadDoc(const char* pName, LibreOfficeKitDocumentType 
eType = LOK_DOCTYPE_TEXT);
@@ -349,7 +352,6 @@ void DesktopLOKTest::callbackImpl(int nType, const char* 
pPayload)
 
 void DesktopLOKTest::testGetStyles()
 {
-    comphelper::LibreOfficeKit::setActive();
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     boost::property_tree::ptree aTree;
     char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, 
".uno:StyleApply");
@@ -384,7 +386,6 @@ void DesktopLOKTest::testGetStyles()
 
 void DesktopLOKTest::testGetFonts()
 {
-    comphelper::LibreOfficeKit::setActive();
     LibLODocument_Impl* pDocument = loadDoc("blank_presentation.odp");
     boost::property_tree::ptree aTree;
     char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, 
".uno:CharFontName");
@@ -405,7 +406,6 @@ void DesktopLOKTest::testGetFonts()
 
 void DesktopLOKTest::testCreateView()
 {
-    comphelper::LibreOfficeKit::setActive();
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     CPPUNIT_ASSERT_EQUAL(1, 
pDocument->m_pDocumentClass->getViewsCount(pDocument));
 
@@ -431,7 +431,6 @@ void DesktopLOKTest::testCreateView()
 
 void DesktopLOKTest::testGetPartPageRectangles()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Test that we get as many page rectangles as expected: blank document is
     // one page.
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
@@ -454,7 +453,6 @@ void DesktopLOKTest::testGetPartPageRectangles()
 
 void DesktopLOKTest::testGetFilterTypes()
 {
-    comphelper::LibreOfficeKit::setActive();
     LibLibreOffice_Impl aOffice;
     char* pJSON = aOffice.m_pOfficeClass->getFilterTypes(&aOffice);
 
@@ -469,8 +467,6 @@ void DesktopLOKTest::testGetFilterTypes()
 
 void DesktopLOKTest::testSearchCalc()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLibreOffice_Impl aOffice;
     LibLODocument_Impl* pDocument = loadDoc("search.ods");
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
@@ -502,8 +498,6 @@ void DesktopLOKTest::testSearchCalc()
 
 void DesktopLOKTest::testSearchAllNotificationsCalc()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLibreOffice_Impl aOffice;
     LibLODocument_Impl* pDocument = loadDoc("search.ods");
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
@@ -526,8 +520,6 @@ void DesktopLOKTest::testSearchAllNotificationsCalc()
 
 void DesktopLOKTest::testPaintTile()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     int nCanvasWidth = 100;
     int nCanvasHeight = 300;
@@ -554,8 +546,6 @@ void DesktopLOKTest::testPaintTile()
 
 void DesktopLOKTest::testSaveAs()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     utl::TempFile aTempFile;
     aTempFile.EnableKillingFile();
@@ -564,8 +554,6 @@ void DesktopLOKTest::testSaveAs()
 
 void DesktopLOKTest::testSaveAsCalc()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("search.ods");
     utl::TempFile aTempFile;
     aTempFile.EnableKillingFile();
@@ -574,8 +562,6 @@ void DesktopLOKTest::testSaveAsCalc()
 
 void DesktopLOKTest::testPasteWriter()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     OString aText("hello");
 
@@ -613,8 +599,6 @@ void DesktopLOKTest::testPasteWriter()
 
 void DesktopLOKTest::testPasteWriterJPEG()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
 
     OUString aFileURL;
@@ -648,8 +632,6 @@ void DesktopLOKTest::testPasteWriterJPEG()
 void DesktopLOKTest::testUndoWriter()
 {
     // Load a Writer document and press a key.
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0);
     pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 't', 0);
@@ -696,8 +678,6 @@ void DesktopLOKTest::testRowColumnHeaders()
      * "size" defines the bottom/right boundary of a row/column in twips (size 
between 0 and boundary)
      * "text" has the header label in UTF-8
      */
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("search.ods");
 
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
@@ -779,8 +759,6 @@ void DesktopLOKTest::testRowColumnHeaders()
 
 void DesktopLOKTest::testHiddenRowHeaders()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("hidden-row.ods");
 
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
@@ -819,8 +797,6 @@ void DesktopLOKTest::testHiddenRowHeaders()
 
 void DesktopLOKTest::testCellCursor()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("search.ods");
 
     boost::property_tree::ptree aTree;
@@ -840,8 +816,6 @@ void DesktopLOKTest::testCellCursor()
 
 void DesktopLOKTest::testCommandResult()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
 
     // the postUnoCommand() is supposed to be async, let's test it safely
@@ -876,8 +850,6 @@ void DesktopLOKTest::testCommandResult()
 
 void DesktopLOKTest::testWriterComments()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, 
this);
     uno::Reference<awt::XReschedule> xToolkit = 
com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext());
@@ -917,8 +889,6 @@ void DesktopLOKTest::testWriterComments()
 
 void DesktopLOKTest::testTrackChanges()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load a document and create two views.
     LibLibreOffice_Impl aOffice;
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
@@ -939,8 +909,6 @@ void DesktopLOKTest::testTrackChanges()
 
 void DesktopLOKTest::testSheetOperations()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("sheets.ods");
 
     // insert the last sheet
@@ -971,8 +939,6 @@ void DesktopLOKTest::testSheetOperations()
 
 void DesktopLOKTest::testSheetSelections()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("sheets.ods", 
LOK_DOCTYPE_SPREADSHEET);
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
     pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, 
this);
@@ -1152,8 +1118,6 @@ namespace {
 
 void DesktopLOKTest::testContextMenuCalc()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("sheet_with_image.ods", 
LOK_DOCTYPE_SPREADSHEET);
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
     pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, 
this);
@@ -1262,8 +1226,6 @@ void DesktopLOKTest::testContextMenuCalc()
 
 void DesktopLOKTest::testContextMenuWriter()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
     pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, 
this);
@@ -1317,8 +1279,6 @@ void DesktopLOKTest::testContextMenuWriter()
 
 void DesktopLOKTest::testContextMenuImpress()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_presentation.odp", 
LOK_DOCTYPE_PRESENTATION);
     pDocument->pClass->initializeForRendering(pDocument, nullptr);
     pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, 
this);
@@ -1449,8 +1409,6 @@ static void callbackCompressionTest(const int type, const 
char* payload, void* d
 
 void DesktopLOKTest::testNotificationCompression()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     std::vector<std::tuple<int, std::string>> notifs;
     std::unique_ptr<CallbackFlushHandler> handler(new 
CallbackFlushHandler(pDocument, callbackCompressionTest, &notifs));
@@ -1537,8 +1495,6 @@ void DesktopLOKTest::testNotificationCompression()
 
 void DesktopLOKTest::testTileInvalidationCompression()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
 
     comphelper::LibreOfficeKit::setPartInInvalidation(true);
@@ -1674,8 +1630,6 @@ void DesktopLOKTest::testTileInvalidationCompression()
 
 void DesktopLOKTest::testPartInInvalidation()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     // No part in invalidation: merge.
     {
@@ -1747,8 +1701,6 @@ void DesktopLOKTest::testPartInInvalidation()
 
 void DesktopLOKTest::testRedlineWriter()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load a Writer document, enable change recording and press a key.
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, 
uno::UNO_QUERY);
@@ -1777,8 +1729,6 @@ void DesktopLOKTest::testRedlineWriter()
 void DesktopLOKTest::testRedlineCalc()
 {
     // Load a Writer document, enable change recording and press a key.
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("sheets.ods");
     uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, 
uno::UNO_QUERY);
     xPropertySet->setPropertyValue("RecordChanges", uno::makeAny(true));
@@ -1876,7 +1826,6 @@ public:
 void DesktopLOKTest::testPaintPartTile()
 {
     // Load an impress doc of 2 slides.
-    comphelper::LibreOfficeKit::setActive();
 
 //    ViewCallback aView1;
 //    ViewCallback aView2;
@@ -1919,8 +1868,6 @@ void DesktopLOKTest::testPaintPartTile()
 void DesktopLOKTest::testWriterCommentInsertCursor()
 {
     // Load a document and type a character into the body text of the second 
view.
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
     ViewCallback aView1(pDocument);
@@ -1955,8 +1902,6 @@ void DesktopLOKTest::testWriterCommentInsertCursor()
 #if HAVE_MORE_FONTS
 void DesktopLOKTest::testGetFontSubset()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     OUString aFontName = rtl::Uri::encode(
         OUString("Liberation Sans"),
@@ -1979,7 +1924,6 @@ void DesktopLOKTest::testGetFontSubset()
 
 void DesktopLOKTest::testCommentsWriter()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Disable tiled rendering for comments
     comphelper::LibreOfficeKit::setTiledAnnotations(false);
 
@@ -2032,7 +1976,6 @@ void DesktopLOKTest::testCommentsWriter()
 
 void DesktopLOKTest::testCommentsCalc()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Disable tiled rendering for comments
     comphelper::LibreOfficeKit::setTiledAnnotations(false);
 
@@ -2083,7 +2026,6 @@ void DesktopLOKTest::testCommentsCalc()
 
 void DesktopLOKTest::testCommentsImpress()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Disable tiled rendering for comments
     comphelper::LibreOfficeKit::setTiledAnnotations(false);
 
@@ -2139,7 +2081,6 @@ void DesktopLOKTest::testCommentsImpress()
 
 void DesktopLOKTest::testCommentsCallbacksWriter()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Comments callback are emitted only if tiled annotations are off
     comphelper::LibreOfficeKit::setTiledAnnotations(false);
     LibLODocument_Impl* pDocument = loadDoc("comments.odt");
@@ -2223,8 +2164,6 @@ void DesktopLOKTest::testCommentsCallbacksWriter()
 
 void DesktopLOKTest::testRunMacro()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLibreOffice_Impl aOffice;
     bool bGoodMacro, bNonExistentMacro;
 
@@ -2238,8 +2177,6 @@ void DesktopLOKTest::testRunMacro()
 
 void DesktopLOKTest::testExtractParameter()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     OUString aOptions("Language=de-DE");
     OUString aValue = extractParameter(aOptions, "Language");
     CPPUNIT_ASSERT_EQUAL(OUString("de-DE"), aValue);
@@ -2278,7 +2215,6 @@ void DesktopLOKTest::readFileIntoByteVector(OUString 
const & sFilename, std::vec
 
 void DesktopLOKTest::testGetSignatureState_Signed()
 {
-    comphelper::LibreOfficeKit::setActive();
     LibLODocument_Impl* pDocument = loadDoc("signed.odt");
     Scheduler::ProcessEventsToIdle();
     pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
@@ -2306,7 +2242,6 @@ void DesktopLOKTest::testGetSignatureState_Signed()
 
 void DesktopLOKTest::testGetSignatureState_NonSigned()
 {
-    comphelper::LibreOfficeKit::setActive();
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     Scheduler::ProcessEventsToIdle();
     pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
@@ -2316,8 +2251,6 @@ void DesktopLOKTest::testGetSignatureState_NonSigned()
 
 void DesktopLOKTest::testInsertCertificate_DER_ODT()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load the document, save it into a temp file and load that file again
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     utl::TempFile aTempFile;
@@ -2369,8 +2302,6 @@ void DesktopLOKTest::testInsertCertificate_DER_ODT()
 
 void DesktopLOKTest::testInsertCertificate_PEM_ODT()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load the document, save it into a temp file and load that file again
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     utl::TempFile aTempFile;
@@ -2429,8 +2360,6 @@ void DesktopLOKTest::testInsertCertificate_PEM_ODT()
 
 void DesktopLOKTest::testInsertCertificate_PEM_DOCX()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load the document, save it into a temp file and load that file again
     LibLODocument_Impl* pDocument = loadDoc("blank_text.docx");
     utl::TempFile aTempFile;
@@ -2489,8 +2418,6 @@ void DesktopLOKTest::testInsertCertificate_PEM_DOCX()
 
 void DesktopLOKTest::testSignDocument_PEM_PDF()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load the document, save it into a temp file and load that file again
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     utl::TempFile aTempFile;
@@ -2547,8 +2474,6 @@ void DesktopLOKTest::testSignDocument_PEM_PDF()
 
 void DesktopLOKTest::testTextSelectionHandles()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, 
this);
 
@@ -2588,7 +2513,6 @@ void DesktopLOKTest::testTextSelectionHandles()
 
 void DesktopLOKTest::testDialogPaste()
 {
-    comphelper::LibreOfficeKit::setActive();
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", 
nullptr, false);
     Scheduler::ProcessEventsToIdle();
@@ -2616,7 +2540,6 @@ void DesktopLOKTest::testDialogPaste()
 void DesktopLOKTest::testShowHideDialog()
 {
 
-    comphelper::LibreOfficeKit::setActive();
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
 
     pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
@@ -2641,9 +2564,6 @@ void DesktopLOKTest::testShowHideDialog()
 
 void DesktopLOKTest::testComplexSelection()
 {
-    // needed for SwTransferable to cope with the selection.
-    comphelper::LibreOfficeKit::setActive();
-
     // Start with a blank text file and add contents.
     LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
     static const OString aText("hello world");
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 9422355835b2..cfcf3241e2b9 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -212,6 +212,7 @@ void SdTiledRenderingTest::setUp()
 
     // prevent showing warning message box
     setenv("OOX_NO_SMARTART_WARNING", "1", 1);
+    comphelper::LibreOfficeKit::setActive(true);
 
     
mxDesktop.set(css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
 }
@@ -225,6 +226,7 @@ void SdTiledRenderingTest::tearDown()
         xmlBufferFree(m_pXmlBuffer);
 
     comphelper::LibreOfficeKit::setActive(false);
+
     test::BootstrapFixture::tearDown();
 }
 
@@ -368,7 +370,6 @@ void SdTiledRenderingTest::testCreateView()
 
 void SdTiledRenderingTest::testRegisterCallback()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -388,7 +389,6 @@ void SdTiledRenderingTest::testRegisterCallback()
 
 void SdTiledRenderingTest::testPostKeyEvent()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -417,7 +417,6 @@ void SdTiledRenderingTest::testPostKeyEvent()
 
 void SdTiledRenderingTest::testPostMouseEvent()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -451,7 +450,6 @@ void SdTiledRenderingTest::testPostMouseEvent()
 
 void SdTiledRenderingTest::testSetTextSelection()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     uno::Reference<container::XIndexAccess> 
xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
@@ -480,7 +478,6 @@ void SdTiledRenderingTest::testSetTextSelection()
 
 void SdTiledRenderingTest::testGetTextSelection()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     uno::Reference<container::XIndexAccess> 
xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
@@ -504,7 +501,6 @@ void SdTiledRenderingTest::testGetTextSelection()
 
 void SdTiledRenderingTest::testSetGraphicSelection()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pPage = pViewShell->GetActualPage();
@@ -540,7 +536,6 @@ void SdTiledRenderingTest::testSetGraphicSelection()
 
 void SdTiledRenderingTest::testUndoShells()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Load a document and set the page size.
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     uno::Sequence<beans::PropertyValue> 
aPropertyValues(comphelper::InitPropertySequence(
@@ -562,7 +557,6 @@ void SdTiledRenderingTest::testUndoShells()
 
 void SdTiledRenderingTest::testResetSelection()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     uno::Reference<container::XIndexAccess> 
xDrawPage(pXImpressDocument->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
     uno::Reference<text::XTextRange> xShape(xDrawPage->getByIndex(0), 
uno::UNO_QUERY);
@@ -598,7 +592,6 @@ static void lcl_search(const OUString& rKey, bool bFindAll 
= false)
 
 void SdTiledRenderingTest::testSearch()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -632,7 +625,6 @@ void SdTiledRenderingTest::testSearch()
 
 void SdTiledRenderingTest::testSearchAll()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -651,7 +643,6 @@ void SdTiledRenderingTest::testSearchAll()
 
 void SdTiledRenderingTest::testSearchAllSelections()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -665,7 +656,6 @@ void SdTiledRenderingTest::testSearchAllSelections()
 
 void SdTiledRenderingTest::testSearchAllNotifications()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -679,7 +669,6 @@ void SdTiledRenderingTest::testSearchAllNotifications()
 
 void SdTiledRenderingTest::testSearchAllFollowedBySearch()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("search-all.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -694,7 +683,6 @@ void SdTiledRenderingTest::testSearchAllFollowedBySearch()
 
 void SdTiledRenderingTest::testDontSearchInMasterPages()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -726,7 +714,6 @@ std::vector<OUString> getCurrentParts(SdXImpressDocument* 
pDocument)
 
 void SdTiledRenderingTest::testInsertDeletePage()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("insert-delete.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(&SdTiledRenderingTest::callback,
 this);
@@ -821,7 +808,6 @@ void SdTiledRenderingTest::testInsertDeletePage()
 
 void SdTiledRenderingTest::testInsertTable()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
 
     uno::Sequence<beans::PropertyValue> aArgs(comphelper::InitPropertySequence(
@@ -848,7 +834,6 @@ void SdTiledRenderingTest::testInsertTable()
 
 void SdTiledRenderingTest::testPartHash()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pDoc = createDoc("dummy.odp");
 
     int nParts = pDoc->getParts();
@@ -864,7 +849,6 @@ void SdTiledRenderingTest::testPartHash()
 void SdTiledRenderingTest::testResizeTable()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("table.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -911,7 +895,6 @@ void SdTiledRenderingTest::testResizeTable()
 void SdTiledRenderingTest::testResizeTableColumn()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("table-column.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -1091,8 +1074,6 @@ public:
 
 void SdTiledRenderingTest::testViewCursors()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Create two views.
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     ViewCallback aView1;
@@ -1115,8 +1096,6 @@ void SdTiledRenderingTest::testViewCursors()
 
 void SdTiledRenderingTest::testViewCursorParts()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Create two views.
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     ViewCallback aView1;
@@ -1150,8 +1129,6 @@ void SdTiledRenderingTest::testViewCursorParts()
 
 void SdTiledRenderingTest::testCursorViews()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Create the first view.
     SdXImpressDocument* pXImpressDocument = createDoc("title-shape.odp");
     int nView1 = SfxLokHelper::getView();
@@ -1193,8 +1170,6 @@ void SdTiledRenderingTest::testCursorViews()
 
 void SdTiledRenderingTest::testViewLock()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load a document that has a shape and create two views.
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     ViewCallback aView1;
@@ -1219,8 +1194,6 @@ void SdTiledRenderingTest::testViewLock()
 
 void SdTiledRenderingTest::testUndoLimiting()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Create the first view.
     SdXImpressDocument* pXImpressDocument = createDoc("title-shape.odp");
     sd::ViewShell* pViewShell1 = 
pXImpressDocument->GetDocShell()->GetViewShell();
@@ -1262,8 +1235,6 @@ void SdTiledRenderingTest::testUndoLimiting()
 
 void SdTiledRenderingTest::testCreateViewGraphicSelection()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load a document and register a callback.
     SdXImpressDocument* pXImpressDocument = createDoc("shape.odp");
     ViewCallback aView1;
@@ -1295,8 +1266,6 @@ void 
SdTiledRenderingTest::testCreateViewGraphicSelection()
 
 void SdTiledRenderingTest::testCreateViewTextCursor()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Load a document and register a callback.
     SdXImpressDocument* pXImpressDocument = createDoc("title-shape.odp");
     ViewCallback aView1;
@@ -1346,7 +1315,6 @@ void SdTiledRenderingTest::testCreateViewTextCursor()
 void SdTiledRenderingTest::testTdf102223()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("tdf102223.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -1387,7 +1355,6 @@ void SdTiledRenderingTest::testTdf102223()
 void SdTiledRenderingTest::testPostKeyEventInvalidation()
 {
     // Load a document and begin text edit on the first slide.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("2slides.odp");
     CPPUNIT_ASSERT_EQUAL(0, pXImpressDocument->getPart());
     ViewCallback aView1;
@@ -1430,7 +1397,6 @@ void SdTiledRenderingTest::testPostKeyEventInvalidation()
 void SdTiledRenderingTest::testTdf103083()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("tdf103083.fodp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -1496,7 +1462,6 @@ void SdTiledRenderingTest::testTdf103083()
 void SdTiledRenderingTest::testTdf104405()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("tdf104405.fodp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -1548,7 +1513,6 @@ void SdTiledRenderingTest::testTdf104405()
 
 void SdTiledRenderingTest::testTdf81754()
 {
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("tdf81754.pptx");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -1583,7 +1547,6 @@ void SdTiledRenderingTest::testTdf81754()
 void SdTiledRenderingTest::testTdf105502()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("tdf105502.odp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     sd::Window* pWindow = pViewShell->GetActiveWindow();
@@ -1639,7 +1602,6 @@ void SdTiledRenderingTest::testTdf105502()
 void SdTiledRenderingTest::testCommentCallbacks()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     // Set the tiled annotations off
     comphelper::LibreOfficeKit::setTiledAnnotations(false);
 
@@ -1749,7 +1711,6 @@ void SdTiledRenderingTest::testCommentCallbacks()
 void SdTiledRenderingTest::testMultiViewInsertDeletePage()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     ViewCallback aView1;
     int nView1 = SfxLokHelper::getView();
@@ -1790,7 +1751,6 @@ void SdTiledRenderingTest::testMultiViewInsertDeletePage()
 void SdTiledRenderingTest::testDisableUndoRepair()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     SfxViewShell* pView1 = SfxViewShell::Current();
     int nView1 = SfxLokHelper::getView();
@@ -1844,8 +1804,6 @@ void SdTiledRenderingTest::testDisableUndoRepair()
 
 void SdTiledRenderingTest::testDocumentRepair()
 {
-    comphelper::LibreOfficeKit::setActive();
-
     // Create two views.
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     CPPUNIT_ASSERT(pXImpressDocument);
@@ -1896,7 +1854,6 @@ void SdTiledRenderingTest::testDocumentRepair()
 void SdTiledRenderingTest::testLanguageStatus()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     createDoc("dummy.odp");
     SfxViewShell* pView1 = SfxViewShell::Current();
     SfxLokHelper::createView();
@@ -1918,7 +1875,6 @@ void SdTiledRenderingTest::testLanguageStatus()
 void SdTiledRenderingTest::testLanguageAllText()
 {
     // Load the document, which has a single shape, with Hungarian text.
-    comphelper::LibreOfficeKit::setActive();
     createDoc("language-all-text.odp");
 
     // Set the language to English for all text.
@@ -1945,8 +1901,6 @@ void SdTiledRenderingTest::testLanguageAllText()
 void SdTiledRenderingTest::testDefaultView()
 {
     // Load the document with notes view.
-    comphelper::LibreOfficeKit::setActive();
-
     SdXImpressDocument* pXImpressDocument = createDoc("notes-view.odp");
     sd::ViewShell* pView = pXImpressDocument->GetDocShell()->GetViewShell();
     {
@@ -1966,8 +1920,6 @@ void SdTiledRenderingTest::testDefaultView()
 void SdTiledRenderingTest::testIMESupport()
 {
     // Load the document with notes view.
-    comphelper::LibreOfficeKit::setActive();
-
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     VclPtr<vcl::Window> pDocWindow = pXImpressDocument->getDocWindow();
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
@@ -2005,7 +1957,6 @@ void SdTiledRenderingTest::testIMESupport()
 void SdTiledRenderingTest::testTdf115783()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("tdf115783.fodp");
     sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
     SdPage* pActualPage = pViewShell->GetActualPage();
@@ -2072,7 +2023,6 @@ void SdTiledRenderingTest::testTdf115783()
 void SdTiledRenderingTest::testPasteTextOnSlide()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = 
createDoc("paste_text_onslide.odp");
     CPPUNIT_ASSERT(pXImpressDocument);
 
@@ -2146,7 +2096,6 @@ void SdTiledRenderingTest::testPasteTextOnSlide()
 
 void SdTiledRenderingTest::testTdf115873()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Initialize the navigator.
     SdXImpressDocument* pXImpressDocument = createDoc("tdf115873.fodp");
     SfxViewShell* pViewShell = SfxViewShell::Current();
@@ -2182,7 +2131,6 @@ void SdTiledRenderingTest::testTdf115873()
 
 void SdTiledRenderingTest::testTdf115873Group()
 {
-    comphelper::LibreOfficeKit::setActive();
     // Initialize the navigator.
     SdXImpressDocument* pXImpressDocument = createDoc("tdf115873-group.fodp");
     SfxViewShell* pViewShell = SfxViewShell::Current();
@@ -2199,7 +2147,6 @@ void SdTiledRenderingTest::testTdf115873Group()
 void SdTiledRenderingTest::testCutSelectionChange()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = 
createDoc("cut_selection_change.odp");
     CPPUNIT_ASSERT(pXImpressDocument);
 
@@ -2238,7 +2185,6 @@ void SdTiledRenderingTest::testCutSelectionChange()
 void SdTiledRenderingTest::testRegenerateDiagram()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = 
createDoc("regenerate-diagram.pptx");
     CPPUNIT_ASSERT(pXImpressDocument);
 
@@ -2289,7 +2235,6 @@ void SdTiledRenderingTest::testRegenerateDiagram()
 void SdTiledRenderingTest::testInsertDeletePageInvalidation()
 {
     // Load the document.
-    comphelper::LibreOfficeKit::setActive();
     SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
     ViewCallback aView1;
     CPPUNIT_ASSERT_EQUAL(8, pXImpressDocument->getParts());
commit 79b27379c1cf109faeb80bc51fdd1c44df4fbfee
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Mon Sep 30 17:03:41 2019 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Wed Oct 2 16:50:05 2019 +0200

    uitest: share some code.
    
    Change-Id: I2f586bd5e2e4c3cf1fc052cdfe526532dca9acd4
    Reviewed-on: https://gerrit.libreoffice.org/79884
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/uitest/calc_tests/create_chart.py 
b/uitest/calc_tests/create_chart.py
index 5b97199bdf59..cced0ac63d37 100644
--- a/uitest/calc_tests/create_chart.py
+++ b/uitest/calc_tests/create_chart.py
@@ -15,6 +15,11 @@ import unittest
 
 class CalcChartUIDemo(UITestCase):
 
+    def create_insert_chart_dialog(self):
+        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
+        # time.sleep(1) # ideally wait for a creation event
+        return self.xUITest.getTopFocusWindow()
+
     def fill_spreadsheet(self):
         xCalcDoc = self.xUITest.getTopFocusWindow()
         xGridWindow = xCalcDoc.getChild("grid_window")
@@ -34,9 +39,7 @@ class CalcChartUIDemo(UITestCase):
 
         self.fill_spreadsheet()
 
-        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
-
-        xChartDlg = self.xUITest.getTopFocusWindow()
+        xChartDlg = self.create_insert_chart_dialog();
 
         xCancelBtn = xChartDlg.getChild("cancel")
         self.ui_test.close_dialog_through_button(xCancelBtn)
@@ -49,9 +52,7 @@ class CalcChartUIDemo(UITestCase):
 
         self.fill_spreadsheet()
 
-        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
-
-        xChartDlg = self.xUITest.getTopFocusWindow()
+        xChartDlg = self.create_insert_chart_dialog();
 
         xOkBtn = xChartDlg.getChild("finish")
         self.ui_test.close_dialog_through_button(xOkBtn)
@@ -64,9 +65,7 @@ class CalcChartUIDemo(UITestCase):
 
         self.fill_spreadsheet()
 
-        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
-
-        xChartDlg = self.xUITest.getTopFocusWindow()
+        xChartDlg = self.create_insert_chart_dialog();
 
         xNextBtn = xChartDlg.getChild("next")
         xNextBtn.executeAction("CLICK", tuple())
@@ -90,9 +89,7 @@ class CalcChartUIDemo(UITestCase):
         xCalcDoc = self.xUITest.getTopFocusWindow()
         xGridWindow = xCalcDoc.getChild("grid_window")
 
-        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
-
-        xChartDlg = self.xUITest.getTopFocusWindow()
+        xChartDlg = self.create_insert_chart_dialog();
 
         xNextBtn = xChartDlg.getChild("finish")
         self.ui_test.close_dialog_through_button(xNextBtn)
@@ -112,9 +109,7 @@ class CalcChartUIDemo(UITestCase):
         xCalcDoc = self.xUITest.getTopFocusWindow()
         xGridWindow = xCalcDoc.getChild("grid_window")
 
-        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
-
-        xChartDlg = self.xUITest.getTopFocusWindow()
+        xChartDlg = self.create_insert_chart_dialog();
 
         xNextBtn = xChartDlg.getChild("finish")
         self.ui_test.close_dialog_through_button(xNextBtn)
@@ -137,9 +132,7 @@ class CalcChartUIDemo(UITestCase):
         xCalcDoc = self.xUITest.getTopFocusWindow()
         xGridWindow = xCalcDoc.getChild("grid_window")
 
-        self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
-
-        xChartDlg = self.xUITest.getTopFocusWindow()
+        xChartDlg = self.create_insert_chart_dialog();
 
         xNextBtn = xChartDlg.getChild("finish")
         self.ui_test.close_dialog_through_button(xNextBtn)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to