Example #1
0
    static void s_MouseInputTestCallback(_Inout_ std::deque<std::unique_ptr<IInputEvent>>& events)
    {
        Log::Comment(L"MouseInput successfully generated a sequence for the input, and sent it.");

        size_t cInputExpected = 0;
        VERIFY_SUCCEEDED(StringCchLengthW(s_pwszInputExpected, STRSAFE_MAX_CCH, &cInputExpected));

        if (VERIFY_ARE_EQUAL(cInputExpected, events.size(), L"Verify expected and actual input array lengths matched."))
        {
            Log::Comment(L"We are expecting always key events and always key down. All other properties should not be written by simulated keys.");

            for (size_t i = 0; i < events.size(); ++i)
            {
                KeyEvent expectedKeyEvent(TRUE, 1, 0, 0, s_pwszInputExpected[i], 0);
                KeyEvent testKeyEvent = *static_cast<const KeyEvent* const>(events[i].get());
                VERIFY_ARE_EQUAL(expectedKeyEvent, testKeyEvent,
                                 NoThrowString().Format(L"Chars='%c','%c'",
                                                        s_pwszInputExpected[i],
                                                        testKeyEvent.GetCharData()));
            }
        }
    }