void Ut_MInputContext::testKeyEvent() { QEvent::Type eventType = QEvent::KeyPress; int eventKey = Qt::Key_A; Qt::KeyboardModifiers eventModifiers = Qt::NoModifier; QString eventText('A'); bool eventRepeat = false; unsigned short eventCount = 1; WidgetStub widget(0); gFocusedWidget = &widget; m_subject->setFocusWidget(&widget); widget.resetCounters(); m_subject->keyEvent(eventType, eventKey, eventModifiers, eventText, eventRepeat, eventCount); QVERIFY(widget.eventCount() > 0); QKeyEvent expected(eventType, eventKey, eventModifiers, eventText, eventRepeat, eventCount); QKeyEvent result = widget.lastKeyEvent(); QCOMPARE(result.type(), expected.type()); QCOMPARE(result.key(), expected.key()); QCOMPARE(result.modifiers(), expected.modifiers()); QCOMPARE(result.text(), expected.text()); QCOMPARE(result.count(), expected.count()); m_subject->setFocusWidget(0); gFocusedWidget = 0; }
static jvmtiError set_event_notification(jvmtiEventMode mode, EventIndex ei) { jvmtiError error; error = JVMTI_FUNC_PTR(gdata->jvmti,SetEventNotificationMode) (gdata->jvmti, mode, eventIndex2jvmti(ei), NULL); if (error != JVMTI_ERROR_NONE) { ERROR_MESSAGE(("JDWP unable to configure initial JVMTI event %s: %s(%d)", eventText(ei), jvmtiErrorText(error), error)); } return error; }