summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/uitest/logger.cxx67
-rw-r--r--vcl/source/uitest/uiobject.cxx51
2 files changed, 116 insertions, 2 deletions
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() ;