Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115532

QTest::keyClick does not work with control characters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.2.4
    • Testing: qtestlib
    • None
    • OS: Windows 10 Pro 10.0.19045 Build 19045
      Processor: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz, 1690 Mhz, 4 Core(s), 8 Logical Processor(s)
      RAM: 12 GB
      IDE: Qt Creator 9.0.2
    • Windows

    Description

      I am trying to simulate user input to close a window. I try to use QTest::keyClick(Qt::key::Key_F4, myWidget, Qt::KeyboardModifiers

      { Qt::KeyboardModifier::AltModifier }

      ); to simulate the user clicking the Alt+F4 keyboard combo, but it does not work. I step through the code and it seems like keyClick and similar functions only support ASCII characters. Is there a way to simulate keyClicks that are control characters?

      For more detail into my use case, I want to pop-up a message box when someone closes the window. I have an event filter that handles this. I have code to check whether the message box is created, but the test case fails because the event filter fails to determine the event. I think it has something to do with what I pass into keyClick, but I am unsure.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            macadder Jason McDonald
            compscidude Thomas Smith
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes