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

Ahmed ElShreif (via logerrit) logerrit at kemper.freedesktop.org
Sun Aug 4 17:54:04 UTC 2019


 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |   12 +++++--
 sd/source/ui/slidesorter/model/SlideSorterModel.cxx    |   23 +++++++++++++
 uitest/ui_logger_dsl/Special_commands.tx               |   28 +++++++++++++++--
 uitest/ui_logger_dsl/dsl_core.py                       |    5 +++
 vcl/source/uitest/logger.cxx                           |   21 ++++++++++++
 5 files changed, 82 insertions(+), 7 deletions(-)

New commits:
commit 1b7c69bf8d03479b55fac25a5f7fcb06a823ce0f
Author:     Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Sat Aug 3 11:51:11 2019 -0500
Commit:     Ahmed ElShreif <aelshreif7 at gmail.com>
CommitDate: Sun Aug 4 12:39:57 2019 -0500

    log more events:
    
            Impress:
                    1) Delete Slide
                    2) Duplicate Slide
                    3) Rename Slide
    
            Draw:
                    1) Delte Page
                    2) Rename Page
    
    Change-Id: I124bdf96c58dfe00bdb039c5e93afc0dc6e7163d

diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 9d16edf5a63f..26bbd0cb46d3 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -113,11 +113,11 @@ SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet);
 
 namespace {
 
-void collectUIInformation(const OUString& num,const OUString& action)
+void collectUIInformation(const std::map<OUString, OUString>& aParameters,const OUString& action)
 {
     EventDescription aDescription;
     aDescription.aID = "impress_win_or_draw_win";
-    aDescription.aParameters = {{"POS", num}};
+    aDescription.aParameters = aParameters;
     aDescription.aAction = action;
     aDescription.aKeyWord = "ImpressWindowUIObject";
     aDescription.aParent = "MainWindow";
@@ -904,6 +904,8 @@ void SlotManager::RenameSlide(const SfxRequest& rRequest)
         ScopedVclPtr<AbstractSvxNameDialog> aNameDlg(pFact->CreateSvxNameDialog(
                 pWin ? pWin->GetFrameWeld() : nullptr,
                 aPageName, aDescr));
+        OUString aOldName;
+        aNameDlg->GetName( aOldName );
         aNameDlg->SetText( aTitle );
         aNameDlg->SetCheckNameHdl( LINK( this, SlotManager, RenameSlideHdl ), true );
         aNameDlg->SetEditHelpId( HID_SD_NAMEDIALOG_PAGE );
@@ -920,6 +922,9 @@ void SlotManager::RenameSlide(const SfxRequest& rRequest)
                 DBG_ASSERT( bResult, "Couldn't rename slide" );
             }
         }
+        OUString aNewName;
+        aNameDlg->GetName( aNewName );
+        collectUIInformation({{"OldName",aOldName},{"NewName",aNewName}},"RENAME");
         aNameDlg.disposeAndClear();
     }
     // Tell the slide sorter about the name change (necessary for
@@ -1086,7 +1091,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");
+    collectUIInformation({{"POS", OUString::number(nInsertionIndex+2)}},"Insert_New_Page_or_Slide");
 }
 
 void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
@@ -1133,6 +1138,7 @@ void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
     {
         rSelector.SelectPage(it);
     }
+    collectUIInformation({{"POS", OUString::number(nInsertPosition+2)}},"Duplicate");
 }
 
 void SlotManager::ChangeSlideExclusionState (
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index ec35f545448b..cae9d9314b70 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -35,6 +35,9 @@
 #include <com/sun/star/beans/UnknownPropertyException.hpp>
 #include <com/sun/star/frame/XController.hpp>
 
+#include <vcl/uitest/logger.hxx>
+#include <vcl/uitest/eventdescription.hxx>
+
 #include <ViewShellBase.hxx>
 #include <DrawViewShell.hxx>
 #include <DrawDocShell.hxx>
@@ -101,6 +104,22 @@ 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);
+}
+
+}
+
 SlideSorterModel::SlideSorterModel (SlideSorter& rSlideSorter)
     : maMutex(),
       mrSlideSorter(rSlideSorter),
@@ -614,7 +633,9 @@ bool SlideSorterModel::DeleteSlide (const SdPage* pPage)
         maPageDescriptors.erase(iter);
         UpdateIndices(nIndex);
     }
