sc/source/ui/view/viewfun2.cxx | 25 ++++++++++++++- sc/source/ui/view/viewfun3.cxx | 33 +++++++++++++++++++- sc/source/ui/view/viewfunc.cxx | 28 +++++++++++++++++ sw/source/core/edit/edtab.cxx | 19 +++++++++++ sw/source/uibase/dochdl/swdtflvr.cxx | 24 ++++++++++++++ sw/source/uibase/wrtsh/wrtsh1.cxx | 17 ++++++++++ uitest/ui_logger_dsl/Special_commands.tx | 47 +++++++++++++++++++++++++++-- uitest/ui_logger_dsl/UI_Object_commands.tx | 9 ++++- uitest/ui_logger_dsl/dsl_core.py | 18 ++++++++++- uitest/ui_logger_dsl/uno_commands.tx | 4 +- vcl/source/uitest/logger.cxx | 46 +++++++++++++++++++++++++--- 11 files changed, 256 insertions(+), 14 deletions(-)
New commits: commit d29c7d9fe6251a77f5c6390103f92e08e0ca6cf2 Author: Ahmed ElShreif <[email protected]> AuthorDate: Thu Jul 18 13:53:08 2019 -0500 Commit: Ahmed ElShreif <[email protected]> CommitDate: Sun Jul 21 21:57:41 2019 -0500 Log more Events: 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 ) 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 diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index f0772bab4aa2..f01fbff2ccf6 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -44,6 +44,8 @@ #include <com/sun/star/container/XNameContainer.hpp> #include <viewfunc.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <sc.hrc> #include <globstr.hrc> @@ -100,6 +102,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; @@ -1222,7 +1239,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; } @@ -1308,6 +1327,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 89aa916d26ab..d818f2389d60 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -37,6 +37,8 @@ #include <tools/urlobj.hxx> #include <sot/exchange.hxx> #include <memory> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <sfx2/lokhelper.hxx> @@ -76,6 +78,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 @@ -146,6 +164,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 ); @@ -177,7 +199,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; } @@ -194,6 +220,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; } @@ -1450,7 +1477,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 40d3dd18b186..b664263aafdc 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -41,6 +41,8 @@ #include <vcl/wrkwin.hxx> #include <stdlib.h> #include <unotools/charclass.hxx> +#include <vcl/uitest/logger.hxx> +#include <vcl/uitest/eventdescription.hxx> #include <viewfunc.hxx> #include <tabvwsh.hxx> @@ -108,6 +110,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? @@ -1627,6 +1645,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 @@ -1712,6 +1733,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(); } @@ -1989,6 +2014,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 ba028980c623..905b426f3d26 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 covert 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 9e4852af8551..e97ca1523eff 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> @@ -160,6 +162,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() @@ -789,6 +805,7 @@ int SwTransferable::Cut() int nRet = Copy( true ); if( nRet ) DeleteSelection(); + collectUIInformation("CUT","parameter"); return nRet; } @@ -1053,6 +1070,11 @@ int SwTransferable::Copy( bool bIsCut ) { CopyToClipboard( &m_pWrtShell->GetView().GetEditWin() ); } + + if( !bIsCut ){ + collectUIInformation("COPY","parameter"); + } + return nRet; } @@ -1370,6 +1392,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 0b4ae14c8290..b4e836b6dc35 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 = \ @@ -889,6 +905,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 0dac10050023..2713188c104f 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 + _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
