diff options
author | Ahmed ElShreif <aelshreif7@gmail.com> | 2019-07-18 13:53:08 -0500 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2019-08-19 22:56:38 +0800 |
commit | 9545e8ac286d0e18d9526df95cbc6e7da4aca738 (patch) | |
tree | 931b690d459c08a3b324d5f3d2a64ab1572adfe4 | |
parent | bf94b044a11740323853933f0aedf55ceb143ee1 (diff) |
uitest: log more events
for Calc:
1) Delete some Cells
2) Remove content from some cells
3) Insert Cells
4) Cut Cells
5) Copy Cells
6) Paste Cells
7) Merge Cells
8) Split Cell ( Delete Merge )
for Writer:
1) Insert Table
2) Copy Text
3) Cut Text
4) Paste Text
5) Inser Break Page
Also, Solve some bugs in the UI logger and UNO Commands.
Change-Id: Ic7cacbc20e1e400900a9760b61e8b45ae96c84ff
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 33 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 28 | ||||
-rw-r--r-- | sw/source/core/edit/edtab.cxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 17 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/Special_commands.tx | 47 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/UI_Object_commands.tx | 9 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/dsl_core.py | 18 | ||||
-rw-r--r-- | uitest/ui_logger_dsl/uno_commands.tx | 4 | ||||
-rw-r--r-- | vcl/source/uitest/logger.cxx | 46 |
11 files changed, 256 insertions, 14 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 2e9a0350ffa9..831e4c7dd8ee 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -41,6 +41,8 @@ #include <vcl/waitobj.hxx> #include <viewfunc.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <sc.hrc> #include <globstr.hrc> @@ -90,6 +92,21 @@ using namespace com::sun::star; using ::editeng::SvxBorderLine; +namespace { + +void collectUIInformation(const std::map<OUString, OUString>& aParameters,const OUString action) +{ + EventDescription aDescription; + aDescription.aID = "grid_window"; + aDescription.aAction = action; + aDescription.aParameters = aParameters; + aDescription.aParent = "MainWindow"; + aDescription.aKeyWord = "ScGridWinUIObject"; + + UITestLogger::getInstance().logEvent(aDescription); +} +} + using ::std::vector; using ::std::unique_ptr; @@ -1212,7 +1229,9 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter ) UpdateInputLine(); } } - + OUString aStartAddress = aMarkRange.aStart.GetColRowString(); + OUString aEndAddress = aMarkRange.aEnd.GetColRowString(); + collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"MERGE_CELLS"); return bOk; } @@ -1298,6 +1317,10 @@ bool ScViewFunc::RemoveMerge() if (bOk) pDocSh->UpdateOle(&GetViewData()); } + + OUString Cell_location = aRange.aStart.GetColRowString(); + collectUIInformation({{"CELL", Cell_location }},"UNMERGE_CELL"); + return true; //! bOk ?? } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index db0391e3b69b..b43debda5e7e 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -29,6 +29,8 @@ #include <tools/urlobj.hxx> #include <sot/exchange.hxx> #include <memory> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <attrib.hxx> #include <patattr.hxx> @@ -62,6 +64,22 @@ using namespace com::sun::star; +namespace { + +void collectUIInformation(const std::map<OUString, OUString>& aParameters,OUString action) +{ + EventDescription aDescription; + aDescription.aID = "grid_window"; + aDescription.aAction = action; + aDescription.aParameters = aParameters; + aDescription.aParent = "MainWindow"; + aDescription.aKeyWord = "ScGridWinUIObject"; + + UITestLogger::getInstance().logEvent(aDescription); +} + +} + // GlobalName of writer-DocShell from comphelper/classids.hxx // C U T @@ -132,6 +150,10 @@ void ScViewFunc::CutToClip() pDocSh->UpdateOle(&GetViewData()); CellContentChanged(); + + OUString aStartAddress = aRange.aStart.GetColRowString(); + OUString aEndAddress = aRange.aEnd.GetColRowString(); + collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"CUT"); } else ErrorMessage( STR_NOMULTISELECT ); @@ -163,7 +185,11 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, bool bCut, bool bApi, bool bI if (!bApi) ErrorMessage(STR_NOMULTISELECT); } - + if( !bCut ){ + OUString aStartAddress = aRange.aStart.GetColRowString(); + OUString aEndAddress = aRange.aEnd.GetColRowString(); + collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"COPY"); + } return bDone; } @@ -180,6 +206,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, const ScRangeList& rRanges, b bDone = CopyToClipMultiRange(pClipDoc, rRanges, bCut, bApi, bIncludeObjects); else bDone = CopyToClipSingleRange(pClipDoc, rRanges, bCut, bIncludeObjects); + return bDone; } @@ -1436,7 +1463,9 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, rProtectedChartRangesVector, aExcludedChartNames, bSameDoc ); } } - + OUString aStartAddress = aMarkRange.aStart.GetColRowString(); + OUString aEndAddress = aMarkRange.aEnd.GetColRowString(); + collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"PASTE"); return true; } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index d58b2324332c..13c8bd708812 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -37,6 +37,8 @@ #include <vcl/waitobj.hxx> #include <stdlib.h> #include <unotools/charclass.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <viewfunc.hxx> #include <tabvwsh.hxx> @@ -97,6 +99,22 @@ ScViewFunc::~ScViewFunc() { } +namespace { + +void collectUIInformation(const std::map<OUString, OUString>& aParameters,const OUString action) +{ + EventDescription aDescription; + aDescription.aID = "grid_window"; + aDescription.aAction = action; + aDescription.aParameters = aParameters; + aDescription.aParent = "MainWindow"; + aDescription.aKeyWord = "ScGridWinUIObject"; + + UITestLogger::getInstance().logEvent(aDescription); +} + +} + void ScViewFunc::StartFormatArea() { // anything to do? @@ -1616,6 +1634,9 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste ) ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, GetViewData().GetTabNo()); } } + OUString aStartAddress = aRange.aStart.GetColRowString(); + OUString aEndAddress = aRange.aEnd.GetColRowString(); + collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"INSERT_CELLS"); return bSuccess; } else @@ -1701,6 +1722,10 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd ) ErrorMessage(STR_NOMULTISELECT); } + OUString aStartAddress = aRange.aStart.GetColRowString(); + OUString aEndAddress = aRange.aEnd.GetColRowString(); + collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"DELETE_CELLS"); + Unmark(); } @@ -1978,6 +2003,9 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags ) else StartFormatArea(); // delete attribute is also attribute-change } + OUString aStartAddress = aMarkRange.aStart.GetColRowString(); + OUString aEndAddress = aMarkRange.aEnd.GetColRowString(); + collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"DELETE"); } // column width/row height (via header) - undo OK diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index fa522c6f301f..edb2510f8347 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -48,9 +48,25 @@ #include <mdiexp.hxx> #include <unochart.hxx> #include <itabenum.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace { + +void collectUIInformation(const OUString action,const OUString aParameters) +{ + EventDescription aDescription; + aDescription.aAction = action; + aDescription.aParameters = {{"parameters",aParameters}}; + aDescription.aID = "writer_edit"; + aDescription.aKeyWord = "SwEditWinUIObject"; + aDescription.aParent = "MainWindow"; + UITestLogger::getInstance().logEvent(aDescription); +} + +} //Added for bug #i119954# Application crashed if undo/redo convert nest table to text static bool ConvertTableToText( const SwTableNode *pTableNode, sal_Unicode cCh ); @@ -113,6 +129,9 @@ const SwTable& SwEditShell::InsertTable( const SwInsertTableOptions& rInsTableOp EndUndo( SwUndoId::END ); EndAllAction(); + OUString parameter = " Columns : " + OUString::number( nCols )+ " , Rows : " +OUString::number( nRows ) +" "; + collectUIInformation("CREATE_TABLE",parameter); + return *pTable; } diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index f4b8bf904532..8a192441b769 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -138,6 +138,8 @@ #include <iodetect.hxx> #include <unotextrange.hxx> #include <unoframe.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <vcl/GraphicNativeTransform.hxx> #include <vcl/GraphicNativeMetadata.hxx> @@ -161,6 +163,20 @@ using namespace ::svx; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::datatransfer; +namespace { + +void collectUIInformation(const OUString action,const OUString aParameters) +{ + EventDescription aDescription; + aDescription.aAction = action; + aDescription.aParameters = {{"parameters",aParameters}}; + aDescription.aID = "writer_edit"; + aDescription.aKeyWord = "SwEditWinUIObject"; + aDescription.aParent = "MainWindow"; + UITestLogger::getInstance().logEvent(aDescription); +} + +} #define DDE_TXT_ENCODING osl_getThreadTextEncoding() @@ -830,6 +846,7 @@ int SwTransferable::Cut() int nRet = Copy( true ); if( nRet ) DeleteSelection(); + collectUIInformation("CUT","parameter"); return nRet; } @@ -1094,6 +1111,11 @@ int SwTransferable::Copy( bool bIsCut ) { CopyToClipboard( &m_pWrtShell->GetView().GetEditWin() ); } + + if( !bIsCut ){ + collectUIInformation("COPY","parameter"); + } + return nRet; } @@ -1411,6 +1433,8 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt } } + collectUIInformation("PASTE","parameter"); + return EXCHG_INOUT_ACTION_NONE != nAction && SwTransferable::PasteData( rData, rSh, nAction, nActionFlags, nFormat, nDestination, false, false, nullptr, 0, false, nAnchorType, bIgnoreComments, &aPasteContext ); diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index c81e41d25c2a..87202b3cd219 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -100,6 +100,8 @@ #include <toolkit/helper/vclunohelper.hxx> #include <sfx2/viewfrm.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <PostItMgr.hxx> #include <FrameControlsManager.hxx> @@ -117,6 +119,20 @@ using namespace sw::mark; using namespace com::sun::star; +namespace { + +void collectUIInformation(const OUString action,const OUString aParameters) +{ + EventDescription aDescription; + aDescription.aAction = action; + aDescription.aParameters = {{"parameters",aParameters}}; + aDescription.aID = "writer_edit"; + aDescription.aKeyWord = "SwEditWinUIObject"; + aDescription.aParent = "MainWindow"; + UITestLogger::getInstance().logEvent(aDescription); +} + +} #define BITFLD_INI_LIST \ m_bClearMark = \ @@ -896,6 +912,7 @@ void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, const ::boost::optio SetAttrItem( SvxFormatBreakItem(SvxBreak::PageBefore, RES_BREAK) ); EndUndo(SwUndoId::UI_INSERT_PAGE_BREAK); } + collectUIInformation("BREAK_PAGE","parameter"); } // Insert hard page break; diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx index ac0f4d9a30aa..ec35418d0ab8 100644 --- a/uitest/ui_logger_dsl/Special_commands.tx +++ b/uitest/ui_logger_dsl/Special_commands.tx @@ -17,7 +17,9 @@ SpecialCommand: then we can add whatever we need in the future */ writer_command: - writer_Type_command | writer_Select_command | writer_GOTO_command + writer_Type_command | writer_Select_command | writer_GOTO_command | + writer_Create_table | writer_Copy_Text | writer_Cut_Text | + writer_Paste_Text | writer_Insert_BreakPage ; writer_Type_command: 'Type on writer' what_to_type=Type_options @@ -28,6 +30,21 @@ writer_Select_command: writer_GOTO_command: 'GOTO page number' page_num=INT ; +writer_Create_table: + 'Create Table with Columns :' cols=INT ', Rows :' rows=INT +; +writer_Copy_Text: + 'Copy the Selected Text' +; +writer_Cut_Text: + 'Cut the Selected Text' +; +writer_Paste_Text: + 'Paste in the Current Cursor Location' +; +writer_Insert_BreakPage: + 'Insert Break Page' +; //=================================================================// /* This part for all the calc log statments: @@ -39,7 +56,9 @@ writer_GOTO_command: then we can add whatever we need in the future */ calc_command: - calc_Type_command | calc_switch_sheet | calc_Select_cell | calc_AutoFill_filter + calc_Type_command | calc_switch_sheet | calc_Select_cell | calc_AutoFill_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_Type_command: 'Type on current cell' what_to_type=Type_options @@ -63,6 +82,30 @@ range_of_cells: one_cell: '{' '"CELL":' input_cell=STRING '}' ; +calc_Delete_Cells: + 'Delete The Cells in' '{' '"RANGE":' input_range=STRING '}' +; +calc_Remove_Content: + 'Remove Content from This' '{' '"RANGE":' input_range=STRING '}' +; +calc_insert_cells: + 'Insert Cell around the ' '{' '"RANGE":' input_range=STRING '}' +; +calc_Cut_Cells: + 'CUT the selected ' '{' '"RANGE":' input_range=STRING '}' +; +calc_Copy_Cells: + 'COPY the selected ' '{' '"RANGE":' input_range=STRING '}' +; +calc_Paste_Cells: + 'Paste in the' '{' '"RANGE":' input_range=STRING '}' +; +calc_Merge_Cells: + 'Merge' '{' '"RANGE":' input_range=STRING '}' +; +calc_UNMerge_Cells: + 'Delete the merge between' '{' '"CELL":' input_range=STRING '}' +; //=================================================================// /* This part for all the impress log statments: diff --git a/uitest/ui_logger_dsl/UI_Object_commands.tx b/uitest/ui_logger_dsl/UI_Object_commands.tx index 03bb0f78ded1..d80ff0744119 100644 --- a/uitest/ui_logger_dsl/UI_Object_commands.tx +++ b/uitest/ui_logger_dsl/UI_Object_commands.tx @@ -5,7 +5,7 @@ import type_options EditUIObject CheckBoxUIObject RadioButtonUIObject - ListBoxUIObject + ListBoxUIObject ComboBoxUIObject SpinUIObject SpinFieldUIObject @@ -15,7 +15,7 @@ import type_options UIObjectCommand: ButtonUIObject | CheckBoxUIObject | EditUIObject | RadioButtonUIObject | ListBoxUIObject | ComboBoxUIObject | - SpinUIObject | SpinFieldUIObject | TabControlUIObject + SpinUIObject | SpinFieldUIObject | TabControlUIObject | General_type_command_on_UI_Object ; ButtonUIObject: @@ -69,3 +69,8 @@ Clear: increase_or_ecrease: 'Increase' | 'Decrease' ; + +//================================================== +General_type_command_on_UI_Object: + 'Type on' UI_Obj=STRING what_to_type=Type_options 'from' parent_id=ID +; diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py index 0d5593081693..ab198a6d234f 100644 --- a/uitest/ui_logger_dsl/dsl_core.py +++ b/uitest/ui_logger_dsl/dsl_core.py @@ -86,7 +86,20 @@ class ul_Compiler: 'impress_Type_command':self.handle_impress_Type_command, 'math_element_selector':self.handle_math_element_selector, 'math_Type_command':self.handle_math_Type_command, - 'setZoom_command':self.handle_setZoom_command + 'setZoom_command':self.handle_setZoom_command, + + 'writer_Copy_Text':self.do_nothing, + 'writer_Cut_Text':self.do_nothing, + 'writer_Paste_Text':self.do_nothing, + 'writer_Insert_BreakPage':self.do_nothing, + 'writer_Create_table':self.do_nothing, + 'calc_Remove_Content':self.do_nothing, + 'calc_Delete_Cells':self.do_nothing, + 'calc_insert_cells':self.do_nothing, + 'calc_Cut_Cells':self.do_nothing, + 'calc_Copy_Cells':self.do_nothing, + 'calc_Merge_Cells':self.do_nothing, + 'calc_UNMerge_Cells':self.do_nothing, }) self.log_lines=self.get_log_file(self.input_address) @@ -403,6 +416,9 @@ class ul_Compiler: for line in self.variables: self.output_stream.write(str(line)) + def do_nothing(self,Command): + line="to be added in the future" + def __del__(self): self.output_stream.close() diff --git a/uitest/ui_logger_dsl/uno_commands.tx b/uitest/ui_logger_dsl/uno_commands.tx index 1cf702de62a2..ad4f6b1775e3 100644 --- a/uitest/ui_logger_dsl/uno_commands.tx +++ b/uitest/ui_logger_dsl/uno_commands.tx @@ -2,9 +2,9 @@ UNOCommand: 'Send UNO Command' '(' uno_command_name=STRING ')' (prameters=parameter)? ; parameter: - '{' parameter_data *= data '}' + '{' parameter_data *= data ','? '}' ; data: - key=STRING ':' value= INT|ID ',' + ','? key=STRING ':' value= INT|ID ; diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx index 2b3d11691dc5..ab632fb35594 100644 --- a/vcl/source/uitest/logger.cxx +++ b/vcl/source/uitest/logger.cxx @@ -231,8 +231,7 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key aContent = "Type on math " + aKeyCode ; } else{ - aContent= pUIObject->get_type() + " Action:TYPE Id:" + - rID + " Parent:"+ aParentID +" " + aKeyCode; + aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ; } maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8)); } @@ -301,14 +300,29 @@ void UITestLogger::logEvent(const EventDescription& rDescription) aLogLine = "Select " + aParameterString; } else if(rDescription.aID=="writer_edit"){ - if(rDescription.aAction=="GOTO"){ aLogLine = "GOTO page number " + GetValueInMapWithIndex(rDescription.aParameters,0); } else if(rDescription.aAction=="SELECT"){ OUString to = GetValueInMapWithIndex(rDescription.aParameters,0); OUString from = GetValueInMapWithIndex(rDescription.aParameters,1); - aLogLine = "Select from Pos " + from + " to Pos" + to ; + aLogLine = "Select from Pos " + from + " to Pos " + to ; + } + else if(rDescription.aAction=="CREATE_TABLE"){ + OUString size = GetValueInMapWithIndex(rDescription.aParameters,0); + aLogLine = "Create Table with " + size; ; + } + else if(rDescription.aAction=="COPY"){ + aLogLine = "Copy the Selected Text"; + } + else if(rDescription.aAction=="CUT"){ + aLogLine = "Cut the Selected Text"; + } + else if(rDescription.aAction=="PASTE"){ + aLogLine = "Paste in the Current Cursor Location"; + } + else if(rDescription.aAction=="BREAK_PAGE"){ + aLogLine = "Insert Break Page"; } } else if(rDescription.aID=="grid_window"){ @@ -328,6 +342,30 @@ void UITestLogger::logEvent(const EventDescription& rDescription) GetValueInMapWithIndex(rDescription.aParameters,2) + " and Row " + GetValueInMapWithIndex(rDescription.aParameters,1); } + else if(rDescription.aAction=="DELETE_CONTENT"){ + aLogLine = "Remove Content from This " + aParameterString; + } + else if(rDescription.aAction=="DELETE_CELLS"){ + aLogLine = "Delete The Cells in" + aParameterString; + } + else if(rDescription.aAction=="INSERT_CELLS"){ + aLogLine = "Insert Cell around the " + aParameterString; + } + else if(rDescription.aAction=="CUT"){ + aLogLine = "CUT the selected " + aParameterString; + } + else if(rDescription.aAction=="COPY"){ + aLogLine = "COPY the selected " + aParameterString; + } + else if(rDescription.aAction=="PASTE"){ + aLogLine = "Paste in the " + aParameterString; + } + else if(rDescription.aAction=="MERGE_CELLS"){ + aLogLine = "Merge " + aParameterString; + } + else if(rDescription.aAction=="UNMERGE_CELL"){ + aLogLine = "Delete the merged " + aParameterString; + } } else if(rDescription.aParent=="element_selector"){ aLogLine ="Select element no " + rDescription.aID + |