[Libreoffice-commits] core.git: Branch 'private/EL-SHREIF/ui_logger' - include/vcl sd/source uitest/ui_logger_dsl vcl/source

Ahmed ElShreif (via logerrit) logerrit at kemper.freedesktop.org
Sat Aug 3 04:59:20 UTC 2019


 include/vcl/uitest/logger.hxx                          |   10 +++++++
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |   22 +++++++++++++++++
 uitest/ui_logger_dsl/Special_commands.tx               |   14 +++++++---
 uitest/ui_logger_dsl/dsl_core.py                       |    2 +
 vcl/source/uitest/logger.cxx                           |   11 ++++++++
 vcl/source/uitest/uiobject.cxx                         |    8 ++++++
 6 files changed, 63 insertions(+), 4 deletions(-)

New commits:
commit 20d0760cc256ab9bcd15c60d68ddc1baccdedada
Author:     Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Fri Aug 2 22:16:31 2019 -0500
Commit:     Ahmed ElShreif <aelshreif7 at gmail.com>
CommitDate: Fri Aug 2 22:16:31 2019 -0500

    Add more events to ui logger
    
            for Impress:
                    add new Slide
            for Draw
                    add new Page
    Modify the UILogger System to save information about the name of the app
    
    Change-Id: I87fd98b2a11783e3410f1c0eba633631addf389b

diff --git a/include/vcl/uitest/logger.hxx b/include/vcl/uitest/logger.hxx
index f707049040fe..6c8c5008541a 100644
--- a/include/vcl/uitest/logger.hxx
+++ b/include/vcl/uitest/logger.hxx
@@ -32,6 +32,8 @@ private:
 
     bool mbValid;
 
+    OUString app_name;
+
 public:
 
     UITestLogger();
@@ -48,6 +50,14 @@ public:
 
     static UITestLogger& getInstance();
 
+    void setAppName(OUString name){
+        app_name=name;
+    }
+
+    OUString getAppName(){
+        return app_name;
+    }
+
 };
 
 #endif
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 55b58e197f1c..9d16edf5a63f 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -67,6 +67,9 @@
 #include <sdabstdlg.hxx>
 #include <sdmod.hxx>
 
+#include <vcl/uitest/logger.hxx>
+#include <vcl/uitest/eventdescription.hxx>
+
 #include <sfx2/request.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/bindings.hxx>
@@ -84,6 +87,7 @@
 #include <com/sun/star/drawing/XDrawPages.hpp>
 #include <vcl/svapp.hxx>
 
+
 #include <memory>
 
 using namespace ::com::sun::star;
@@ -106,6 +110,23 @@ SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet);
 
 } // end of anonymous namespace
 
+
+namespace {
+
+void collectUIInformation(const OUString& num,const OUString& action)
+{
+    EventDescription aDescription;
+    aDescription.aID = "impress_win_or_draw_win";
+    aDescription.aParameters = {{"POS", num}};
+    aDescription.aAction = action;
+    aDescription.aKeyWord = "ImpressWindowUIObject";
+    aDescription.aParent = "MainWindow";
+
+    UITestLogger::getInstance().logEvent(aDescription);
+}
+
+}
+
 SlotManager::SlotManager (SlideSorter& rSlideSorter)
     : mrSlideSorter(rSlideSorter)
 {
@@ -1065,6 +1086,7 @@ void SlotManager::InsertSlide (SfxRequest& rRequest)
     PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
     mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
     mrSlideSorter.GetController().GetPageSelector().SelectPage(pNewPage);
+    collectUIInformation(OUString::number(nInsertionIndex+2),"Insert_New_Page_or_Slide");
 }
 
 void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx
index 5fbd9972a275..1d11067424a9 100644
--- a/uitest/ui_logger_dsl/Special_commands.tx
+++ b/uitest/ui_logger_dsl/Special_commands.tx
@@ -128,17 +128,19 @@ select_options:
   This part for all the impress log statments:
    
     1)  Type 
-    2)  Set zoom
+    2)  Insert New Page
 
   then we can add whatever we need in the future
 */
 impress_command:
-    impress_Type_command 
+    impress_Type_command | impress_Insert_Slide 
 ;
 impress_Type_command:
     'Type on impress ' what_to_type=Type_options
 ;
-
+impress_Insert_Slide:
+    'Insert New Slide at Position ' position_num=INT
+;
 //=================================================================//
 /*
   This part for all the math log statments:
@@ -163,12 +165,16 @@ math_Type_command:
   This part for all the draw log statments:
    
     1) Type
+    2) Insert New Page
 
   then we can add whatever we need in the future
 */
 draw_command:
-    draw_Type_command
+    draw_Type_command | draw_Insert_Page
 ;
 draw_Type_command:
     'Type on draw ' what_to_type=Type_options
+;
+draw_Insert_Page:
+    'Insert New Page at Position ' position_num=INT
 ;
\ No newline at end of file
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index 8d5a8a82ac0b..9a5f375b5aa9 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -101,6 +101,8 @@ class ul_Compiler:
             'calc_Copy_Cells':self.do_nothing,
             'calc_Merge_Cells':self.do_nothing,
             'calc_UNMerge_Cells':self.do_nothing,
+            'impress_Insert_Slide':self.do_nothing,
+            'draw_Insert_Page':self.do_nothing,
             })
 
         self.log_lines=self.get_log_file(self.input_address)
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index bd0d91940b1e..552b09d961b3 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -370,6 +370,16 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
             aLogLine = "Delete the merged " + aParameterString;
         }
     }
+    else if(rDescription.aID=="impress_win_or_draw_win"){
+        if(rDescription.aAction=="Insert_New_Page_or_Slide"){
+            if(UITestLogger::getInstance().getAppName()=="impress"){
+                aLogLine = "Insert New Slide at Position " + GetValueInMapWithIndex(rDescription.aParameters,0);
+            }
+            else if(UITestLogger::getInstance().getAppName()=="draw"){
+                aLogLine = "Insert New Page at Position " + GetValueInMapWithIndex(rDescription.aParameters,0);
+            }
+        }
+    }
     else if(rDescription.aParent=="element_selector"){
         aLogLine ="Select element no " + rDescription.aID +
             " From " + rDescription.aParent;
@@ -395,4 +405,5 @@ UITestLogger& UITestLogger::getInstance()
     return *pSVData->maWinData.m_pUITestLogger;
 }
 
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 7a725859c2d5..b7a9bce4e224 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -19,6 +19,8 @@
 #include <vcl/dialog.hxx>
 #include <vcl/edit.hxx>
 #include <vcl/vclmedit.hxx>
+#include <vcl/uitest/logger.hxx>
+#include <vcl/uitest/eventdescription.hxx>
 
 #include <comphelper/string.hxx>
 
@@ -586,26 +588,32 @@ OUString ButtonUIObject::get_action(VclEventId nEvent) const
     {
         if(mxButton->get_id()=="writer_all")
         {
+            UITestLogger::getInstance().setAppName("writer");
             return "Start writer" ;
         }
         else if(mxButton->get_id()=="calc_all")
         {
+            UITestLogger::getInstance().setAppName("calc");
             return "Start calc" ;
         }
         else if(mxButton->get_id()=="impress_all")
         {
+            UITestLogger::getInstance().setAppName("impress");
             return "Start impress" ;
         }
         else if(mxButton->get_id()=="draw_all")
         {
+            UITestLogger::getInstance().setAppName("draw");
             return "Start draw" ;
         }
         else if(mxButton->get_id()=="math_all")
         {
+            UITestLogger::getInstance().setAppName("math");
             return "Start math" ;
         }
         else if(mxButton->get_id()=="database_all")
         {
+            UITestLogger::getInstance().setAppName("database");
             return "Start database" ;
         }
         else{


More information about the Libreoffice-commits mailing list