[Libreoffice-commits] core.git: sfx2/source vcl/source
Xisco Faulí (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jun 29 23:14:27 UTC 2019
sfx2/source/control/unoctitm.cxx | 2
vcl/source/uitest/logger.cxx | 82 ++-------------------------------------
vcl/source/uitest/uiobject.cxx | 68 ++++++++++----------------------
vcl/source/window/dialog.cxx | 6 +-
4 files changed, 31 insertions(+), 127 deletions(-)
New commits:
commit 32bf6bec39748e64ca84a03e7488abe755747081
Author: Xisco Faulí <xiscofauli at libreoffice.org>
AuthorDate: Sat Jun 29 23:37:18 2019 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Sun Jun 30 01:13:19 2019 +0200
Revert "Rewrite all the logger statements with the new grammar syntax"
This reverts commit 624530549f30572cb7fb137cbadecfab9a75fc8c.
Change-Id: I4bc0216cc12af637ad291f3ba6af090d1d34f107
Reviewed-on: https://gerrit.libreoffice.org/74916
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 71cccb05d4e2..aba1357b0ddc 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("Send UNO Command (\"" + rURL.Complete + "\") ", rArgs);
+ UITestLogger::getInstance().logCommand("CommandSent Name:" + rURL.Complete, rArgs);
}
}
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 742d8f4ab63a..d100d1bbf125 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -213,21 +213,8 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
OUString aParentID = pParent->get_id();
- 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;
- }
+ OUString aContent = pUIObject->get_type() + " Action:TYPE Id:" +
+ rID + " Parent:"+ aParentID +" " + aKeyCode;
maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
}
@@ -253,75 +240,16 @@ 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);
- //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"){
+ OUString aLogLine = rDescription.aKeyWord + " Action:" +
+ rDescription.aAction + " Id:" + rDescription.aID +
+ " Parent:" + rDescription.aParent + aParameterString;
- 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 583c4ac38659..b8932913cf53 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -584,34 +584,8 @@ OUString ButtonUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::ButtonClick)
{
- 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();
- }
+ return this->get_type() + " Action:CLICK Id:" + mxButton->get_id() + " Parent:" +
+ get_top_parent(mxButton)->get_id();
}
else
return WindowUIObject::get_action(nEvent);
@@ -734,12 +708,11 @@ OUString EditUIObject::get_action(VclEventId nEvent) const
const Selection& rSelection = mxEdit->GetSelection();
long nMin = rSelection.Min();
long nMax = rSelection.Max();
- return "Select in '" +
+ return this->get_type() + " Action:SELECT Id:" +
mxEdit->get_id() +
- "' {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
- OUString::number(nMax) + "\"} from "
- + get_top_parent(mxEdit)->get_id()
- ;
+ " Parent:" + get_top_parent(mxEdit)->get_id() +
+ " {\"FROM\": \"" + OUString::number(nMin) + "\", \"TO\": \"" +
+ OUString::number(nMax) + "\"}";
}
else
return WindowUIObject::get_action(nEvent);
@@ -855,7 +828,7 @@ OUString CheckBoxUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::CheckboxToggle)
{
- return "Toggle '" + mxCheckBox->get_id() + "' CheckBox from " +
+ return this->get_type() + " Action:CLICK Id:" + mxCheckBox->get_id() + " Parent:" +
get_top_parent(mxCheckBox)->get_id();
}
else
@@ -905,7 +878,7 @@ OUString RadioButtonUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::RadiobuttonToggle)
{
- return "Select '" + mxRadioButton->get_id() + "' RadioButton from " +
+ return this->get_type() + " Action:CLICK Id:" + mxRadioButton->get_id() + " Parent:" +
get_top_parent(mxRadioButton)->get_id();
}
else
@@ -1011,8 +984,9 @@ OUString ListBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ListboxSelect)
{
sal_Int32 nPos = mxListBox->GetSelectedEntryPos();
- return "Select element with position " + OUString::number(nPos) +
- " in '" + mxListBox->get_id() +"' from" + get_top_parent(mxListBox)->get_id() ;
+ return this->get_type() + " Action:SELECT Id:" + mxListBox->get_id() +
+ " Parent:" + get_top_parent(mxListBox)->get_id() +
+ " {\"POS\": \"" + OUString::number(nPos) + "\"}";
}
else if (nEvent == VclEventId::ListboxFocus)
{
@@ -1086,9 +1060,10 @@ OUString ComboBoxUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::ComboboxSelect)
{
sal_Int32 nPos = mxComboBox->GetSelectedEntryPos();
- return "select in '" + mxComboBox->get_id() +
- "' ComboBox item number " + OUString::number(nPos) +
- " from " + get_top_parent(mxComboBox)->get_id();
+ return this->get_type() + " Action:SELECT Id:" +
+ mxComboBox->get_id() +
+ " Parent:" + get_top_parent(mxComboBox)->get_id() +
+ " {\"POS\": \"" + OUString::number(nPos) + "\"}";
}
else
return WindowUIObject::get_action(nEvent);
@@ -1201,13 +1176,13 @@ OUString SpinFieldUIObject::get_action(VclEventId nEvent) const
{
if (nEvent == VclEventId::SpinfieldUp)
{
- return "Increase '" + mxSpinField->get_id() +
- "' from " + get_top_parent(mxSpinField)->get_id();
+ return this->get_type() + " Action:UP Id:" + mxSpinField->get_id() +
+ " Parent:" + get_top_parent(mxSpinField)->get_id();
}
else if (nEvent == VclEventId::SpinfieldDown)
{
- return "Decrease '" + mxSpinField->get_id() +
- "' from " + get_top_parent(mxSpinField)->get_id();
+ return this->get_type() + " Action:DOWN Id:" + mxSpinField->get_id() +
+ " Parent:" + get_top_parent(mxSpinField)->get_id();
}
else
return WindowUIObject::get_action(nEvent);
@@ -1269,8 +1244,9 @@ OUString TabControlUIObject::get_action(VclEventId nEvent) const
if (nEvent == VclEventId::TabpageActivate)
{
sal_Int32 nPageId = mxTabControl->GetCurPageId();
- return "Choose Tab number " + OUString::number(mxTabControl->GetPagePos(nPageId)) +
- " from '" + mxTabControl->get_id() + "'" ;
+ return this->get_type() + " Action:SELECT Id:" + mxTabControl->get_id() +
+ " Parent:" + get_top_parent(mxTabControl)->get_id() +
+ " {\"POS\": \"" + OUString::number(mxTabControl->GetPagePos(nPageId)) + "\"}";
}
else
return WindowUIObject::get_action(nEvent);
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index dd5a7f05c779..9d60b796b035 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("Close Dialog");
+ UITestLogger::getInstance().log("DialogClosed");
if (comphelper::LibreOfficeKit::isActive())
{
@@ -988,9 +988,9 @@ bool Dialog::ImplStartExecute()
aObject.EventName = "DialogExecute";
xEventBroadcaster->documentEventOccured(aObject);
if (bModal)
- UITestLogger::getInstance().log("Open " + get_id());
+ UITestLogger::getInstance().log("ModalDialogExecuted Id:" + get_id());
else
- UITestLogger::getInstance().log("Open " + get_id());
+ UITestLogger::getInstance().log("ModelessDialogExecuted Id:" + get_id());
return true;
}
More information about the Libreoffice-commits
mailing list