diff options
author | Ahmed ElShreif <aelshreif7@gmail.com> | 2020-08-25 23:35:08 +0200 |
---|---|---|
committer | Ahmed ElShreif <aelshreif7@gmail.com> | 2020-09-01 01:24:53 +0200 |
commit | fe3d005155a8670d02ff1a8d17f1bcff74a44cab (patch) | |
tree | cce513ef383adf5087780d41df1256454aac33b7 | |
parent | 35585f85049fd20719c42d7d7433859df59a0967 (diff) |
uilogger : Add support in the Logger and DSL for Calc-Comments
For example the DSL syntax will be:
>>Open Comment
>>Close Comment
The set text is already added by default to the system
Change-Id: Ic06e00e75e202eece82fa6265e1bb4083fd8c337
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101502
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/ui/drawfunc/fudraw.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun6.cxx | 19 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/Special_commands.tx | 12 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/dsl_core.py | 28 | ||||
-rw-r--r-- | vcl/source/uitest/logger.cxx | 12 |
5 files changed, 89 insertions, 1 deletions
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx index 36abddf039f5..701790120bd6 100644 --- a/sc/source/ui/drawfunc/fudraw.cxx +++ b/sc/source/ui/drawfunc/fudraw.cxx @@ -26,6 +26,8 @@ #include <sfx2/dispatch.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/lokhelper.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <sc.hrc> #include <fudraw.hxx> @@ -37,6 +39,22 @@ #include <drawview.hxx> #include <comphelper/lok.hxx> +namespace +{ + +void collectUIInformation( const OUString& aevent ) +{ + EventDescription aDescription; + aDescription.aID = "grid_window"; + aDescription.aParameters = {{ aevent , ""}}; + aDescription.aAction = "COMMENT"; + aDescription.aParent = "MainWindow"; + aDescription.aKeyWord = "ScGridWinUIObject"; + UITestLogger::getInstance().logEvent(aDescription); +} + +} + // base class for draw module specific functions FuDraw::FuDraw(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* pViewP, SdrModel* pDoc, const SfxRequest& rReq) @@ -179,6 +197,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt) case KEY_ESCAPE: if ( rViewShell.IsDrawTextShell() || aSfxRequest.GetSlot() == SID_DRAW_NOTEEDIT ) { + collectUIInformation("CLOSE"); // if object selected -> normal draw-shell, else turn off drawing rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SfxCallMode::SLOT | SfxCallMode::RECORD); bReturn = true; diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index d9c664ee3e23..1332f94e4f07 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -24,6 +24,8 @@ #include <svl/stritem.hxx> #include <svl/zforlist.hxx> #include <svl/zformat.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <editeng/editview.hxx> #include <sal/log.hxx> @@ -46,6 +48,22 @@ #include <vector> +namespace +{ + +void collectUIInformation( const OUString& aevent ) +{ + EventDescription aDescription; + aDescription.aID = "grid_window"; + aDescription.aParameters = {{ aevent , ""}}; + aDescription.aAction = "COMMENT"; + aDescription.aParent = "MainWindow"; + aDescription.aKeyWord = "ScGridWinUIObject"; + UITestLogger::getInstance().logEvent(aDescription); +} + +} + using ::std::vector; void ScViewFunc::DetectiveAddPred() @@ -520,6 +538,7 @@ void ScViewFunc::EditNote() ScTabView::OnLOKNoteStateChanged( pNote ); } + collectUIInformation("OPEN"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx index 601a600f4bdb..9a8dc4cff6c4 100644 --- a/uitest/ui_logger_dsl/Special_commands.tx +++ b/uitest/ui_logger_dsl/Special_commands.tx @@ -69,6 +69,8 @@ writer_Insert_BreakPage: 10) Paste Cells 11) Merge Cells 12) Unmerge Cells + 13) Open Comment + 14) Close Comment then we can add whatever we need in the future */ @@ -76,7 +78,8 @@ calc_command: calc_Type_command | calc_switch_sheet | calc_Select_cell | calc_AutoFill_filter | calc_SelectMenu_filter | calc_Delete_Cells | calc_Remove_Content | calc_insert_cells | calc_Cut_Cells | calc_Copy_Cells | calc_Paste_Cells | calc_UNMerge_Cells | - calc_Merge_Cells | calc_Rename_Sheet | calc_Insert_sheet + calc_Merge_Cells | calc_Rename_Sheet | calc_Insert_sheet | calc_Open_Comment | + calc_Close_Comment ; calc_Type_command: 'Type on current cell' what_to_type=Type_options @@ -129,6 +132,13 @@ calc_Rename_Sheet: calc_Insert_sheet: 'Insert New Tab ' ; +calc_Open_Comment: + 'Open Comment' (txt=STRING)? +; +calc_Close_Comment: + 'Close Comment' (txt=STRING)? +; + //this is the select options select_options: one_cell | range_of_cells diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py index 8fa7d141c2c3..062415f00fb1 100644 --- a/uitest/ui_logger_dsl/dsl_core.py +++ b/uitest/ui_logger_dsl/dsl_core.py @@ -113,6 +113,8 @@ class ul_Compiler: "calc_Type_command": self.handle_calc_Type_command, "calc_AutoFill_filter": self.handle_calc_AutoFill_filter, "calc_SelectMenu_filter": self.handle_calc_SelectMenu_filter, + "calc_Open_Comment": self.handle_calc_Open_Comment, + "calc_Close_Comment": self.handle_calc_Close_Comment, "impress_Type_command": self.handle_impress_Type_command, "math_element_selector": self.handle_math_element_selector, "math_Type_command": self.handle_math_Type_command, @@ -780,6 +782,32 @@ class ul_Compiler: self.variables.append(line) self.prev_command = calc_AutoFill_filter + def handle_calc_Open_Comment(self, calc_Open_Comment): + + line = ( + double_tab + + self.current_app + + '.executeAction("COMMENT", mkPropertyValues' + + '({"OPEN": " "}))\n' + ) + + self.variables.append(line) + + self.prev_command = calc_Open_Comment + + def handle_calc_Close_Comment(self, calc_Close_Comment): + + line = ( + double_tab + + self.current_app + + '.executeAction("COMMENT", mkPropertyValues' + + '({"CLOSE": " "}))\n' + ) + + self.variables.append(line) + + self.prev_command = calc_Close_Comment + def handle_calc_SelectMenu_filter(self, calc_SelectMenu_filter): self.init_app() diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx index 27a3a0e6b039..a1927d44b2eb 100644 --- a/vcl/source/uitest/logger.cxx +++ b/vcl/source/uitest/logger.cxx @@ -498,6 +498,18 @@ void UITestLogger::logEvent(const EventDescription& rDescription) { aLogLine = "Insert New Tab "; } + else if (rDescription.aAction == "COMMENT") + { + OUString type = GetKeyInMapWithIndex(rDescription.aParameters, 0); + if(type == "OPEN") + { + aLogLine = "Open Comment"; + } + else if(type == "CLOSE") + { + aLogLine = "Close Comment"; + } + } } else if (rDescription.aID == "impress_win_or_draw_win") { |