Results 1 to 4 of 4

Thread: GUI Event testing using QTestLib

  1. #1
    Join Date
    Apr 2010
    Posts
    16
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default GUI Event testing using QTestLib

    Hi,

    How to unit test qt GUI events (keypress, keyrelease,mouseclick)?

    I already gone through http://doc.trolltech.com/4.6/qtestli...reating-a-test

    Are there any reference material/samples to start with event testing?

    Thanks
    Vels

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: GUI Event testing using QTestLib

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    vels (23rd April 2010)

  4. #3
    Join Date
    Apr 2010
    Posts
    16
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: GUI Event testing using QTestLib

    Hi,

    I am using keypress event on mywindow

    Qt Code:
    1. void TestGui::testGui()
    2. {
    3. QMainWindow mywindow;
    4. QTest::keyPress(&mywindow, Qt::Key_Backspace);
    5.  
    6. //how to verify keypress event
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 

    how to verify the event?

    Thanks
    Vels

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: GUI Event testing using QTestLib

    What do you mean by "verify" in this context? I don't know what the backspace key is supposed to do in your case but you have to use the API of your window class to check if it did that. Use the macros provided by QTestLib for the comparison itself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    vels (23rd April 2010)

Similar Threads

  1. Testing Qt-Software with a GUI Testing Tool
    By nightghost in forum Qt Programming
    Replies: 8
    Last Post: 22nd February 2012, 08:43
  2. Project structure with qtestlib
    By matteonardi in forum Qt Programming
    Replies: 1
    Last Post: 1st April 2010, 09:01
  3. Qtestlib unittests & Qmake
    By saulit in forum Newbie
    Replies: 0
    Last Post: 5th February 2009, 20:06
  4. testing with QTestLib
    By hyling in forum Qt Programming
    Replies: 2
    Last Post: 12th July 2007, 21:37
  5. GUI runner of QTestLib
    By Intaek Lim in forum Qt-based Software
    Replies: 1
    Last Post: 25th April 2007, 09:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.