From b5f2bf1a71d926b9bb04101b49a11fd641aad14f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 6 Oct 2017 13:09:57 +0200 Subject: Fix QWinEventNotifier for auto-reset events Auto-reset events are automatically reset to non-signaled when we get notified about the signaled state. This implies that we cannot check the event state again in activateEventNotifiers. Instead, store the signaled state in a QAtomicInt and test and decrement that. This amends commit 85403d0a. Task-number: QTBUG-63555 Change-Id: I0adee3d2929783f98d91060f9106c8b5266d72fa Reviewed-by: Oswald Buddenhagen --- .../kernel/qwineventnotifier/tst_qwineventnotifier.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp') diff --git a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp index 304f6121a5..15a39b62c0 100644 --- a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp +++ b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp @@ -41,6 +41,7 @@ protected slots: void simple_activated(); void simple_timerSet(); private slots: + void simple_data(); void simple(); void manyNotifiers(); @@ -61,9 +62,17 @@ void tst_QWinEventNotifier::simple_timerSet() SetEvent((HANDLE)simpleHEvent); } +void tst_QWinEventNotifier::simple_data() +{ + QTest::addColumn("resetManually"); + QTest::newRow("manual_reset") << true; + QTest::newRow("auto_reset") << false; +} + void tst_QWinEventNotifier::simple() { - simpleHEvent = CreateEvent(0, true, false, 0); + QFETCH(bool, resetManually); + simpleHEvent = CreateEvent(0, resetManually, false, 0); QVERIFY(simpleHEvent); QWinEventNotifier n(simpleHEvent); -- cgit v1.2.3