Gui testing with dogtail
-
Hi,
I am currently experimenting ways to do some automated gui testing under Ubuntu 12.04 (Qt 4.8.1). One of the first problems I discovered was, that I am not able to read the text of e.g. a QPlainTextEdit control -> the 'Text' value in dogtails sniff is always empty regardless of what I type in the control.
So I went and implemented a custom accessible object
@
class MyAccessiblePlainTextEdit : public QAccessibleWidget
{
public:
MyAccessiblePlainTextEdit(QWidget *w);virtual QString text(Text t, int child); virtual int childCount() const; virtual Role role(int child) const;
private:
QPlainTextEdit* textEdit() const;
};QString MyAccessiblePlainTextEdit::text(Text t, int child) const
{
if (!child)
{
if (t == QAccessible::Value)
{
return this->textEdit()->toPlainText();
}
if (t == QAccessible::Name)
{
return this->textEdit()->accessibleName();
}
}return QString();
}
...
@and installed a suitable factory via QAccessible::installFactory in the main funtion of my test program.
However, the text method is only called with t := QAccessible::Name, t := QAccessible::Description etc. but never with t := QAccessible::Value. So while I am able to change e.g. the name or the description, I still dont get the text :-(.Am I missing something? Any help would be greatly appreciated. Thanks in advance.