summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmed ElShreif <aelshreif7@gmail.com>2019-06-10 01:20:59 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2019-08-18 21:56:03 +0800
commit9b7c68b3fb7504cf90884eb2c5c92d3e789c461a (patch)
tree6c7623a5810271dbbd1d24e2b35739b7c405231f
parentb68f4ff85bc1d6e008facbc310ddbfb5d799b7a5 (diff)
uitest: Rewrite all the logger statements with the new grammar syntax
Finished parts from old logger: 1) UNOCommands 2) StarterCommands 3) UIObjectCommand 4) DialogCommand 5) SpecialCommand Change-Id: Ia521efef0abe1a351b9a4fcabaab6dbf20e8fc89
-rw-r--r--sfx2/source/control/unoctitm.cxx2
-rw-r--r--vcl/source/uitest/logger.cxx82
-rw-r--r--vcl/source/uitest/uiobject.cxx68
-rw-r--r--vcl/source/window/dialog.cxx6
4 files changed, 127 insertions, 31 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 6908f64aaa61..0a50a39735eb 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -601,7 +601,7 @@ void collectUIInformation(const util::URL& rURL, const css::uno::Sequence< css::
if (!pFile)
return;
- UITestLogger::getInstance().logCommand("CommandSent Name:" + rURL.Complete, rArgs);
+ UITestLogger::getInstance().logCommand("Send UNO Command (\"" + rURL.Complete + "\") ", rArgs);
}
}
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 7860364da9d9..1455c0d73d71 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -213,8 +213,21 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
OUString aParentID = pParent->get_id();
- OUString aContent = pUIObject->get_type() + " Action:TYPE Id:" +
- rID + " Parent:"+ aParentID +" " + aKeyCode;
+ OUString aContent;
+
+ if(pUIObject->get_type()=="EditUIObject"){
+ 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()=="ScGridWinUIObject" && rID=="grid_window"){
+ aContent = "Type on current cell " + aKeyCode ;
+ }
+ else{
+ aContent= pUIObject->get_type() + " Action:TYPE Id:" +
+ rID + " Parent:"+ aParentID +" " + aKeyCode;
+ }
maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
}
@@ -240,16 +253,75 @@ OUString StringMapToOUString(const std::map<OUString, OUString>& rParameters)
return aParameterString.makeStringAndClear();
}
+OUString GetValueInMapWithIndex(const std::map<OUString, OUString>& rParameters,sal_Int32 index)
+{
+ sal_Int32 j=0;
+
+ std::map<OUString, OUString>::const_iterator itr = rParameters.begin();
+
+ for ( ; itr != rParameters.end() && j<index ; ++itr,++j);
+
+ return itr->second;
+}
+
+
+OUString GetKeyInMapWithIndex(const std::map<OUString, OUString>& rParameters,sal_Int32 index)
+{
+ sal_Int32 j=0;
+
+ std::map<OUString, OUString>::const_iterator itr = rParameters.begin();
+
+ for ( ; itr != rParameters.end() && j<index ; ++itr,++j);
+
+ return itr->first;
+}
+
}
void UITestLogger::logEvent(const EventDescription& rDescription)
{
OUString aParameterString = StringMapToOUString(rDescription.aParameters);
- OUString aLogLine = rDescription.aKeyWord + " Action:" +
- rDescription.aAction + " Id:" + rDescription.aID +
- " Parent:" + rDescription.aParent + aParameterString;
+ //here we will customize our statments depending on the caller of this function
+ OUString aLogLine ;
+
+ if(rDescription.aID=="writer_edit"){
+
+ if(rDescription.aAction=="GOTO"){
+ aLogLine = "GOTO page number " + GetValueInMapWithIndex(rDescription.aParameters,0);
+ }
+ else if(rDescription.aAction=="SET"){
+ aLogLine = "Set Zoom to be " + 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 " + to ;
+ }
+ }
+ 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")
+ {
+ 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{
+ aLogLine = rDescription.aKeyWord + " Action:" +
+ rDescription.aAction + " Id:" + rDescription.aID +
+ " Parent:" + rDescription.aParent + aParameterString;
+ }
log(aLogLine);
}
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 66d5ed2d2f18..5ee0dec84639 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -589,8 +589,34 @@ OUString ButtonUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::ButtonClick)
{
- return this->get_type() + " Action:CLICK Id:" + mxButton->get_id() + " Parent:" +
- get_top_parent(mxButton)->get_id();
+ if(mxButton->get_id()=="writer_all")
+ {
+ return "Start writer" ;
+ }
+ else if(mxButton->get_id()=="calc_all")
+ {
+ return "Start calc" ;
+ }
+ else if(mxButton->get_id()=="impress_all")
+ {
+ return "Start impress" ;
+ }
+ else if(mxButton->get_id()=="draw_all")
+ {
+ return "Start draw" ;
+ }
+ else if(mxButton->get_id()=="math_all")
+ {
+ return "Start math" ;
+ }
+ else if(mxButton->get_id()=="database_all")
+ {
+ return "Start database" ;
+ }
+ else{
+ return "Click on '" + mxButton->get_id() + "' from "+
+ get_top_parent(mxButton)->get_id();
+ }
}
else
return WindowUIObject::get_action(nEvent);
@@ -713,11 +739,12 @@ OUString EditUIObject::get_action(VclEventId nEvent) const
const Selection& rSelection = mxEdit->GetSelection();
long nMin = rSelection.Min();
long nMax = rSelection.Max();
- return this->get_type() + " Action:SELECT Id:" +
+ return "Select in '" +
mxEdit->get_id() +
- " Parent:" + get_top_parent(mxEdit)->get_id() +
- " {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
- OUString::number(nMax) + "\"}";
+ "' {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
+ OUString::number(nMax) + "\"} from "
+ + get_top_parent(mxEdit)->get_id()
+ ;
}
else
return WindowUIObject::get_action(nEvent);
@@ -833,7 +860,7 @@ OUString CheckBoxUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::CheckboxToggle)
{
- return this->get_type() + " Action:CLICK Id:" + mxCheckBox->get_id() + " Parent:" +
+ return "Toggle '" + mxCheckBox->get_id() + "' CheckBox from " +
get_top_parent(mxCheckBox)->get_id();
}
else
@@ -883,7 +910,7 @@ OUString RadioButtonUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::RadiobuttonToggle)
{
- return this->get_type() + " Action:CLICK Id:" + mxRadioButton->get_id() + " Parent:" +
+ return "Select '" + mxRadioButton->get_id() + "' RadioButton from " +
get_top_parent(mxRadioButton)->get_id();
}
else
@@ -989,9 +1016,8 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ListboxSelect)
{
sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
- return this->get_type() + " Action:SELECT Id:" + mxListBox->get_id() +
- " Parent:" + get_top_parent(mxListBox)->get_id() +
- " {\"POS\": \"" + OUString::number(nPos) + "\"}";
+ return "Select element with position " + OUString::number(nPos) +
+ " in '" + mxListBox->get_id() +"' from" + get_top_parent(mxListBox)->get_id() ;
}
else if (nEvent == VclEventId::ListboxFocus)
{
@@ -1065,10 +1091,9 @@ OUString ComboBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ComboboxSelect)
{
sal_Int32 nPos = mxComboBox->GetSelectedEntryPos();
- return this->get_type() + " Action:SELECT Id:" +
- mxComboBox->get_id() +
- " Parent:" + get_top_parent(mxComboBox)->get_id() +
- " {\"POS\": \"" + OUString::number(nPos) + "\"}";
+ return "select in '" + mxComboBox->get_id() +
+ "' ComboBox item number " + OUString::number(nPos) +
+ " from " + get_top_parent(mxComboBox)->get_id();
}
else
return WindowUIObject::get_action(nEvent);
@@ -1181,13 +1206,13 @@ OUString SpinFieldUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::SpinfieldUp)
{
- return this->get_type() + " Action:UP Id:" + mxSpinField->get_id() +
- " Parent:" + get_top_parent(mxSpinField)->get_id();
+ return "Increase '" + mxSpinField->get_id() +
+ "' from " + get_top_parent(mxSpinField)->get_id();
}
else if (nEvent == VclEventId::SpinfieldDown)
{
- return this->get_type() + " Action:DOWN Id:" + mxSpinField->get_id() +
- " Parent:" + get_top_parent(mxSpinField)->get_id();
+ return "Decrease '" + mxSpinField->get_id() +
+ "' from " + get_top_parent(mxSpinField)->get_id();
}
else
return WindowUIObject::get_action(nEvent);
@@ -1249,9 +1274,8 @@ OUString TabControlUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::TabpageActivate)
{
sal_Int32 nPageId = mxTabControl->GetCurPageId();
- return this->get_type() + " Action:SELECT Id:" + mxTabControl->get_id() +
- " Parent:" + get_top_parent(mxTabControl)->get_id() +
- " {\"POS\": \"" + OUString::number(mxTabControl->GetPagePos(nPageId)) + "\"}";
+ return "Choose Tab number " + OUString::number(mxTabControl->GetPagePos(nPageId)) +
+ " from '" + mxTabControl->get_id() + "'" ;
}
else
return WindowUIObject::get_action(nEvent);
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index cc90dc3d625a..08cffb2cca62 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -640,7 +640,7 @@ void Dialog::dispose()
css::document::DocumentEvent aObject;
aObject.EventName = "DialogClosed";
xEventBroadcaster->documentEventOccured(aObject);
- UITestLogger::getInstance().log("DialogClosed");
+ UITestLogger::getInstance().log("Close Dialog");
if (comphelper::LibreOfficeKit::isActive())
{
@@ -989,9 +989,9 @@ bool Dialog::ImplStartExecute()
aObject.EventName = "DialogExecute";
xEventBroadcaster->documentEventOccured(aObject);
if (bModal)
- UITestLogger::getInstance().log("ModalDialogExecuted Id:" + get_id());
+ UITestLogger::getInstance().log("Open " + get_id());
else
- UITestLogger::getInstance().log("ModelessDialogExecuted Id:" + get_id());
+ UITestLogger::getInstance().log("Open " + get_id());
if (comphelper::LibreOfficeKit::isActive())
{