Results 1 to 3 of 3

Thread: QTest::moseClick - problem

  1. #1
    Join Date
    Mar 2016
    Posts
    2
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default QTest::moseClick - problem

    Hi

    I have 2 problems with testing my gui
    1) while trying :

    QTestEventList list1;
    list1.addMouseMove(pt);// pt is point in the button- yes I see cursour on it
    list1.addMouseClick(Qt::LeftButton);
    list1.simulate(&mw);// mw is main window of my app

    not working but if I do :

    QTest::mouseClick(mw.ui->button,Qt::LeftButton); work's fine( function create's dialog ... )

    2)
    while :
    QTest::moseMove(mw.window(),pt1); //pt1 is point pt in global scope
    QTest::mouseClick(mw.ui->treeView,Qt::LeftButton,0,pt); //pt is point in the view - I had checked
    nothing happens(it should change direction of sorting or check all row - if it's on record) - sorry - coursor only move to position

    im using: windows 10 32 bit , Qt 5.5.1 +mingw32
    Last edited by woskov; 17th March 2016 at 12:57.

  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: QTest::moseClick - problem

    You need to direct the event to appropriate widget. If you direct click event to QMainWindow (subclass) object then you would have to reimplement mouse events for that QMainWindow derived class. The button positioned on the form attached to the main window will not receive the event. The same goes for the tree view -- you should rather direct the event to the header widget or maybe to the viewport of the view.
    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. #3
    Join Date
    Mar 2016
    Posts
    2
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTest::moseClick - problem

    Thank you for your replay.
    It was very helpful. But I still have some problems:
    1)
    Qt Code:
    1. list1.addDelay(3000);
    2. list1.addMouseMove(QPoint(10,10));
    3. list1.addDelay(1000);
    4. list1.addMousePress(Qt::LeftButton,0,QPoint(10,10));
    5. list1.simulate(mw.ui->search_btn);
    To copy to clipboard, switch view to plain text mode 
    coursor move to proper position, mark the button but action( open new dialog) is not executed


    2)
    Qt Code:
    1. QTest::mouseMove(mw.ui->tableView->viewport(),QPoint(20,10));
    2. QTest::mouseClick(mw.ui->tableView->viewport(),Qt::LeftButton,0,QPoint(20,10)); //works fine
    3.  
    4. QTest::mouseMove(mw.ui->tableView->viewport(),QPoint(20,10));
    5. QTest::mouseClick(mw.ui->tableView->viewport(),Qt::RightButton,0,QPoint(20,10)); //should open context menu but only mark one field in view
    To copy to clipboard, switch view to plain text mode 

    3) on button search_btn should open new dialog - how i can check if it hapens?
    i've tried: QApplication::activeWindow()->windowTitle();
    but while it is present, program goes to dialog and I need to manually exit from dialog to continue

    4) where can I find some more info about GUI testing using Qt tests

Similar Threads

  1. what is the QTest?
    By rezas1000 in forum Newbie
    Replies: 1
    Last Post: 2nd September 2014, 18:54
  2. QTest
    By dggarcia in forum Newbie
    Replies: 1
    Last Post: 4th April 2014, 18:07
  3. Problem with QTest and QApplication
    By aquavitae in forum Qt Programming
    Replies: 5
    Last Post: 24th January 2012, 10:29
  4. Qtest
    By gollaan in forum Qt Programming
    Replies: 1
    Last Post: 17th December 2008, 09:04
  5. QTest
    By LMZ in forum Qt Programming
    Replies: 5
    Last Post: 1st June 2007, 08:34

Tags for this Thread

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.