1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-01-17 23:22:53 +08:00
pyotherside/qtquicktests/qtquicktests.cpp
Robie Basak 16fc61db5b Test call_sync with one parameter
Introduce qtquicktests/ with a single test. This allows us to write
tests entirely in QML with no C++ component.

The single test tests for regressions in issue #49.

The qtquicktests framework (supplied by QT/QML upstream) provides only a
template expansion that provides a main() function. Therefore, we must
generate a new binary as the shim for running the tests, as the public
API mechanism doesn't allow us to generate a single binary with the two
backends.

As qmake supports only one binary per directory (without getting really
hacky), we must add a new directory for it.

Perhaps now the tests/ directory should be renamed to cpptests/ or
something for clarity.

Unfortunately "make check" doesn't work, so I've provided a "./run"
wrapper you can run manually from inside the qtquicktests/ directory for
now. This is because qtquicktests appears to have been designed to test
QML apps, not plugins. This isn't much of a problem, except that the
test runner is unable to find the in-tree built plugin.

The generated binary does support a "-plugins <directory>" option, but
it seems to be impossible to get "make check" to use it:

 * The qmake extension supports an INCLUDESPATH to add a
   "-includes <directory> option, but no equivalent PLUGINSPATH.

 * Even though qtquicktests reports "." as being in the plugins
   path after a failure, it does not appear to actually look there, so
   symlinking or copying the plugin in to the current directory doesn't
   work.

 * qmltestcase.prf uses testcase.prf which allows TESTARGS to be
   added. However, it reads this from the environment (a Makefile
   variable) rather than from a qmake variable. There appears to be no
   way of exporting a Makefile variable from a .pro file (unless its
   name is to start with EXPORT_). See
   http://stackoverflow.com/q/35554105/478206.

 * Copying and modifying mysqltestcase.prf from
   /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/ to add a PLUGINSPATH
   configurable option does work, but then you have to run qmake with
   "QMAKEFEATURES=. qmake" since even though it is documented to look in
   the project root, that doesn't work (I tried both the top level and
   inside qtquicktests/).

So I gave up trying to get "make check" to work, and resorted to a
wrapper around calling qtquicktests with the correct options, which at
least works for now.
2017-01-04 23:00:35 +00:00

3 lines
65 B
C++

#include <QtQuickTest/quicktest.h>
QUICK_TEST_MAIN(qtquicktests)