1

how can I run tests for QtQuick-Applications in the main.cpp? The main.qml have a rectangle and inside some buttons. The test class MouseClick.qml implements the javascript test functions who should push the buttons.

int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QTestCase = QTestCase(MouseClick); //????

    QtQuick2ApplicationViewer viewer;
    viewer.setMainQmlFile(QStringLiteral("qml/TestApp/main.qml"));
    viewer.showExpanded();

    return app.exec();
}
Andreas
  • 636
  • 1
  • 12
  • 29

1 Answers1

1

You can try to look how tests are implemented in Qt. For example

Kakadu
  • 2,837
  • 19
  • 29
  • The only way I've found is use the QUICK_TEST_MAIN macro for starting without this macro i get a compiler error.. – Andreas Dec 20 '13 at 13:41
  • It's common practive to put test code into another executable. Anyway, I don't see any reason why you can't execute code in link manually. And get rid of this ApplicationViewer! It hides implementation details which every beginner should know. – Kakadu Dec 20 '13 at 13:45