-
+    if(nIndex>=0){
+        collectUIInformation(OUString::number(nIndex+1),"Delete_Slide_or_Page");
+    }
     return bMarkedSelected;
 }
 
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx
index 1d11067424a9..335b6d24e7d3 100644
--- a/uitest/ui_logger_dsl/Special_commands.tx
+++ b/uitest/ui_logger_dsl/Special_commands.tx
@@ -128,12 +128,16 @@ select_options:
   This part for all the impress log statments:
    
     1)  Type 
-    2)  Insert New Page
+    2)  Insert New Slide
+    3)  Delete Slide
+    4)  Duplicate Slide
+    5)  Rename Slide
 
   then we can add whatever we need in the future
 */
 impress_command:
-    impress_Type_command | impress_Insert_Slide 
+    impress_Type_command | impress_Insert_Slide | impress_Delete_Page |
+    impress_Duplicate_Slide | impress_Rename_Slide
 ;
 impress_Type_command:
     'Type on impress ' what_to_type=Type_options
@@ -141,6 +145,15 @@ impress_Type_command:
 impress_Insert_Slide:
     'Insert New Slide at Position ' position_num=INT
 ;
+impress_Delete_Page:
+    'Delete Slide number ' position_num=INT
+;
+impress_Duplicate_Slide:
+    'Duplicate The Selected Slide '
+;
+impress_Rename_Slide:
+    'Rename The Selected Slide from ' old_name=STRING 'to' new_name=STRING
+;
 //=================================================================//
 /*
   This part for all the math log statments:
@@ -166,15 +179,24 @@ math_Type_command:
    
     1) Type
     2) Insert New Page
+    3) Delete Page
+    4) Rename Page
 
   then we can add whatever we need in the future
 */
 draw_command:
-    draw_Type_command | draw_Insert_Page
+    draw_Type_command | draw_Insert_Page | draw_Delete_Page |
+    draw_Rename_Page
 ;
 draw_Type_command:
     'Type on draw ' what_to_type=Type_options
 ;
 draw_Insert_Page:
     'Insert New Page at Position ' position_num=INT
+;
+draw_Delete_Page:
+    'Delete Page number ' position_num=INT
+;
+draw_Rename_Page:
+    'Rename The Selected Page from ' old_name=STRING 'to' new_name=STRING
 ;
\ 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 9a5f375b5aa9..1eaa33a441cd 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -102,7 +102,12 @@ class ul_Compiler:
             'calc_Merge_Cells':self.do_nothing,
             'calc_UNMerge_Cells':self.do_nothing,
             'impress_Insert_Slide':self.do_nothing,
+            'impress_Delete_Page':self.do_nothing,
+            'impress_Duplicate_Slide':self.do_nothing,
+            'impress_Rename_Slide':self.do_nothing,
             'draw_Insert_Page':self.do_nothing,
+            'draw_Delete_Page':self.do_nothing,
+            'draw_Rename_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 552b09d961b3..d2bcab4b6726 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -379,6 +379,27 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
                 aLogLine = "Insert New Page at Position " + GetValueInMapWithIndex(rDescription.aParameters,0);
             }
         }
+        else if(rDescription.aAction=="Delete_Slide_or_Page"){
+            if(UITestLogger::getInstance().getAppName()=="impress"){
+            aLogLine = "Delete Slide number "+ GetValueInMapWithIndex(rDescription.aParameters,0);
+            }
+            else if(UITestLogger::getInstance().getAppName()=="draw"){
+            aLogLine = "Delete Page number "+ GetValueInMapWithIndex(rDescription.aParameters,0);
+            }
+        }
+        else if(rDescription.aAction=="Duplicate"){
+            aLogLine = "Duplicate The Selected Slide ";
+        }
+        else if(rDescription.aAction=="RENAME"){
+            if(UITestLogger::getInstance().getAppName()=="impress"){
+                aLogLine = "Rename The Selected Slide from \""+ GetValueInMapWithIndex(rDescription.aParameters,1)+\
+                 "\" to \"" + GetValueInMapWithIndex(rDescription.aParameters,0)+"\"";
+            }
+            else if(UITestLogger::getInstance().getAppName()=="draw"){
+                aLogLine = "Rename The Selected Page from \""+ GetValueInMapWithIndex(rDescription.aParameters,1)+\
+                 "\" to \"" + GetValueInMapWithIndex(rDescription.aParameters,0)+"\"";
+            }
+        }
     }
     else if(rDescription.aParent=="element_selector"){
         aLogLine ="Select element no " + rDescription.aID +


More information about the Libreoffice-commits mailing list