Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTest mouseClick error
Forum Updated to NodeBB v4.3 + New Features

QTest mouseClick error

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    privateryan0
    wrote on last edited by
    #1

    Hi

    I am trying to simulate a mouse click

    @
    MainWindow::MainWindow(QWidget *parent)
    : QDeclarativeView(parent)
    {
    ...
    QTest::mouseClick(this, Qt::LeftButton, 0, QPoint(20,20), -1);
    ...
    }
    @

    It compiles fine but when I Run, I get the following error:

    ASSERT: "QTest::testLogger" in file qtestlog.cpp, line 334
    The program has unexpectedly finished.

    I also tried @QTest::mouseClick(parent, Qt::LeftButton, 0, QPoint(20,20), -1);@

    Which produces the following error:

    ASSERT: "widget" in file /usr/include/qt4/QtTest/qtestmouse.h, line 74
    The program has unexpectedly finished.

    First child for help : )
    thanks

    1 Reply Last reply
    0
    • P Offline
      P Offline
      privateryan0
      wrote on last edited by
      #2

      Here you can see the error line in qtestmouse.h
      QTEST_ASSERT(widget);

      @
      namespace QTest
      {
      enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDClick, MouseMove };

      static void mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button,
                             Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
      {
          QTEST_ASSERT(widget);
          extern int Q_TESTLIB_EXPORT defaultMouseDelay();
      

      ....
      @

      and the macro itself
      #define QTEST_ASSERT(cond) do {if(!(cond))qt_assert(#cond,FILE,LINE);} while (0)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved