[Libreoffice-commits] core.git: 28 commits - include/vcl sc/source sd/source sfx2/source sw/source uitest/ui_logger_dsl vcl/source
Markus Mohrhard (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 19 14:58:25 UTC 2019
include/vcl/uitest/logger.hxx | 44 +
sc/source/core/data/document.cxx | 18
sc/source/ui/view/viewdata.cxx | 20
sc/source/ui/view/viewfun2.cxx | 26
sc/source/ui/view/viewfun3.cxx | 34
sc/source/ui/view/viewfunc.cxx | 28
sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 29
sd/source/ui/slidesorter/model/SlideSorterModel.cxx | 22
sfx2/source/control/unoctitm.cxx | 4
sw/source/core/edit/edtab.cxx | 20
sw/source/uibase/dochdl/swdtflvr.cxx | 24
sw/source/uibase/wrtsh/wrtsh1.cxx | 17
uitest/ui_logger_dsl/General_commands.tx | 29
uitest/ui_logger_dsl/Special_commands.tx | 209 ++++++
uitest/ui_logger_dsl/UI_Object_commands.tx | 65 +
uitest/ui_logger_dsl/dialog_commands.tx | 24
uitest/ui_logger_dsl/dsl_core.py | 581 +++++++++++++++++
uitest/ui_logger_dsl/example.ul | 34
uitest/ui_logger_dsl/starter_commands.tx | 13
uitest/ui_logger_dsl/type_options.tx | 9
uitest/ui_logger_dsl/ui_logger_dsl_grammar.tx | 29
uitest/ui_logger_dsl/uno_commands.tx | 17
vcl/source/uitest/logger.cxx | 359 +++++++++-
vcl/source/uitest/uiobject.cxx | 132 +++
vcl/source/window/dialog.cxx | 6
25 files changed, 1711 insertions(+), 82 deletions(-)
New commits:
commit 739c370522df4d48898b924e3c29957054f71a78
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Mon Aug 19 01:30:26 2019 +0800
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:40 2019 +0800
uitest: pass OUString by const reference and formatting fixes
Change-Id: I55eca745a84998c74e2d925ed53af20382d98289
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index fd996eb3d4cb..841cb3574213 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -109,21 +109,6 @@ using ::std::set;
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);
-}
-}
-
-namespace {
-
std::pair<SCTAB,SCTAB> getMarkedTableRange(const std::vector<ScTableUniquePtr>& rTables, const ScMarkData& rMark)
{
SCTAB nTabStart = MAXTAB;
@@ -145,6 +130,18 @@ std::pair<SCTAB,SCTAB> getMarkedTableRange(const std::vector<ScTableUniquePtr>&
return std::pair<SCTAB,SCTAB>(nTabStart,nTabEnd);
}
+void collectUIInformation(const std::map<OUString, OUString>& aParameters, const OUString& rAction)
+{
+ EventDescription aDescription;
+ aDescription.aID = "grid_window";
+ aDescription.aAction = rAction;
+ aDescription.aParameters = aParameters;
+ aDescription.aParent = "MainWindow";
+ aDescription.aKeyWord = "ScGridWinUIObject";
+
+ UITestLogger::getInstance().logEvent(aDescription);
+}
+
}
struct ScDefaultAttr
@@ -913,7 +910,9 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc
}
}
}
- collectUIInformation({{"NewName",rName}},"Rename_Sheet");
+
+ collectUIInformation({{"NewName", rName}}, "Rename_Sheet");
+
return bValid;
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 56865508373a..e15ca40404d6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -91,11 +91,11 @@ void lcl_LOKRemoveWindow(ScTabViewShell* pTabViewShell, ScSplitPos eWhich)
namespace {
-void collectUIInformation(const std::map<OUString, OUString>& aParameters,const OUString action)
+void collectUIInformation(const std::map<OUString, OUString>& aParameters, const OUString& rAction)
{
EventDescription aDescription;
aDescription.aID = "grid_window";
- aDescription.aAction = action;
+ aDescription.aAction = rAction;
aDescription.aParameters = aParameters;
aDescription.aParent = "MainWindow";
aDescription.aKeyWord = "ScGridWinUIObject";
@@ -857,7 +857,8 @@ void ScViewData::InsertTab( SCTAB nTab )
UpdateCurrentTab();
mpMarkData->InsertTab( nTab );
- collectUIInformation({{}},"InsertTab");
+
+ collectUIInformation({{}}, "InsertTab");
}
void ScViewData::InsertTabs( SCTAB nTab, SCTAB nNewSheets )
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 831e4c7dd8ee..ac926e722bb5 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -94,11 +94,11 @@ using ::editeng::SvxBorderLine;
namespace {
-void collectUIInformation(const std::map<OUString, OUString>& aParameters,const OUString action)
+void collectUIInformation(const std::map<OUString, OUString>& aParameters, const OUString& rAction)
{
EventDescription aDescription;
aDescription.aID = "grid_window";
- aDescription.aAction = action;
+ aDescription.aAction = rAction;
aDescription.aParameters = aParameters;
aDescription.aParent = "MainWindow";
aDescription.aKeyWord = "ScGridWinUIObject";
@@ -1227,11 +1227,14 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter )
pDocSh->UpdateOle(&GetViewData());
UpdateInputLine();
+
+ OUString aStartAddress = aMarkRange.aStart.GetColRowString();
+ OUString aEndAddress = aMarkRange.aEnd.GetColRowString();
+
+ collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "MERGE_CELLS");
}
}
- OUString aStartAddress = aMarkRange.aStart.GetColRowString();
- OUString aEndAddress = aMarkRange.aEnd.GetColRowString();
- collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"MERGE_CELLS");
+
return bOk;
}
@@ -1318,8 +1321,8 @@ bool ScViewFunc::RemoveMerge()
pDocSh->UpdateOle(&GetViewData());
}
- OUString Cell_location = aRange.aStart.GetColRowString();
- collectUIInformation({{"CELL", Cell_location }},"UNMERGE_CELL");
+ OUString aCellLocation = aRange.aStart.GetColRowString();
+ collectUIInformation({{"CELL", aCellLocation}}, "UNMERGE_CELL");
return true; //! bOk ??
}
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index b43debda5e7e..e39cdd488fac 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -66,7 +66,7 @@ using namespace com::sun::star;
namespace {
-void collectUIInformation(const std::map<OUString, OUString>& aParameters,OUString action)
+void collectUIInformation(const std::map<OUString, OUString>& aParameters, const OUString& action)
{
EventDescription aDescription;
aDescription.aID = "grid_window";
@@ -153,7 +153,8 @@ void ScViewFunc::CutToClip()
OUString aStartAddress = aRange.aStart.GetColRowString();
OUString aEndAddress = aRange.aEnd.GetColRowString();
- collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"CUT");
+
+ collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "CUT");
}
else
ErrorMessage( STR_NOMULTISELECT );
@@ -188,7 +189,7 @@ bool ScViewFunc::CopyToClip( ScDocument* pClipDoc, bool bCut, bool bApi, bool bI
if( !bCut ){
OUString aStartAddress = aRange.aStart.GetColRowString();
OUString aEndAddress = aRange.aEnd.GetColRowString();
- collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"COPY");
+ collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "COPY");
}
return bDone;
}
@@ -1465,7 +1466,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
}
OUString aStartAddress = aMarkRange.aStart.GetColRowString();
OUString aEndAddress = aMarkRange.aEnd.GetColRowString();
- collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"PASTE");
+ collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "PASTE");
return true;
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 13c8bd708812..ad9f4a61cd05 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -101,11 +101,11 @@ ScViewFunc::~ScViewFunc()
namespace {
-void collectUIInformation(const std::map<OUString, OUString>& aParameters,const OUString action)
+void collectUIInformation(const std::map<OUString, OUString>& aParameters, const OUString& rAction)
{
EventDescription aDescription;
aDescription.aID = "grid_window";
- aDescription.aAction = action;
+ aDescription.aAction = rAction;
aDescription.aParameters = aParameters;
aDescription.aParent = "MainWindow";
aDescription.aKeyWord = "ScGridWinUIObject";
@@ -1636,7 +1636,7 @@ bool ScViewFunc::InsertCells( InsCellCmd eCmd, bool bRecord, bool bPartOfPaste )
}
OUString aStartAddress = aRange.aStart.GetColRowString();
OUString aEndAddress = aRange.aEnd.GetColRowString();
- collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"INSERT_CELLS");
+ collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "INSERT_CELLS");
return bSuccess;
}
else
@@ -1724,7 +1724,7 @@ void ScViewFunc::DeleteCells( DelCellCmd eCmd )
OUString aStartAddress = aRange.aStart.GetColRowString();
OUString aEndAddress = aRange.aEnd.GetColRowString();
- collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"DELETE_CELLS");
+ collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "DELETE_CELLS");
Unmark();
}
@@ -2005,7 +2005,7 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags )
}
OUString aStartAddress = aMarkRange.aStart.GetColRowString();
OUString aEndAddress = aMarkRange.aEnd.GetColRowString();
- collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}},"DELETE");
+ collectUIInformation({{"RANGE", aStartAddress + ":" + aEndAddress}}, "DELETE");
}
// column width/row height (via header) - undo OK
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index a97ccb7d0588..069836e790cb 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -113,12 +113,12 @@ SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet);
namespace {
-void collectUIInformation(const std::map<OUString, OUString>& aParameters,const OUString& action)
+void collectUIInformation(const std::map<OUString, OUString>& aParameters, const OUString& rAction)
{
EventDescription aDescription;
aDescription.aID = "impress_win_or_draw_win";
aDescription.aParameters = aParameters;
- aDescription.aAction = action;
+ aDescription.aAction = rAction;
aDescription.aKeyWord = "ImpressWindowUIObject";
aDescription.aParent = "MainWindow";
@@ -938,7 +938,7 @@ void SlotManager::RenameSlide(const SfxRequest& rRequest)
}
OUString aNewName;
aNameDlg->GetName( aNewName );
- collectUIInformation({{"OldName",aOldName},{"NewName",aNewName}},"RENAME");
+ collectUIInformation({{"OldName", aOldName}, {"NewName", aNewName}}, "RENAME");
aNameDlg.disposeAndClear();
}
// Tell the slide sorter about the name change (necessary for
@@ -1105,7 +1105,7 @@ void SlotManager::InsertSlide (SfxRequest& rRequest)
PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
mrSlideSorter.GetController().GetPageSelector().SelectPage(pNewPage);
- collectUIInformation({{"POS", 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)
@@ -1152,7 +1152,8 @@ void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
{
rSelector.SelectPage(it);
}
- collectUIInformation({{"POS", OUString::number(nInsertPosition+2)}},"Duplicate");
+
+ 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 7811c3b08e68..5b9f41fea0d8 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -106,12 +106,12 @@ namespace {
namespace {
-void collectUIInformation(const OUString& num,const OUString& action)
+void collectUIInformation(const OUString& num, const OUString& rAction)
{
EventDescription aDescription;
aDescription.aID = "impress_win_or_draw_win";
aDescription.aParameters = {{"POS", num}};
- aDescription.aAction = action;
+ aDescription.aAction = rAction;
aDescription.aKeyWord = "ImpressWindowUIObject";
aDescription.aParent = "MainWindow";
@@ -632,9 +632,8 @@ bool SlideSorterModel::DeleteSlide (const SdPage* pPage)
bMarkedSelected = (*iter)->HasState(PageDescriptor::ST_Selected);
maPageDescriptors.erase(iter);
UpdateIndices(nIndex);
- }
- if(nIndex>=0){
- collectUIInformation(OUString::number(nIndex+1),"Delete_Slide_or_Page");
+
+ collectUIInformation(OUString::number(nIndex + 1), "Delete_Slide_or_Page");
}
return bMarkedSelected;
}
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 0a50a39735eb..3cc88838a489 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -611,7 +611,7 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
const css::uno::Reference< css::frame::XDispatchResultListener >& rListener )
{
collectUsageInformation(aURL, aArgs);
- collectUIInformation(aURL,aArgs);
+ collectUIInformation(aURL, aArgs);
SolarMutexGuard aGuard;
if (
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index edb2510f8347..c60aed7af194 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -55,11 +55,11 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
namespace {
-void collectUIInformation(const OUString action,const OUString aParameters)
+void collectUIInformation(const OUString& rAction, const OUString& aParameters)
{
EventDescription aDescription;
- aDescription.aAction = action;
- aDescription.aParameters = {{"parameters",aParameters}};
+ aDescription.aAction = rAction;
+ aDescription.aParameters = {{"parameters", aParameters}};
aDescription.aID = "writer_edit";
aDescription.aKeyWord = "SwEditWinUIObject";
aDescription.aParent = "MainWindow";
@@ -129,8 +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);
+
+ 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 8a192441b769..0d5a46119ab3 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -165,11 +165,11 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::datatransfer;
namespace {
-void collectUIInformation(const OUString action,const OUString aParameters)
+void collectUIInformation(const OUString& rAction, const OUString& aParameters)
{
EventDescription aDescription;
- aDescription.aAction = action;
- aDescription.aParameters = {{"parameters",aParameters}};
+ aDescription.aAction = rAction;
+ aDescription.aParameters = {{"parameters", aParameters}};
aDescription.aID = "writer_edit";
aDescription.aKeyWord = "SwEditWinUIObject";
aDescription.aParent = "MainWindow";
@@ -846,7 +846,7 @@ int SwTransferable::Cut()
int nRet = Copy( true );
if( nRet )
DeleteSelection();
- collectUIInformation("CUT","parameter");
+ collectUIInformation("CUT", "parameter");
return nRet;
}
@@ -1113,7 +1113,7 @@ int SwTransferable::Copy( bool bIsCut )
}
if( !bIsCut ){
- collectUIInformation("COPY","parameter");
+ collectUIInformation("COPY", "parameter");
}
return nRet;
@@ -1433,7 +1433,7 @@ bool SwTransferable::Paste(SwWrtShell& rSh, TransferableDataHelper& rData, RndSt
}
}
- collectUIInformation("PASTE","parameter");
+ collectUIInformation("PASTE", "parameter");
return EXCHG_INOUT_ACTION_NONE != nAction &&
SwTransferable::PasteData( rData, rSh, nAction, nActionFlags, nFormat,
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 87202b3cd219..cd5a638250e8 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -121,11 +121,11 @@ using namespace sw::mark;
using namespace com::sun::star;
namespace {
-void collectUIInformation(const OUString action,const OUString aParameters)
+void collectUIInformation(const OUString& rAction, const OUString& aParameters)
{
EventDescription aDescription;
- aDescription.aAction = action;
- aDescription.aParameters = {{"parameters",aParameters}};
+ aDescription.aAction = rAction;
+ aDescription.aParameters = {{"parameters", aParameters}};
aDescription.aID = "writer_edit";
aDescription.aKeyWord = "SwEditWinUIObject";
aDescription.aParent = "MainWindow";
@@ -912,7 +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");
+ collectUIInformation("BREAK_PAGE", "parameter");
}
// Insert hard page break;
commit 147ae53b68844aa1b088926931f958e30888ffda
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Sun Aug 18 21:54:52 2019 +0800
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:40 2019 +0800
uitest: print useful message when textX is not installed
Change-Id: If6f6c71f72ba9def4885ffbd74cb7814f7465f2c
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index b77a3449aa6e..210713b4478b 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -10,7 +10,12 @@ import os
import sys
import argparse
import keyword
-from textx.metamodel import metamodel_from_file
+try:
+ from textx.metamodel import metamodel_from_file
+except ImportError:
+ print("textx is a required package.")
+ print("Please install the package for example with \"pip3 install --user textx\"")
+ sys.exit(1)
tab=" "
double_tab=" "
@@ -573,4 +578,4 @@ def main():
del ui_logger
if __name__ == '__main__':
- main()
\ No newline at end of file
+ main()
commit 418124c3322bff0e28f4da76e90940b23060c29f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Sun Aug 18 23:34:32 2019 +0800
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:40 2019 +0800
uitest: fixed for formatting and plugin stringconstant
Change-Id: Id657c19223f20d1175f9a774357e8b1f11344fdf
diff --git a/include/vcl/uitest/logger.hxx b/include/vcl/uitest/logger.hxx
index 6c8c5008541a..450285c5c247 100644
--- a/include/vcl/uitest/logger.hxx
+++ b/include/vcl/uitest/logger.hxx
@@ -15,10 +15,32 @@
#include <tools/stream.hxx>
#include <vcl/vclevent.hxx>
-namespace com { namespace sun { namespace star {
- namespace beans { struct PropertyValue; }
-} } }
-namespace com { namespace sun { namespace star { namespace uno { template <class E> class Sequence; } } } }
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace beans
+{
+struct PropertyValue;
+}
+}
+}
+}
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace uno
+{
+template <class E> class Sequence;
+}
+}
+}
+}
struct EventDescription;
class Control;
@@ -27,7 +49,6 @@ class KeyEvent;
class UITEST_DLLPUBLIC UITestLogger
{
private:
-
SvFileStream maStream;
bool mbValid;
@@ -35,29 +56,24 @@ private:
OUString app_name;
public:
-
UITestLogger();
- void logCommand(const OUString& rAction, const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
+ void logCommand(const OUString& rAction,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
- void logAction(VclPtr<Control> const & xUIElement, VclEventId nEvent);
+ void logAction(VclPtr<Control> const& xUIElement, VclEventId nEvent);
void log(const OUString& rString);
- void logKeyInput(VclPtr<vcl::Window> const & xUIElement, const KeyEvent& rEvent);
+ void logKeyInput(VclPtr<vcl::Window> const& xUIElement, const KeyEvent& rEvent);
void logEvent(const EventDescription& rDescription);
static UITestLogger& getInstance();
- void setAppName(OUString name){
- app_name=name;
- }
-
- OUString getAppName(){
- return app_name;
- }
+ void setAppName(OUString name) { app_name = name; }
+ OUString getAppName() { return app_name; }
};
#endif
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 0ecd673f9879..03c439fcbd7c 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -20,9 +20,9 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <memory>
-namespace{
-
-bool isDialogWindow(vcl::Window const * pWindow)
+namespace
+{
+bool isDialogWindow(vcl::Window const* pWindow)
{
WindowType nType = pWindow->GetType();
// DIALOG to MODALDIALOG
@@ -39,7 +39,7 @@ bool isDialogWindow(vcl::Window const * pWindow)
return false;
}
-bool isTopWindow(vcl::Window const * pWindow)
+bool isTopWindow(vcl::Window const* pWindow)
{
WindowType eType = pWindow->GetType();
if (eType == WindowType::FLOATINGWINDOW)
@@ -60,17 +60,16 @@ vcl::Window* get_top_parent(vcl::Window* pWindow)
return get_top_parent(pParent);
}
-
-
}
-UITestLogger::UITestLogger():
- maStream(),
- mbValid(false)
+UITestLogger::UITestLogger()
+ : maStream()
+ , mbValid(false)
{
static const char* pFile = std::getenv("LO_COLLECT_UIINFO");
if (pFile)
{
- OUString aDirPath("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/uitest/");
+ OUString aDirPath("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER
+ "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/uitest/");
rtl::Bootstrap::expandMacros(aDirPath);
osl::Directory::createPath(aDirPath);
OUString aFilePath = aDirPath + OUString::fromUtf8(pFile);
@@ -80,7 +79,8 @@ UITestLogger::UITestLogger():
}
}
-void UITestLogger::logCommand(const OUString& rAction, const css::uno::Sequence< css::beans::PropertyValue >& rArgs)
+void UITestLogger::logCommand(const OUString& rAction,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArgs)
{
if (!mbValid)
return;
@@ -126,10 +126,10 @@ void UITestLogger::logCommand(const OUString& rAction, const css::uno::Sequence<
maStream.WriteLine(OUStringToOString(aCommand, RTL_TEXTENCODING_UTF8));
}
-namespace {
-
+namespace
+{
// most likely this should be recursive
-bool child_windows_have_focus(VclPtr<vcl::Window> const & xUIElement)
+bool child_windows_have_focus(VclPtr<vcl::Window> const& xUIElement)
{
sal_Int32 nCount = xUIElement->GetChildCount();
for (sal_Int32 i = 0; i < nCount; ++i)
@@ -144,10 +144,9 @@ bool child_windows_have_focus(VclPtr<vcl::Window> const & xUIElement)
}
return false;
}
-
}
-void UITestLogger::logAction(VclPtr<Control> const & xUIElement, VclEventId nEvent)
+void UITestLogger::logAction(VclPtr<Control> const& xUIElement, VclEventId nEvent)
{
if (!mbValid)
return;
@@ -177,14 +176,14 @@ void UITestLogger::log(const OUString& rString)
maStream.WriteLine(OUStringToOString(rString, RTL_TEXTENCODING_UTF8));
}
-void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const KeyEvent& rEvent)
+void UITestLogger::logKeyInput(VclPtr<vcl::Window> const& xUIElement, const KeyEvent& rEvent)
{
if (!mbValid)
return;
//We need to check for Parent's ID in case the UI Element is SubEdit of Combobox/SpinField
- const OUString& rID = xUIElement->get_id().isEmpty() ?
- xUIElement->GetParent()->get_id() : xUIElement->get_id();
+ const OUString& rID
+ = xUIElement->get_id().isEmpty() ? xUIElement->GetParent()->get_id() : xUIElement->get_id();
if (rID.isEmpty())
return;
@@ -195,22 +194,12 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
bool bMod2 = rEvent.GetKeyCode().IsMod2();
bool bMod3 = rEvent.GetKeyCode().IsMod3();
- std::map<OUString, sal_uInt16> aKeyMap = {
- {"ESC", KEY_ESCAPE},
- {"TAB", KEY_TAB},
- {"DOWN", KEY_DOWN},
- {"UP", KEY_UP},
- {"LEFT", KEY_LEFT},
- {"RIGHT", KEY_RIGHT},
- {"DELETE", KEY_DELETE},
- {"INSERT", KEY_INSERT},
- {"BACKSPACE", KEY_BACKSPACE},
- {"RETURN", KEY_RETURN},
- {"HOME", KEY_HOME},
- {"END", KEY_END},
- {"PAGEUP", KEY_PAGEUP},
- {"PAGEDOWN", KEY_PAGEDOWN}
- };
+ std::map<OUString, sal_uInt16> aKeyMap
+ = { { "ESC", KEY_ESCAPE }, { "TAB", KEY_TAB }, { "DOWN", KEY_DOWN },
+ { "UP", KEY_UP }, { "LEFT", KEY_LEFT }, { "RIGHT", KEY_RIGHT },
+ { "DELETE", KEY_DELETE }, { "INSERT", KEY_INSERT }, { "BACKSPACE", KEY_BACKSPACE },
+ { "RETURN", KEY_RETURN }, { "HOME", KEY_HOME }, { "END", KEY_END },
+ { "PAGEUP", KEY_PAGEUP }, { "PAGEDOWN", KEY_PAGEDOWN } };
OUString aFound;
for (auto& itr : aKeyMap)
@@ -247,7 +236,7 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
std::unique_ptr<UIObject> pUIObject = xUIElement->GetUITestFactory()(xUIElement.get());
- VclPtr <vcl::Window> pParent = xUIElement->GetParent();
+ VclPtr<vcl::Window> pParent = xUIElement->GetParent();
while (!pParent->IsTopWindow())
{
@@ -258,52 +247,63 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
OUString aContent;
- if(pUIObject->get_type()=="EditUIObject"){
- if(aParentID=="")
+ if (pUIObject->get_type() == "EditUIObject")
+ {
+ if (aParentID.isEmpty())
{
- VclPtr <vcl::Window> pParent_top = get_top_parent(xUIElement);
- aParentID= pParent_top->get_id();
+ VclPtr<vcl::Window> pParent_top = get_top_parent(xUIElement);
+ aParentID = pParent_top->get_id();
}
- if(aParentID==""){
- aContent = aContent+"Type on '" + rID + "' " + aKeyCode;
+ if (aParentID.isEmpty())
+ {
+ aContent = aContent + "Type on '" + rID + "' " + aKeyCode;
}
- else{
- aContent = aContent+"Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ else
+ {
+ aContent = aContent + "Type on '" + rID + "' " + aKeyCode + " from " + aParentID;
}
}
- else if(pUIObject->get_type()=="SwEditWinUIObject" && rID=="writer_edit"){
- aContent = "Type on writer " + aKeyCode ;
+ else if (pUIObject->get_type() == "SwEditWinUIObject" && rID == "writer_edit")
+ {
+ aContent = "Type on writer " + aKeyCode;
}
- else if(pUIObject->get_type()=="ScGridWinUIObject" && rID=="grid_window"){
- aContent = "Type on current cell " + aKeyCode ;
+ else if (pUIObject->get_type() == "ScGridWinUIObject" && rID == "grid_window")
+ {
+ aContent = "Type on current cell " + aKeyCode;
}
- else if(pUIObject->get_type()=="ImpressWindowUIObject" && rID=="impress_win"){
- aContent = "Type on impress " + aKeyCode ;
+ else if (pUIObject->get_type() == "ImpressWindowUIObject" && rID == "impress_win")
+ {
+ aContent = "Type on impress " + aKeyCode;
}
- else if(pUIObject->get_type()=="WindowUIObject" && rID=="math_edit"){
- aContent = "Type on math " + aKeyCode ;
+ else if (pUIObject->get_type() == "WindowUIObject" && rID == "math_edit")
+ {
+ aContent = "Type on math " + aKeyCode;
}
- else if(rID=="draw_win"){
- aContent = "Type on draw " + aKeyCode ;
+ else if (rID == "draw_win")
+ {
+ aContent = "Type on draw " + aKeyCode;
}
- else{
- if(aParentID=="")
+ else
+ {
+ if (aParentID.isEmpty())
{
- VclPtr <vcl::Window> pParent_top = get_top_parent(xUIElement);
- aParentID= pParent_top->get_id();
+ VclPtr<vcl::Window> pParent_top = get_top_parent(xUIElement);
+ aParentID = pParent_top->get_id();
}
- if(aParentID==""){
- aContent = "Type on '" + rID + "' " + aKeyCode ;
+ if (aParentID.isEmpty())
+ {
+ aContent = "Type on '" + rID + "' " + aKeyCode;
}
- else{
- aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ else
+ {
+ aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID;
}
}
maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
}
-namespace {
-
+namespace
+{
OUString StringMapToOUString(const std::map<OUString, OUString>& rParameters)
{
if (rParameters.empty())
@@ -312,11 +312,15 @@ OUString StringMapToOUString(const std::map<OUString, OUString>& rParameters)
OUStringBuffer aParameterString = " {";
for (std::map<OUString, OUString>::const_iterator itr = rParameters.begin();
- itr != rParameters.end(); ++itr)
+ itr != rParameters.end(); ++itr)
{
if (itr != rParameters.begin())
aParameterString.append(", ");
- aParameterString.append("\"").append(itr->first).append("\": \"").append(itr->second).append("\"");
+ aParameterString.append("\"")
+ .append(itr->first)
+ .append("\": \"")
+ .append(itr->second)
+ .append("\"");
}
aParameterString.append("}");
@@ -324,29 +328,29 @@ OUString StringMapToOUString(const std::map<OUString, OUString>& rParameters)
return aParameterString.makeStringAndClear();
}
-OUString GetValueInMapWithIndex(const std::map<OUString, OUString>& rParameters,sal_Int32 index)
+OUString GetValueInMapWithIndex(const std::map<OUString, OUString>& rParameters, sal_Int32 index)
{
- sal_Int32 j=0;
+ sal_Int32 j = 0;
std::map<OUString, OUString>::const_iterator itr = rParameters.begin();
- for ( ; itr != rParameters.end() && j<index ; ++itr,++j);
+ for (; itr != rParameters.end() && j < index; ++itr, ++j)
+ ;
return itr->second;
}
-
-OUString GetKeyInMapWithIndex(const std::map<OUString, OUString>& rParameters,sal_Int32 index)
+OUString GetKeyInMapWithIndex(const std::map<OUString, OUString>& rParameters, sal_Int32 index)
{
- sal_Int32 j=0;
+ sal_Int32 j = 0;
std::map<OUString, OUString>::const_iterator itr = rParameters.begin();
- for ( ; itr != rParameters.end() && j<index ; ++itr,++j);
+ for (; itr != rParameters.end() && j < index; ++itr, ++j)
+ ;
return itr->first;
}
-
}
void UITestLogger::logEvent(const EventDescription& rDescription)
@@ -354,138 +358,181 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
OUString aParameterString = StringMapToOUString(rDescription.aParameters);
//here we will customize our statments depending on the caller of this function
- OUString aLogLine ;
+ OUString aLogLine;
//first check on general commands
- if(rDescription.aAction=="SET"){
- aLogLine = "Set Zoom to " + GetValueInMapWithIndex(rDescription.aParameters,0);
+ if (rDescription.aAction == "SET")
+ {
+ aLogLine = "Set Zoom to " + GetValueInMapWithIndex(rDescription.aParameters, 0);
}
- else if(rDescription.aAction=="SIDEBAR"){
+ else if (rDescription.aAction == "SIDEBAR")
+ {
aLogLine = "From SIDEBAR Choose " + aParameterString;
}
- else if(rDescription.aAction=="SELECT" && rDescription.aID==""){
+ else if (rDescription.aAction == "SELECT" && rDescription.aID.isEmpty())
+ {
aLogLine = "Select " + aParameterString;
}
- else if(rDescription.aID=="writer_edit"){
- if(rDescription.aAction=="GOTO"){
- aLogLine = "GOTO page number " + GetValueInMapWithIndex(rDescription.aParameters,0);
+ 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 ;
+ 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;
}
- else if(rDescription.aAction=="CREATE_TABLE"){
- OUString size = GetValueInMapWithIndex(rDescription.aParameters,0);
- aLogLine = "Create Table with " + size; ;
+ 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 == "COPY")
+ {
+ aLogLine = "Copy the Selected Text";
}
- else if(rDescription.aAction=="CUT"){
- aLogLine = "Cut 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 == "PASTE")
+ {
+ aLogLine = "Paste in the Current Cursor Location";
}
- else if(rDescription.aAction=="BREAK_PAGE"){
- aLogLine = "Insert Break Page";
+ else if (rDescription.aAction == "BREAK_PAGE")
+ {
+ aLogLine = "Insert Break Page";
}
}
- else if(rDescription.aID=="grid_window"){
-
- if(rDescription.aAction=="SELECT"){
- OUString type = GetKeyInMapWithIndex(rDescription.aParameters,0);
- if(type=="CELL" || type=="RANGE"){
- aLogLine = "Select from calc" + aParameterString ;
+ else if (rDescription.aID == "grid_window")
+ {
+ if (rDescription.aAction == "SELECT")
+ {
+ OUString type = GetKeyInMapWithIndex(rDescription.aParameters, 0);
+ if (type == "CELL" || type == "RANGE")
+ {
+ aLogLine = "Select from calc" + aParameterString;
}
- else if(type=="TABLE")
+ else if (type == "TABLE")
{
- aLogLine = "Switch to sheet number " + GetValueInMapWithIndex(rDescription.aParameters,0) ;
+ aLogLine = "Switch to sheet number "
+ + GetValueInMapWithIndex(rDescription.aParameters, 0);
}
}
- else if(rDescription.aAction=="LAUNCH"){
- aLogLine = "Lanuch AutoFilter from Col "+
- GetValueInMapWithIndex(rDescription.aParameters,2) +
- " and Row " + GetValueInMapWithIndex(rDescription.aParameters,1);
+ else if (rDescription.aAction == "LAUNCH")
+ {
+ aLogLine = "Lanuch AutoFilter from Col "
+ + GetValueInMapWithIndex(rDescription.aParameters, 2) + " and Row "
+ + GetValueInMapWithIndex(rDescription.aParameters, 1);
}
- else if(rDescription.aAction=="DELETE_CONTENT"){
+ else if (rDescription.aAction == "DELETE_CONTENT")
+ {
aLogLine = "Remove Content from This " + aParameterString;
}
- else if(rDescription.aAction=="DELETE_CELLS"){
+ else if (rDescription.aAction == "DELETE_CELLS")
+ {
aLogLine = "Delete The Cells in" + aParameterString;
}
- else if(rDescription.aAction=="INSERT_CELLS"){
+ else if (rDescription.aAction == "INSERT_CELLS")
+ {
aLogLine = "Insert Cell around the " + aParameterString;
}
- else if(rDescription.aAction=="CUT"){
+ else if (rDescription.aAction == "CUT")
+ {
aLogLine = "CUT the selected " + aParameterString;
}
- else if(rDescription.aAction=="COPY"){
+ else if (rDescription.aAction == "COPY")
+ {
aLogLine = "COPY the selected " + aParameterString;
}
- else if(rDescription.aAction=="PASTE"){
+ else if (rDescription.aAction == "PASTE")
+ {
aLogLine = "Paste in the " + aParameterString;
}
- else if(rDescription.aAction=="MERGE_CELLS"){
+ else if (rDescription.aAction == "MERGE_CELLS")
+ {
aLogLine = "Merge " + aParameterString;
}
- else if(rDescription.aAction=="UNMERGE_CELL"){
+ else if (rDescription.aAction == "UNMERGE_CELL")
+ {
aLogLine = "Delete the merged " + aParameterString;
}
- else if(rDescription.aAction=="Rename_Sheet"){
- aLogLine = "Rename The Selected Tab to \""+\
- GetValueInMapWithIndex(rDescription.aParameters,0)+"\"";
+ else if (rDescription.aAction == "Rename_Sheet")
+ {
+ aLogLine = "Rename The Selected Tab to \""
+ + GetValueInMapWithIndex(rDescription.aParameters, 0) + "\"";
}
- else if(rDescription.aAction=="InsertTab"){
+ else if (rDescription.aAction == "InsertTab")
+ {
aLogLine = "Insert New Tab ";
}
}
- 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 (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 (UITestLogger::getInstance().getAppName() == "draw")
+ {
+ 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 (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 (UITestLogger::getInstance().getAppName() == "draw")
+ {
+ aLogLine
+ = "Delete Page number " + GetValueInMapWithIndex(rDescription.aParameters, 0);
}
}
- else if(rDescription.aAction=="Duplicate"){
+ 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 (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 (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 +
- " From " + rDescription.aParent;
+ else if (rDescription.aParent == "element_selector")
+ {
+ aLogLine = "Select element no " + rDescription.aID + " From " + rDescription.aParent;
}
- else{
- aLogLine = rDescription.aKeyWord + " Action:" +
- rDescription.aAction + " Id:" + rDescription.aID +
- " Parent:" + rDescription.aParent + aParameterString;
+ else
+ {
+ aLogLine = rDescription.aKeyWord + " Action:" + rDescription.aAction + " Id:"
+ + rDescription.aID + " Parent:" + rDescription.aParent + aParameterString;
}
log(aLogLine);
}
UITestLogger& UITestLogger::getInstance()
{
- ImplSVData *const pSVData = ImplGetSVData();
+ ImplSVData* const pSVData = ImplGetSVData();
assert(pSVData);
if (!pSVData->maWinData.m_pUITestLogger)
@@ -496,5 +543,4 @@ 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 d26072cd05a9..59510d6c03c8 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -622,7 +622,7 @@ OUString ButtonUIObject::get_action(VclEventId nEvent) const
return "Start database" ;
}
else{
- if (get_top_parent(mxButton)->get_id()==""){
+ if (get_top_parent(mxButton)->get_id().isEmpty()){
//This part because if we don't have parent
return "Click on '" + mxButton->get_id() ;
}
@@ -751,7 +751,7 @@ OUString EditUIObject::get_action(VclEventId nEvent) const
const Selection& rSelection = mxEdit->GetSelection();
long nMin = rSelection.Min();
long nMax = rSelection.Max();
- if(get_top_parent(mxEdit)->get_id()==""){
+ if(get_top_parent(mxEdit)->get_id().isEmpty()){
//This part because if we don't have parent
return "Select in '" +
mxEdit->get_id() +
@@ -880,7 +880,7 @@ OUString CheckBoxUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::CheckboxToggle)
{
- if(get_top_parent(mxCheckBox)->get_id()==""){
+ if(get_top_parent(mxCheckBox)->get_id().isEmpty()){
//This part because if we don't have parent
return "Toggle '" + mxCheckBox->get_id() + "' CheckBox";
}
@@ -934,7 +934,7 @@ OUString RadioButtonUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::RadiobuttonToggle)
{
- if(get_top_parent(mxRadioButton)->get_id()==""){
+ if(get_top_parent(mxRadioButton)->get_id().isEmpty()){
//This part because if we don't have parent
return "Select '" + mxRadioButton->get_id() + "' RadioButton";
}
@@ -1044,7 +1044,7 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ListboxSelect)
{
sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
- if(get_top_parent(mxListBox)->get_id()==""){
+ if(get_top_parent(mxListBox)->get_id().isEmpty()){
//This part because if we don't have parent
return "Select element with position " + OUString::number(nPos) +
" in '" + mxListBox->get_id();
@@ -1054,7 +1054,7 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) const
}
else if (nEvent == VclEventId::ListboxFocus)
{
- if(get_top_parent(mxListBox)->get_id()=="")
+ if(get_top_parent(mxListBox)->get_id().isEmpty())
{
//This part because if we don't have parent
return this->get_type() + " Action:FOCUS Id:" + mxListBox->get_id();
@@ -1129,7 +1129,7 @@ OUString ComboBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ComboboxSelect)
{
sal_Int32 nPos = mxComboBox->GetSelectedEntryPos();
- if (get_top_parent(mxComboBox)->get_id()==""){
+ if (get_top_parent(mxComboBox)->get_id().isEmpty()){
//This part because if we don't have parent
return "Select in '" + mxComboBox->get_id() +
"' ComboBox item number " + OUString::number(nPos);
@@ -1249,7 +1249,7 @@ OUString SpinFieldUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::SpinfieldUp)
{
- if(get_top_parent(mxSpinField)->get_id()=="")
+ if(get_top_parent(mxSpinField)->get_id().isEmpty())
{
//This part because if we don't have parent
return "Increase '" + mxSpinField->get_id();
@@ -1259,7 +1259,7 @@ OUString SpinFieldUIObject::get_action(VclEventId nEvent) const
}
else if (nEvent == VclEventId::SpinfieldDown)
{
- if(get_top_parent(mxSpinField)->get_id()=="")
+ if(get_top_parent(mxSpinField)->get_id().isEmpty())
{
//This part because if we don't have parent
return "Decrease '" + mxSpinField->get_id();
@@ -1328,7 +1328,7 @@ OUString TabControlUIObject::get_action(VclEventId nEvent) const
{
sal_Int32 nPageId = mxTabControl->GetCurPageId();
- if(get_top_parent(mxTabControl)->get_id()==""){
+ if(get_top_parent(mxTabControl)->get_id().isEmpty()){
//This part because if we don't have parent
return "Choose Tab number " + OUString::number(mxTabControl->GetPagePos(nPageId)) +
" in '" + mxTabControl->get_id();
commit 49fb8654b4d6b0eb3184cb0218f164df88016b74
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Sat Aug 17 21:37:21 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:39 2019 +0800
uitest: add the SideBar implementation
Change-Id: I7de9bd97e868624476b5c39a5e37afc945206e4e
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index 088fcf4a0d64..b77a3449aa6e 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -97,6 +97,7 @@ class ul_Compiler:
'math_Type_command':self.handle_math_Type_command,
'setZoom_command':self.handle_setZoom_command,
'draw_Type_command':self.handle_draw_Type_command,
+ 'SideBar':self.handle_SideBar,
'writer_Copy_Text':self.do_nothing,
'writer_Cut_Text':self.do_nothing,
@@ -188,6 +189,15 @@ class ul_Compiler:
self.current_app=app[StarterCommand.program_name]
self.prev_command=StarterCommand
+ def handle_SideBar(self , SideBar):
+
+ line=" self.xUITest.executeCommand(\".uno:Sidebar\")\n"
+ self.variables.append(line)
+
+ self.write_line_with_one_parameters("MainWindow","SIDEBAR","PANEL",SideBar.name)
+
+ self.prev_command=SideBar
+
def handle_Dialog(self, DialogCommand):
if (DialogCommand.__class__.__name__ == "OpenModalDialog"):
commit 1eead54fe7e264d854d5daaad610b20426143b9b
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Fri Aug 16 21:56:42 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:39 2019 +0800
uitest: ignore the logging part of the QuerySaveDialog while closing the app
Change-Id: I18fcc81fa54362dfaa574ec04125e66b37a5aad8
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index b8e0b9b7269c..088fcf4a0d64 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -33,6 +33,7 @@ class ul_Compiler:
current_app=""
parent_hierarchy_count=0
last_parent=[]
+ flag_for_QuerySaveDialog=False
def __init__(self , input_address , output_address):
self.ui_dsl_mm = metamodel_from_file('ui_logger_dsl_grammar.tx')
@@ -190,21 +191,27 @@ class ul_Compiler:
def handle_Dialog(self, DialogCommand):
if (DialogCommand.__class__.__name__ == "OpenModalDialog"):
- old_line = self.variables.pop()
- if (self.prev_command.__class__.__name__ == "UNOCommand"):
- key_word=self.prev_command.uno_command_name[-6:]
- else:
- key_word=old_line[-9:-3]
+ if( DialogCommand.dialog_name != "QuerySaveDialog" ):
+ # This part is just to ignore saving the Save dialog while closing the app
- if ( key_word == "Dialog"):
- old_line= double_tab + "self.ui_test.execute_dialog_through_command(\""+\
- self.prev_command.uno_command_name+"\")\n"
- self.variables.append(old_line)
- line = double_tab + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
- self.variables.append(line)
- self.last_parent.append(DialogCommand.dialog_name)
- self.parent_hierarchy_count=self.parent_hierarchy_count+1
+ old_line = self.variables.pop()
+ if (self.prev_command.__class__.__name__ == "UNOCommand"):
+ key_word=self.prev_command.uno_command_name[-6:]
+ else:
+ key_word=old_line[-9:-3]
+
+ if ( key_word == "Dialog"):
+ old_line= double_tab + "self.ui_test.execute_dialog_through_command(\""+\
+ self.prev_command.uno_command_name+"\")\n"
+ self.variables.append(old_line)
+ line = double_tab + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
+ self.variables.append(line)
+ self.last_parent.append(DialogCommand.dialog_name)
+ self.parent_hierarchy_count=self.parent_hierarchy_count+1
+
+ else:
+ self.flag_for_QuerySaveDialog=True
elif (DialogCommand.__class__.__name__ == "OpenModelessDialog"):
old_line = self.variables.pop()
@@ -223,37 +230,46 @@ class ul_Compiler:
self.parent_hierarchy_count=self.parent_hierarchy_count+1
elif (DialogCommand.__class__.__name__ == "CloseDialog"):
- if (self.prev_command.__class__.__name__ == "ButtonUIObject"):
- old_line = self.variables.pop()
- line=""
- if(keyword.iskeyword( self.prev_command.ui_button )):
- line= double_tab + "self.ui_test.close_dialog_through_button(x"+\
- self.prev_command.ui_button+")\n"
- else:
- line= double_tab + "self.ui_test.close_dialog_through_button("+\
- self.prev_command.ui_button+")\n"
- self.variables.append(line)
- self.last_parent.pop()
- self.parent_hierarchy_count=self.parent_hierarchy_count-1
+
+ if( not ( self.flag_for_QuerySaveDialog ) ):
+ # This part is just to ignore saving the Save dialog while closing the app
+
+ if (self.prev_command.__class__.__name__ == "ButtonUIObject"):
+ old_line = self.variables.pop()
+ line=""
+ if(keyword.iskeyword( self.prev_command.ui_button )):
+ line= double_tab + "self.ui_test.close_dialog_through_button(x"+\
+ self.prev_command.ui_button+")\n"
+ else:
+ line= double_tab + "self.ui_test.close_dialog_through_button("+\
+ self.prev_command.ui_button+")\n"
+ self.variables.append(line)
+ self.last_parent.pop()
+ self.parent_hierarchy_count=self.parent_hierarchy_count-1
+ else:
+ self.flag_for_QuerySaveDialog=False
self.prev_command=DialogCommand
def handle_button(self, ButtonUIObject):
- name_of_obj=""
- if(keyword.iskeyword( ButtonUIObject.ui_button )):
- name_of_obj = "x" +ButtonUIObject.ui_button
- else:
- name_of_obj = ButtonUIObject.ui_button
+ if( ButtonUIObject.parent_id!="QuerySaveDialog" ):
+ # This part is just to ignore saving the Save dialog while closing the app
- if ButtonUIObject.parent_id == "" :
- self.init_Object( name_of_obj , ButtonUIObject.ui_button , self.last_parent[self.parent_hierarchy_count] )
- else:
- self.init_Object( name_of_obj , ButtonUIObject.ui_button,ButtonUIObject.parent_id)
+ name_of_obj=""
+ if(keyword.iskeyword( ButtonUIObject.ui_button )):
+ name_of_obj = "x" +ButtonUIObject.ui_button
+ else:
+ name_of_obj = ButtonUIObject.ui_button
- self.write_line_without_parameters(name_of_obj,"CLICK","tuple")
+ if ButtonUIObject.parent_id == "" :
+ self.init_Object( name_of_obj , ButtonUIObject.ui_button , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object( name_of_obj , ButtonUIObject.ui_button,ButtonUIObject.parent_id)
+
+ self.write_line_without_parameters(name_of_obj,"CLICK","tuple")
- self.prev_command=ButtonUIObject
+ self.prev_command=ButtonUIObject
def handle_check_box(self, CheckBoxUIObject):
commit cb84769f7c7197ddc5440a1e29cd80bc5184f06c
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Thu Aug 15 22:48:14 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:39 2019 +0800
uitest: use prefix for names that has conflict with python's keywords
Change-Id: I01d044a96eeae60a070a5ca0fc8d6105d7333414
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index 5d2a7e93ba82..b8e0b9b7269c 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -9,6 +9,7 @@
import os
import sys
import argparse
+import keyword
from textx.metamodel import metamodel_from_file
tab=" "
@@ -129,14 +130,14 @@ class ul_Compiler:
line=double_tab+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n"
self.variables.append(line)
- def init_Object(self,Id_of_Object,Obj_parent):
+ def init_Object(self,Id_of_Object,name_of_child,Obj_parent):
if Id_of_Object in self.objects:
self.objects[Id_of_Object]+=1
else:
self.objects[Id_of_Object]=1
line=double_tab+Id_of_Object+" = "+Obj_parent+\
- ".getChild(\""+Id_of_Object+"\")\n"
+ ".getChild(\""+name_of_child+"\")\n"
self.variables.append(line)
def write_line_without_parameters(self,Action_holder,Action,Action_type):
@@ -224,8 +225,13 @@ class ul_Compiler:
elif (DialogCommand.__class__.__name__ == "CloseDialog"):
if (self.prev_command.__class__.__name__ == "ButtonUIObject"):
old_line = self.variables.pop()
- line= double_tab + "self.ui_test.close_dialog_through_button("+\
- self.prev_command.ui_button+")\n"
+ line=""
+ if(keyword.iskeyword( self.prev_command.ui_button )):
+ line= double_tab + "self.ui_test.close_dialog_through_button(x"+\
+ self.prev_command.ui_button+")\n"
+ else:
+ line= double_tab + "self.ui_test.close_dialog_through_button("+\
+ self.prev_command.ui_button+")\n"
self.variables.append(line)
self.last_parent.pop()
self.parent_hierarchy_count=self.parent_hierarchy_count-1
@@ -234,109 +240,157 @@ class ul_Compiler:
def handle_button(self, ButtonUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( ButtonUIObject.ui_button )):
+ name_of_obj = "x" +ButtonUIObject.ui_button
+ else:
+ name_of_obj = ButtonUIObject.ui_button
+
if ButtonUIObject.parent_id == "" :
- self.init_Object( ButtonUIObject.ui_button , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , ButtonUIObject.ui_button , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(ButtonUIObject.ui_button,ButtonUIObject.parent_id)
+ self.init_Object( name_of_obj , ButtonUIObject.ui_button,ButtonUIObject.parent_id)
- self.write_line_without_parameters(ButtonUIObject.ui_button,"CLICK","tuple")
+ self.write_line_without_parameters(name_of_obj,"CLICK","tuple")
self.prev_command=ButtonUIObject
def handle_check_box(self, CheckBoxUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( CheckBoxUIObject.Check_box_id )):
+ name_of_obj = "x" + CheckBoxUIObject.Check_box_id
+ else:
+ name_of_obj = CheckBoxUIObject.Check_box_id
+
if CheckBoxUIObject.parent_id == "" :
- self.init_Object( CheckBoxUIObject.Check_box_id , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , CheckBoxUIObject.Check_box_id , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(CheckBoxUIObject.Check_box_id,CheckBoxUIObject.parent_id)
+ self.init_Object( name_of_obj , CheckBoxUIObject.Check_box_id,CheckBoxUIObject.parent_id)
- self.write_line_without_parameters(CheckBoxUIObject.Check_box_id,"CLICK","tuple")
+ self.write_line_without_parameters(name_of_obj,"CLICK","tuple")
self.prev_command=CheckBoxUIObject
def handle_tab(self, TabControlUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( TabControlUIObject.tab_id )):
+ name_of_obj = "x" + TabControlUIObject.tab_id
+ else:
+ name_of_obj = TabControlUIObject.tab_id
+
if TabControlUIObject.parent_id == "" :
- self.init_Object( TabControlUIObject.tab_id , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , TabControlUIObject.tab_id , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(TabControlUIObject.tab_id,TabControlUIObject.parent_id)
+ self.init_Object( name_of_obj , TabControlUIObject.tab_id,TabControlUIObject.parent_id)
- self.write_line_with_one_parameters(TabControlUIObject.tab_id,"SELECT","POS",TabControlUIObject.tab_page_number)
+ self.write_line_with_one_parameters(name_of_obj,"SELECT","POS",TabControlUIObject.tab_page_number)
self.prev_command=TabControlUIObject
def handle_Combo_box(self, ComboBoxUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( ComboBoxUIObject.Combo_box_id )):
+ name_of_obj = "x" + ComboBoxUIObject.Combo_box_id
+ else:
+ name_of_obj = ComboBoxUIObject.Combo_box_id
+
if ComboBoxUIObject.parent_id == "" :
- self.init_Object( ComboBoxUIObject.Combo_box_id , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , ComboBoxUIObject.Combo_box_id , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(ComboBoxUIObject.Combo_box_id,ComboBoxUIObject.parent_id)
+ self.init_Object( name_of_obj , ComboBoxUIObject.Combo_box_id,ComboBoxUIObject.parent_id)
- self.write_line_with_one_parameters(ComboBoxUIObject.Combo_box_id,"SELECT","POS",ComboBoxUIObject.item_num)
+ self.write_line_with_one_parameters(name_of_obj,"SELECT","POS",ComboBoxUIObject.item_num)
self.prev_command=ComboBoxUIObject
def handle_Radio_button(self,RadioButtonUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( RadioButtonUIObject.Radio_button_id )):
+ name_of_obj = "x" + RadioButtonUIObject.Radio_button_id
+ else:
+ name_of_obj = RadioButtonUIObject.Radio_button_id
+
if RadioButtonUIObject.parent_id == "" :
- self.init_Object( RadioButtonUIObject.Radio_button_id , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , RadioButtonUIObject.Radio_button_id , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(RadioButtonUIObject.Radio_button_id,RadioButtonUIObject.parent_id)
+ self.init_Object( name_of_obj , RadioButtonUIObject.Radio_button_id,RadioButtonUIObject.parent_id)
- self.write_line_without_parameters(RadioButtonUIObject.Radio_button_id,"CLICK","tuple")
+ self.write_line_without_parameters(name_of_obj,"CLICK","tuple")
self.prev_command=RadioButtonUIObject
def handle_List_box(self, ListBoxUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( ListBoxUIObject.list_id )):
+ name_of_obj = "x" + ListBoxUIObject.list_id
+ else:
+ name_of_obj = ListBoxUIObject.list_id
+
if ListBoxUIObject.parent_id == "" :
- self.init_Object( ListBoxUIObject.list_id , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , ListBoxUIObject.list_id , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(ListBoxUIObject.list_id,ListBoxUIObject.parent_id)
+ self.init_Object( name_of_obj , ListBoxUIObject.list_id,ListBoxUIObject.parent_id)
- self.write_line_with_one_parameters(ListBoxUIObject.list_id,"SELECT","POS",ListBoxUIObject.POS)
+ self.write_line_with_one_parameters(name_of_obj,"SELECT","POS",ListBoxUIObject.POS)
self.prev_command=ListBoxUIObject
def handle_spin_field(self,SpinFieldUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( SpinFieldUIObject.Spin_id )):
+ name_of_obj = "x" + SpinFieldUIObject.Spin_id
+ else:
+ name_of_obj = SpinFieldUIObject.Spin_id
+
if SpinFieldUIObject.parent_id == "" :
- self.init_Object( SpinFieldUIObject.Spin_id , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , SpinFieldUIObject.Spin_id , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(SpinFieldUIObject.Spin_id,SpinFieldUIObject.parent_id)
+ self.init_Object( name_of_obj , SpinFieldUIObject.Spin_id,SpinFieldUIObject.parent_id)
if(SpinFieldUIObject.change=="Increase"):
- self.write_line_without_parameters(SpinFieldUIObject.Spin_id,"UP","tuple")
+ self.write_line_without_parameters(name_of_obj,"UP","tuple")
elif(SpinFieldUIObject.change=="Decrease"):
- self.write_line_without_parameters(SpinFieldUIObject.Spin_id,"DOWN","tuple")
+ self.write_line_without_parameters(name_of_obj,"DOWN","tuple")
self.prev_command=SpinFieldUIObject
def handle_Edit_uiObject(self,EditUIObject):
+ name_of_obj=""
+ if(keyword.iskeyword( EditUIObject.action.edit_button )):
+ name_of_obj = "x" + EditUIObject.action.edit_button
+ else:
+ name_of_obj =EditUIObject.action.edit_button
+
if EditUIObject.parent_id == "" :
- self.init_Object( EditUIObject.action.edit_button , self.last_parent[self.parent_hierarchy_count] )
+ self.init_Object( name_of_obj , EditUIObject.action.edit_button , self.last_parent[self.parent_hierarchy_count] )
else:
- self.init_Object(EditUIObject.action.edit_button,EditUIObject.parent_id)
+ self.init_Object( name_of_obj , EditUIObject.action.edit_button,EditUIObject.parent_id)
if(EditUIObject.action.__class__.__name__ =="Type_action"):
if(EditUIObject.action.what_to_type.__class__.__name__=="char"):
- self.write_line_with_one_parameters(EditUIObject.action.edit_button,\
+ self.write_line_with_one_parameters(name_of_obj,\
"TYPE","TEXT",EditUIObject.action.what_to_type.input_char)
elif(EditUIObject.action.what_to_type.__class__.__name__=="KeyCode"):
- self.write_line_with_one_parameters(EditUIObject.action.edit_button,\
+ self.write_line_with_one_parameters(name_of_obj,\
"TYPE","KEYCODE",EditUIObject.action.what_to_type.input_key_code)
if(EditUIObject.action.__class__.__name__ =="SELECT"):
- self.write_line_with_two_parameters(EditUIObject.action.edit_button,\
+ self.write_line_with_two_parameters(name_of_obj,\
"SELECT","FROM",EditUIObject.action.from_pos,"TO",\
EditUIObject.action.to_pos)
if(EditUIObject.action.__class__.__name__ =="Clear"):
- self.write_line_without_parameters(SpinFieldUIObject.Spin_id,"CLEAR","tuple")
+ self.write_line_without_parameters(name_of_obj,"CLEAR","tuple")
self.prev_command=EditUIObject
commit 58cba15e9dabb895980cdddb8ad2c1e22080d343
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Thu Aug 15 12:24:09 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:39 2019 +0800
uitest: replace tabs with spaces
Change-Id: I40779dfdb65037838e1a1b7bed5d89a656047ce6
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index a695ec009d22..5d2a7e93ba82 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -11,6 +11,9 @@ import sys
import argparse
from textx.metamodel import metamodel_from_file
+tab=" "
+double_tab=" "
+
def parse_args():
"""
This function parses the command-line arguments
@@ -59,7 +62,7 @@ class ul_Compiler:
"from libreoffice.uno.propertyvalue import mkPropertyValues\n" + \
"import importlib\n\n" + \
"class TestClass(UITestCase):\n" + \
- "\tdef test_function(self):\n"
+ tab+"def test_function(self):\n"
self.variables.append(line)
@@ -123,7 +126,7 @@ class ul_Compiler:
self.objects[self.current_app]+=1
else:
self.objects[self.current_app]=1
- line="\t\t"+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n"
+ line=double_tab+self.current_app+" = MainWindow.getChild(\""+self.current_app+"\")\n"
self.variables.append(line)
def init_Object(self,Id_of_Object,Obj_parent):
@@ -132,16 +135,16 @@ class ul_Compiler:
self.objects[Id_of_Object]+=1
else:
self.objects[Id_of_Object]=1
- line="\t\t"+Id_of_Object+" = "+Obj_parent+\
+ line=double_tab+Id_of_Object+" = "+Obj_parent+\
".getChild(\""+Id_of_Object+"\")\n"
self.variables.append(line)
def write_line_without_parameters(self,Action_holder,Action,Action_type):
- line="\t\t"+Action_holder+".executeAction(\""+Action+"\","+Action_type+"())\n"
+ line=double_tab+Action_holder+".executeAction(\""+Action+"\","+Action_type+"())\n"
self.variables.append(line)
def write_line_with_one_parameters(self,Action_holder,Action,Paramerter_name,parameter_value):
- line="\t\t"+Action_holder+".executeAction(\""+Action+"\", mkPropertyValues({\""+\
+ line=double_tab+Action_holder+".executeAction(\""+Action+"\", mkPropertyValues({\""+\
Paramerter_name+"\": \""+\
str(parameter_value)+"\"}))\n"
self.variables.append(line)
@@ -149,7 +152,7 @@ class ul_Compiler:
def write_line_with_two_parameters(self,Action_holder,Action,Paramerter_name_1,parameter_value_1,
Paramerter_name_2,parameter_value_2):
- line="\t\t"+Action_holder+\
+ line=double_tab+Action_holder+\
".executeAction(\""+Action+"\", mkPropertyValues({\""+Paramerter_name_1+"\": \""+\
str(parameter_value_1)+"\", \""+Paramerter_name_2+"\": \""+\
str(parameter_value_2)+"\"}))\n"
@@ -157,7 +160,7 @@ class ul_Compiler:
def handle_uno(self, UNOCommand):
if(UNOCommand.prameters==None):
- line = "\t\tself.xUITest.executeCommand(\"" + \
+ line = double_tab +"self.xUITest.executeCommand(\"" + \
UNOCommand.uno_command_name +"\")\n"
else:
paramaters=""
@@ -165,18 +168,18 @@ class ul_Compiler:
paramaters = paramaters + "\"" + p.key + "\" : " + str(p.value) + " ,"
paramaters = paramaters[:-1]
- line = "\t\tself.xUITest.executeCommandWithParameters(\"" + \
+ line = double_tab + "self.xUITest.executeCommandWithParameters(\"" + \
UNOCommand.uno_command_name +"\", mkPropertyValues({"+ paramaters +"}) )\n"
self.variables.append(line)
self.prev_command=UNOCommand
def handle_start(self, StarterCommand):
- line="\t\tMainDoc = self.ui_test.create_doc_in_start_center(\""+\
+ line= double_tab + "MainDoc = self.ui_test.create_doc_in_start_center(\""+\
StarterCommand.program_name+"\")\n"
self.variables.append(line)
- line="\t\tMainWindow = self.xUITest.getTopFocusWindow()\n"
+ line= double_tab + "MainWindow = self.xUITest.getTopFocusWindow()\n"
self.variables.append(line)
app={"writer":"writer_edit","calc":"grid_window","impress":"impress_win"\
,"math":"math_edit","draw":"draw_win"}
@@ -194,10 +197,10 @@ class ul_Compiler:
key_word=old_line[-9:-3]
if ( key_word == "Dialog"):
- old_line="\t\tself.ui_test.execute_dialog_through_command(\""+\
+ old_line= double_tab + "self.ui_test.execute_dialog_through_command(\""+\
self.prev_command.uno_command_name+"\")\n"
self.variables.append(old_line)
- line = "\t\t" + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
+ line = double_tab + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
self.variables.append(line)
self.last_parent.append(DialogCommand.dialog_name)
self.parent_hierarchy_count=self.parent_hierarchy_count+1
@@ -210,10 +213,10 @@ class ul_Compiler:
key_word=old_line[-9:-3]
if ( key_word == "Dialog"):
- old_line="\t\tself.ui_test.execute_modeless_dialog_through_command(\""+\
+ old_line= double_tab + "self.ui_test.execute_modeless_dialog_through_command(\""+\
self.prev_command.uno_command_name+"\")\n"
self.variables.append(old_line)
- line = "\t\t" + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
+ line = double_tab + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
self.variables.append(line)
self.last_parent.append(DialogCommand.dialog_name)
self.parent_hierarchy_count=self.parent_hierarchy_count+1
@@ -221,7 +224,7 @@ class ul_Compiler:
elif (DialogCommand.__class__.__name__ == "CloseDialog"):
if (self.prev_command.__class__.__name__ == "ButtonUIObject"):
old_line = self.variables.pop()
- line="\t\tself.ui_test.close_dialog_through_button("+\
+ line= double_tab + "self.ui_test.close_dialog_through_button("+\
self.prev_command.ui_button+")\n"
self.variables.append(line)
self.last_parent.pop()
@@ -403,7 +406,7 @@ class ul_Compiler:
self.init_app()
- line="\t\t"+self.current_app+".executeAction(\"LAUNCH\", mkPropertyValues"+\
+ line= double_tab +self.current_app+".executeAction(\"LAUNCH\", mkPropertyValues"+\
"({\"AUTOFILTER\": \"\", \"COL\": \""+\
str(calc_AutoFill_filter.col_num)+"\""+\
", \"ROW\": \""+str(calc_AutoFill_filter.row_num)\
@@ -448,7 +451,7 @@ class ul_Compiler:
def handle_math_element_selector (self,math_element_selector):
- line="\t\t"+str(math_element_selector.element_no)+" = element_selector.getChild(\""+\
+ line= double_tab +str(math_element_selector.element_no)+" = element_selector.getChild(\""+\
str(math_element_selector.element_no)+"\")\n"
self.variables.append(line)
@@ -465,7 +468,7 @@ class ul_Compiler:
self.prev_command=setZoom_command
def Generate_UI_test(self):
- line="\t\tself.ui_test.close_doc()"
+ line= double_tab + "self.ui_test.close_doc()"
self.variables.append(line)
line="\n\n# vim: set shiftwidth=4 softtabstop=4 expandtab:"
commit d999a30410abc4af80276c48e39e6a731d1dea30
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Tue Aug 13 12:23:06 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:39 2019 +0800
uitest: add footer line support
Change-Id: I740995d811be030f406f9d3ff53c56d28af2b786
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index a1d1da8b60a2..a695ec009d22 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -468,6 +468,9 @@ class ul_Compiler:
line="\t\tself.ui_test.close_doc()"
self.variables.append(line)
+ line="\n\n# vim: set shiftwidth=4 softtabstop=4 expandtab:"
+ self.variables.append(line)
+
for line in self.variables:
self.output_stream.write(str(line))
commit e72ae01b906455524a1d4a615ab1a0efb94a6f11
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Fri Aug 9 23:23:11 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:39 2019 +0800
uitest: solve problem with un-named parents
1) Add recursively query for the parent until find an parent with a name.
2) Remove the parent part "from xxxxxx" from the log statment if there is un-named parent
3) Update the compiler to use the most top parent if there is command with no un-named parent
Change-Id: Id7dd5092bc995312494b5536720141908e73af9a
diff --git a/uitest/ui_logger_dsl/UI_Object_commands.tx b/uitest/ui_logger_dsl/UI_Object_commands.tx
index fbdab9c4e6ca..9b25e09c6efc 100644
--- a/uitest/ui_logger_dsl/UI_Object_commands.tx
+++ b/uitest/ui_logger_dsl/UI_Object_commands.tx
@@ -19,31 +19,29 @@ UIObjectCommand:
;
ButtonUIObject:
- 'Click on' ui_button=STRING 'from' parent_id=ID
+ 'Click on' ui_button=STRING ('from' parent_id=ID)?
;
CheckBoxUIObject:
- 'Toggle' Check_box_id=STRING 'CheckBox' 'from' parent_id=ID
+ 'Toggle' Check_box_id=STRING 'CheckBox' ('from' parent_id=ID)?
;
RadioButtonUIObject:
- 'Select' Radio_button_id=STRING 'RadioButton' 'from' parent_id=ID
+ 'Select' Radio_button_id=STRING 'RadioButton' ('from' parent_id=ID)?
;
ComboBoxUIObject:
- 'Select in' Combo_box_id=STRING 'ComboBox' 'item number' item_num=INT 'from' parent_id=ID
+ 'Select in' Combo_box_id=STRING 'ComboBox' 'item number' item_num=INT ('from' parent_id=ID)?
;
TabControlUIObject:
- 'Choose Tab number' tab_page_number=INT 'in' tab_id=STRING 'from' parent_id=ID
+ 'Choose Tab number' tab_page_number=INT 'in' tab_id=STRING ('from' parent_id=ID)?
;
-
EditUIObject:
- action=action_on_UIObject 'from' parent_id=ID
+ action=action_on_UIObject ('from' parent_id=ID)?
;
SpinFieldUIObject:
- change=increase_or_ecrease Spin_id=STRING 'from' parent_id=ID
+ change=increase_or_ecrease Spin_id=STRING ('from' parent_id=ID)?
;
ListBoxUIObject:
- 'Select element with position ' POS=INT 'in' list_id=STRING 'from' parent_id=ID
+ 'Select element with position ' POS=INT 'in' list_id=STRING ('from' parent_id=ID)?
;
-
//=============================================================
//hellper grammer for EditUIObject
action_on_UIObject:
diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py
index 827f2ca45b20..a1d1da8b60a2 100644
--- a/uitest/ui_logger_dsl/dsl_core.py
+++ b/uitest/ui_logger_dsl/dsl_core.py
@@ -27,6 +27,9 @@ class ul_Compiler:
variables=[]
objects = dict()
current_app=""
+ parent_hierarchy_count=0
+ last_parent=[]
+
def __init__(self , input_address , output_address):
self.ui_dsl_mm = metamodel_from_file('ui_logger_dsl_grammar.tx')
self.output_stream=self.initiate_test_generation(output_address)
@@ -44,6 +47,7 @@ class ul_Compiler:
return content
def initiate_test_generation(self,output_address):
+ self.last_parent.append("MainWindow")
try:
f = open(output_address,"w")
except IOError as err:
@@ -195,6 +199,8 @@ class ul_Compiler:
self.variables.append(old_line)
line = "\t\t" + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
self.variables.append(line)
+ self.last_parent.append(DialogCommand.dialog_name)
+ self.parent_hierarchy_count=self.parent_hierarchy_count+1
elif (DialogCommand.__class__.__name__ == "OpenModelessDialog"):
old_line = self.variables.pop()
@@ -209,6 +215,8 @@ class ul_Compiler:
self.variables.append(old_line)
line = "\t\t" + DialogCommand.dialog_name + " = self.xUITest.getTopFocusWindow()\n"
self.variables.append(line)
+ self.last_parent.append(DialogCommand.dialog_name)
+ self.parent_hierarchy_count=self.parent_hierarchy_count+1
elif (DialogCommand.__class__.__name__ == "CloseDialog"):
if (self.prev_command.__class__.__name__ == "ButtonUIObject"):
@@ -216,12 +224,17 @@ class ul_Compiler:
line="\t\tself.ui_test.close_dialog_through_button("+\
self.prev_command.ui_button+")\n"
self.variables.append(line)
+ self.last_parent.pop()
+ self.parent_hierarchy_count=self.parent_hierarchy_count-1
self.prev_command=DialogCommand
def handle_button(self, ButtonUIObject):
- self.init_Object(ButtonUIObject.ui_button,ButtonUIObject.parent_id)
+ if ButtonUIObject.parent_id == "" :
+ self.init_Object( ButtonUIObject.ui_button , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(ButtonUIObject.ui_button,ButtonUIObject.parent_id)
self.write_line_without_parameters(ButtonUIObject.ui_button,"CLICK","tuple")
@@ -229,7 +242,10 @@ class ul_Compiler:
def handle_check_box(self, CheckBoxUIObject):
- self.init_Object(CheckBoxUIObject.Check_box_id,CheckBoxUIObject.parent_id)
+ if CheckBoxUIObject.parent_id == "" :
+ self.init_Object( CheckBoxUIObject.Check_box_id , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(CheckBoxUIObject.Check_box_id,CheckBoxUIObject.parent_id)
self.write_line_without_parameters(CheckBoxUIObject.Check_box_id,"CLICK","tuple")
@@ -237,7 +253,10 @@ class ul_Compiler:
def handle_tab(self, TabControlUIObject):
- self.init_Object(TabControlUIObject.tab_id,TabControlUIObject.parent_id)
+ if TabControlUIObject.parent_id == "" :
+ self.init_Object( TabControlUIObject.tab_id , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(TabControlUIObject.tab_id,TabControlUIObject.parent_id)
self.write_line_with_one_parameters(TabControlUIObject.tab_id,"SELECT","POS",TabControlUIObject.tab_page_number)
@@ -245,7 +264,10 @@ class ul_Compiler:
def handle_Combo_box(self, ComboBoxUIObject):
- self.init_Object(ComboBoxUIObject.Combo_box_id,ComboBoxUIObject.parent_id)
+ if ComboBoxUIObject.parent_id == "" :
+ self.init_Object( ComboBoxUIObject.Combo_box_id , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(ComboBoxUIObject.Combo_box_id,ComboBoxUIObject.parent_id)
self.write_line_with_one_parameters(ComboBoxUIObject.Combo_box_id,"SELECT","POS",ComboBoxUIObject.item_num)
@@ -253,7 +275,10 @@ class ul_Compiler:
def handle_Radio_button(self,RadioButtonUIObject):
- self.init_Object(RadioButtonUIObject.Radio_button_id,RadioButtonUIObject.parent_id)
+ if RadioButtonUIObject.parent_id == "" :
+ self.init_Object( RadioButtonUIObject.Radio_button_id , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(RadioButtonUIObject.Radio_button_id,RadioButtonUIObject.parent_id)
self.write_line_without_parameters(RadioButtonUIObject.Radio_button_id,"CLICK","tuple")
@@ -261,7 +286,10 @@ class ul_Compiler:
def handle_List_box(self, ListBoxUIObject):
- self.init_Object(ListBoxUIObject.list_id,ListBoxUIObject.parent_id)
+ if ListBoxUIObject.parent_id == "" :
+ self.init_Object( ListBoxUIObject.list_id , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(ListBoxUIObject.list_id,ListBoxUIObject.parent_id)
self.write_line_with_one_parameters(ListBoxUIObject.list_id,"SELECT","POS",ListBoxUIObject.POS)
@@ -269,7 +297,10 @@ class ul_Compiler:
def handle_spin_field(self,SpinFieldUIObject):
- self.init_Object(SpinFieldUIObject.Spin_id,SpinFieldUIObject.parent_id)
+ if SpinFieldUIObject.parent_id == "" :
+ self.init_Object( SpinFieldUIObject.Spin_id , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(SpinFieldUIObject.Spin_id,SpinFieldUIObject.parent_id)
if(SpinFieldUIObject.change=="Increase"):
self.write_line_without_parameters(SpinFieldUIObject.Spin_id,"UP","tuple")
@@ -279,7 +310,10 @@ class ul_Compiler:
def handle_Edit_uiObject(self,EditUIObject):
- self.init_Object(EditUIObject.action.edit_button,EditUIObject.parent_id)
+ if EditUIObject.parent_id == "" :
+ self.init_Object( EditUIObject.action.edit_button , self.last_parent[self.parent_hierarchy_count] )
+ else:
+ self.init_Object(EditUIObject.action.edit_button,EditUIObject.parent_id)
if(EditUIObject.action.__class__.__name__ =="Type_action"):
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 36a6c7340add..0ecd673f9879 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -20,6 +20,49 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <memory>
+namespace{
+
+bool isDialogWindow(vcl::Window const * pWindow)
+{
+ WindowType nType = pWindow->GetType();
+ // DIALOG to MODALDIALOG
+ if (nType >= WindowType::DIALOG && nType <= WindowType::MODALDIALOG)
+ return true;
+
+ // MESSBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX
+ if (nType >= WindowType::MESSBOX && nType <= WindowType::QUERYBOX)
+ return true;
+
+ if (nType == WindowType::TABDIALOG)
+ return true;
+
+ return false;
+}
+
+bool isTopWindow(vcl::Window const * pWindow)
+{
+ WindowType eType = pWindow->GetType();
+ if (eType == WindowType::FLOATINGWINDOW)
+ {
+ return pWindow->GetStyle() & WB_SYSTEMFLOATWIN;
+ }
+ return false;
+}
+
+vcl::Window* get_top_parent(vcl::Window* pWindow)
+{
+ if (isDialogWindow(pWindow) || isTopWindow(pWindow))
+ return pWindow;
+
+ vcl::Window* pParent = pWindow->GetParent();
+ if (!pParent)
+ return pWindow;
+
+ return get_top_parent(pParent);
+}
+
+
+}
UITestLogger::UITestLogger():
maStream(),
mbValid(false)
@@ -216,7 +259,17 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
OUString aContent;
if(pUIObject->get_type()=="EditUIObject"){
- aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ if(aParentID=="")
+ {
+ VclPtr <vcl::Window> pParent_top = get_top_parent(xUIElement);
+ aParentID= pParent_top->get_id();
+ }
+ if(aParentID==""){
+ aContent = aContent+"Type on '" + rID + "' " + aKeyCode;
+ }
+ else{
+ aContent = aContent+"Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ }
}
else if(pUIObject->get_type()=="SwEditWinUIObject" && rID=="writer_edit"){
aContent = "Type on writer " + aKeyCode ;
@@ -234,7 +287,17 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
aContent = "Type on draw " + aKeyCode ;
}
else{
- aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ if(aParentID=="")
+ {
+ VclPtr <vcl::Window> pParent_top = get_top_parent(xUIElement);
+ aParentID= pParent_top->get_id();
+ }
+ if(aParentID==""){
+ aContent = "Type on '" + rID + "' " + aKeyCode ;
+ }
+ else{
+ aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ }
}
maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
}
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 1919da040f1f..d26072cd05a9 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -622,6 +622,10 @@ OUString ButtonUIObject::get_action(VclEventId nEvent) const
return "Start database" ;
}
else{
+ if (get_top_parent(mxButton)->get_id()==""){
+ //This part because if we don't have parent
+ return "Click on '" + mxButton->get_id() ;
+ }
return "Click on '" + mxButton->get_id() + "' from "+
get_top_parent(mxButton)->get_id();
}
@@ -747,6 +751,14 @@ OUString EditUIObject::get_action(VclEventId nEvent) const
const Selection& rSelection = mxEdit->GetSelection();
long nMin = rSelection.Min();
long nMax = rSelection.Max();
+ if(get_top_parent(mxEdit)->get_id()==""){
+ //This part because if we don't have parent
+ return "Select in '" +
+ mxEdit->get_id() +
+ "' {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
+ OUString::number(nMax) + "\"}"
+ ;
+ }
return "Select in '" +
mxEdit->get_id() +
"' {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
@@ -868,6 +880,10 @@ OUString CheckBoxUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::CheckboxToggle)
{
+ if(get_top_parent(mxCheckBox)->get_id()==""){
+ //This part because if we don't have parent
+ return "Toggle '" + mxCheckBox->get_id() + "' CheckBox";
+ }
return "Toggle '" + mxCheckBox->get_id() + "' CheckBox from " +
get_top_parent(mxCheckBox)->get_id();
}
@@ -918,6 +934,10 @@ OUString RadioButtonUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::RadiobuttonToggle)
{
+ if(get_top_parent(mxRadioButton)->get_id()==""){
+ //This part because if we don't have parent
+ return "Select '" + mxRadioButton->get_id() + "' RadioButton";
+ }
return "Select '" + mxRadioButton->get_id() + "' RadioButton from " +
get_top_parent(mxRadioButton)->get_id();
}
@@ -1024,11 +1044,21 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ListboxSelect)
{
sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
+ if(get_top_parent(mxListBox)->get_id()==""){
+ //This part because if we don't have parent
+ return "Select element with position " + OUString::number(nPos) +
+ " in '" + mxListBox->get_id();
+ }
return "Select element with position " + OUString::number(nPos) +
" in '" + mxListBox->get_id() +"' from" + get_top_parent(mxListBox)->get_id() ;
}
else if (nEvent == VclEventId::ListboxFocus)
{
+ if(get_top_parent(mxListBox)->get_id()=="")
+ {
+ //This part because if we don't have parent
+ return this->get_type() + " Action:FOCUS Id:" + mxListBox->get_id();
+ }
return this->get_type() + " Action:FOCUS Id:" + mxListBox->get_id() +
" Parent:" + get_top_parent(mxListBox)->get_id();
}
@@ -1099,6 +1129,11 @@ OUString ComboBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ComboboxSelect)
{
sal_Int32 nPos = mxComboBox->GetSelectedEntryPos();
+ if (get_top_parent(mxComboBox)->get_id()==""){
+ //This part because if we don't have parent
+ return "Select in '" + mxComboBox->get_id() +
+ "' ComboBox item number " + OUString::number(nPos);
+ }
return "Select in '" + mxComboBox->get_id() +
"' ComboBox item number " + OUString::number(nPos) +
" from " + get_top_parent(mxComboBox)->get_id();
@@ -1214,11 +1249,21 @@ OUString SpinFieldUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::SpinfieldUp)
{
+ if(get_top_parent(mxSpinField)->get_id()=="")
+ {
+ //This part because if we don't have parent
+ return "Increase '" + mxSpinField->get_id();
+ }
return "Increase '" + mxSpinField->get_id() +
"' from " + get_top_parent(mxSpinField)->get_id();
}
else if (nEvent == VclEventId::SpinfieldDown)
{
+ if(get_top_parent(mxSpinField)->get_id()=="")
+ {
+ //This part because if we don't have parent
+ return "Decrease '" + mxSpinField->get_id();
+ }
return "Decrease '" + mxSpinField->get_id() +
"' from " + get_top_parent(mxSpinField)->get_id();
}
@@ -1282,6 +1327,12 @@ OUString TabControlUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::TabpageActivate)
{
sal_Int32 nPageId = mxTabControl->GetCurPageId();
+
+ if(get_top_parent(mxTabControl)->get_id()==""){
+ //This part because if we don't have parent
+ return "Choose Tab number " + OUString::number(mxTabControl->GetPagePos(nPageId)) +
+ " in '" + mxTabControl->get_id();
+ }
return "Choose Tab number " + OUString::number(mxTabControl->GetPagePos(nPageId)) +
" in '" + mxTabControl->get_id()+
"' from " + get_top_parent(mxTabControl)->get_id() ;
commit 99bedce928c33e8cb607f1d3f3c09feebaeb3c6b
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Sun Aug 4 13:42:09 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:39 2019 +0800
uitest: log more events in Calc:
1) Rename Tab
2) Insert Tab
Change-Id: I7a653a4b274c0c8058672c5b0aa1645bb5a51e3a
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3a65ae04aad7..fd996eb3d4cb 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -94,6 +94,9 @@
#include <comphelper/lok.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <vcl/uitest/logger.hxx>
+#include <vcl/uitest/eventdescription.hxx>
+
#include <mtvelements.hxx>
using ::editeng::SvxBorderLine;
@@ -106,6 +109,21 @@ using ::std::set;
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);
+}
+}
+
+namespace {
+
std::pair<SCTAB,SCTAB> getMarkedTableRange(const std::vector<ScTableUniquePtr>& rTables, const ScMarkData& rMark)
{
SCTAB nTabStart = MAXTAB;
@@ -895,6 +913,7 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool bExternalDoc
}
}
}
+ collectUIInformation({{"NewName",rName}},"Rename_Sheet");
return bValid;
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index a87dc2dd3ed8..56865508373a 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -60,6 +60,9 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <vcl/uitest/logger.hxx>
+#include <vcl/uitest/eventdescription.hxx>
+
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/NamedPropertyValues.hpp>
@@ -86,6 +89,21 @@ void lcl_LOKRemoveWindow(ScTabViewShell* pTabViewShell, ScSplitPos eWhich)
} // anonymous namespace
+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);
+}
+}
+
const ScPositionHelper::index_type ScPositionHelper::null; // definition
bool ScPositionHelper::Comp::operator() (const value_type& rValue1, const value_type& rValue2) const
@@ -839,6 +857,7 @@ void ScViewData::InsertTab( SCTAB nTab )
UpdateCurrentTab();
mpMarkData->InsertTab( nTab );
+ collectUIInformation({{}},"InsertTab");
}
void ScViewData::InsertTabs( SCTAB nTab, SCTAB nNewSheets )
diff --git a/uitest/ui_logger_dsl/Special_commands.tx b/uitest/ui_logger_dsl/Special_commands.tx
index 335b6d24e7d3..a4bf1a697504 100644
--- a/uitest/ui_logger_dsl/Special_commands.tx
+++ b/uitest/ui_logger_dsl/Special_commands.tx
@@ -74,7 +74,8 @@ writer_Insert_BreakPage:
calc_command:
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_Copy_Cells | calc_Paste_Cells | calc_UNMerge_Cells | calc_Merge_Cells |
+ calc_Rename_Sheet | calc_Insert_sheet
;
calc_Type_command:
'Type on current cell' what_to_type=Type_options
@@ -118,6 +119,12 @@ calc_Merge_Cells:
calc_UNMerge_Cells:
'Delete the merge between' '{' '"CELL":' input_range=STRING '}'
;
+calc_Rename_Sheet:
+ 'Rename The Selected Tab to ' new_name=STRING
+;
+calc_Insert_sheet:
+ 'Insert New Tab '
+;
//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 1eaa33a441cd..827f2ca45b20 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,
+ 'calc_Rename_Sheet':self.do_nothing,
+ 'calc_Insert_sheet':self.do_nothing,
'impress_Insert_Slide':self.do_nothing,
'impress_Delete_Page':self.do_nothing,
'impress_Duplicate_Slide':self.do_nothing,
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 502c0a9f0244..36a6c7340add 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -369,6 +369,13 @@ void UITestLogger::logEvent(const EventDescription& rDescription)
else if(rDescription.aAction=="UNMERGE_CELL"){
aLogLine = "Delete the merged " + aParameterString;
}
+ else if(rDescription.aAction=="Rename_Sheet"){
+ aLogLine = "Rename The Selected Tab to \""+\
+ GetValueInMapWithIndex(rDescription.aParameters,0)+"\"";
+ }
+ else if(rDescription.aAction=="InsertTab"){
+ aLogLine = "Insert New Tab ";
+ }
}
else if(rDescription.aID=="impress_win_or_draw_win"){
if(rDescription.aAction=="Insert_New_Page_or_Slide"){
commit d13252673b05942194971f83f6612c45848901fd
Author: Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Sat Aug 3 11:51:11 2019 -0500
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Mon Aug 19 22:56:38 2019 +0800
uitest: 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 adcc0da4ad82..a97ccb7d0588 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";
@@ -918,6 +918,8 @@ void SlotManager::RenameSlide(const SfxRequest& rRequest)
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list