summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-19 10:00:19 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-07-23 16:51:13 +0200
commit5ef0ad07c11100aecafa1d5b660cd86da5ad912f (patch)
tree2776bf148adac838e8263d91e66063391e1def25 /src/testlib
parent69bec7866bcf09f672c99a330ace4ab9aa426266 (diff)
Fix accessibility test code to copy events also based on interfaces
The previous code assumed that all events would have an object sent along with them. QtWebEngine breaks this assumption and the rest of the code is ready for the change, but using QTestAccesssible was not possible due to this. Change-Id: Idee21caf3076fbffd02d5e728f0c9cabf8712408 Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestaccessible.h51
1 files changed, 42 insertions, 9 deletions
diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h
index ef6f61bd82..65fbd4c818 100644
--- a/src/testlib/qtestaccessible.h
+++ b/src/testlib/qtestaccessible.h
@@ -194,42 +194,75 @@ private:
{
QAccessibleEvent *ev;
if (event->type() == QAccessible::StateChanged) {
- ev = new QAccessibleStateChangeEvent(event->object(),
+ if (event->object())
+ ev = new QAccessibleStateChangeEvent(event->object(),
+ static_cast<QAccessibleStateChangeEvent*>(event)->changedStates());
+ else
+ ev = new QAccessibleStateChangeEvent(event->accessibleInterface(),
static_cast<QAccessibleStateChangeEvent*>(event)->changedStates());
} else if (event->type() == QAccessible::TextCaretMoved) {
- ev = new QAccessibleTextCursorEvent(event->object(), static_cast<QAccessibleTextCursorEvent*>(event)->cursorPosition());
+ if (event->object())
+ ev = new QAccessibleTextCursorEvent(event->object(), static_cast<QAccessibleTextCursorEvent*>(event)->cursorPosition());
+ else
+ ev = new QAccessibleTextCursorEvent(event->accessibleInterface(), static_cast<QAccessibleTextCursorEvent*>(event)->cursorPosition());
} else if (event->type() == QAccessible::TextSelectionChanged) {
const QAccessibleTextSelectionEvent *original = static_cast<QAccessibleTextSelectionEvent*>(event);
- QAccessibleTextSelectionEvent *sel = new QAccessibleTextSelectionEvent(event->object(), original->selectionStart(), original->selectionEnd());
+ QAccessibleTextSelectionEvent *sel;
+ if (event->object())
+ sel = new QAccessibleTextSelectionEvent(event->object(), original->selectionStart(), original->selectionEnd());
+ else
+ sel = new QAccessibleTextSelectionEvent(event->accessibleInterface(), original->selectionStart(), original->selectionEnd());
sel->setCursorPosition(original->cursorPosition());
ev = sel;
} else if (event->type() == QAccessible::TextInserted) {
const QAccessibleTextInsertEvent *original = static_cast<QAccessibleTextInsertEvent*>(event);
- QAccessibleTextInsertEvent *ins = new QAccessibleTextInsertEvent(event->object(), original->changePosition(), original->textInserted());
+ QAccessibleTextInsertEvent *ins;
+ if (original->object())
+ ins = new QAccessibleTextInsertEvent(event->object(), original->changePosition(), original->textInserted());
+ else
+ ins = new QAccessibleTextInsertEvent(event->accessibleInterface(), original->changePosition(), original->textInserted());
ins->setCursorPosition(original->cursorPosition());
ev = ins;
} else if (event->type() == QAccessible::TextRemoved) {
const QAccessibleTextRemoveEvent *original = static_cast<QAccessibleTextRemoveEvent*>(event);
- QAccessibleTextRemoveEvent *rem = new QAccessibleTextRemoveEvent(event->object(), original->changePosition(), original->textRemoved());
+ QAccessibleTextRemoveEvent *rem;
+ if (event->object())
+ rem = new QAccessibleTextRemoveEvent(event->object(), original->changePosition(), original->textRemoved());
+ else
+ rem = new QAccessibleTextRemoveEvent(event->accessibleInterface(), original->changePosition(), original->textRemoved());
rem->setCursorPosition(original->cursorPosition());
ev = rem;
} else if (event->type() == QAccessible::TextUpdated) {
const QAccessibleTextUpdateEvent *original = static_cast<QAccessibleTextUpdateEvent*>(event);
- QAccessibleTextUpdateEvent *upd = new QAccessibleTextUpdateEvent(event->object(), original->changePosition(), original->textRemoved(), original->textInserted());
+ QAccessibleTextUpdateEvent *upd;
+ if (event->object())
+ upd = new QAccessibleTextUpdateEvent(event->object(), original->changePosition(), original->textRemoved(), original->textInserted());
+ else
+ upd = new QAccessibleTextUpdateEvent(event->accessibleInterface(), original->changePosition(), original->textRemoved(), original->textInserted());
upd->setCursorPosition(original->cursorPosition());
ev = upd;
} else if (event->type() == QAccessible::ValueChanged) {
- ev = new QAccessibleValueChangeEvent(event->object(), static_cast<QAccessibleValueChangeEvent*>(event)->value());
+ if (event->object())
+ ev = new QAccessibleValueChangeEvent(event->object(), static_cast<QAccessibleValueChangeEvent*>(event)->value());
+ else
+ ev = new QAccessibleValueChangeEvent(event->accessibleInterface(), static_cast<QAccessibleValueChangeEvent*>(event)->value());
} else if (event->type() == QAccessible::TableModelChanged) {
QAccessibleTableModelChangeEvent *oldEvent = static_cast<QAccessibleTableModelChangeEvent*>(event);
- QAccessibleTableModelChangeEvent *newEvent = new QAccessibleTableModelChangeEvent(event->object(), oldEvent->modelChangeType());
+ QAccessibleTableModelChangeEvent *newEvent;
+ if (event->object())
+ newEvent = new QAccessibleTableModelChangeEvent(event->object(), oldEvent->modelChangeType());
+ else
+ newEvent = new QAccessibleTableModelChangeEvent(event->accessibleInterface(), oldEvent->modelChangeType());
newEvent->setFirstRow(oldEvent->firstRow());
newEvent->setFirstColumn(oldEvent->firstColumn());
newEvent->setLastRow(oldEvent->lastRow());
newEvent->setLastColumn(oldEvent->lastColumn());
ev = newEvent;
} else {
- ev = new QAccessibleEvent(event->object(), event->type());
+ if (event->object())
+ ev = new QAccessibleEvent(event->object(), event->type());
+ else
+ ev = new QAccessibleEvent(event->accessibleInterface(), event->type());
}
ev->setChild(event->child());
return ev;