Commit Graph

18 Commits

Author SHA1 Message Date
Kent Hansen
9e92ecde74 Provide API for "placement new" construction of meta-types
By making it possible to specify the place in memory where a
type should be constructed, any meta-type can be allocated on
the stack, for example. In the QML/JS QObject binding, this
makes it possible to call slots and access properties from
JavaScript without having to perform any mallocs (e.g. due to
QVariant creation) in the C++ <--> JS value conversion, in
the best case.

In addition to QMetaType::construct() and QMetaType::destruct(),
this change introduces QMetaType::typeSize(), which returns the
size of a type in bytes. This can be used to prepare a suitable
buffer for constructing a type using construct().

Benchmarks indicate that in-place construction is 2-5x faster
than normal construction for core and GUI types on linux-g++.

Note that there is already a QMetaType::construct() function
in Qt 4, which has been renamed to QMetaType::create() in Qt 5.
In order to avoid existing usages of construct() in user code
to call the Qt 5 construct() (when they really meant to call
create()), the third argument ("copy") of construct() is made
mandatory. Hence, calls to QMetaType::construct() written for
Qt 4 will cause a compile error when compiled with Qt 5, and
the user must adapt his code.

Task-number: QTBUG-12574
Change-Id: I836f06f6ee1c1c3edbd199a03424c78c942bdd3e
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2011-10-19 10:25:28 +02:00
Jason McDonald
8f02339e76 Remove DEPENDS_ON from qtestlib API.
The DEPENDS_ON macro didn't do anything and has misled many users to
think that they can write test functions that depend on other test
functions.

Task-number: QTBUG-21851
Change-Id: Ibe65b2d5d88bb81b6a0ebbe0b220f7d409a1446c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-19 07:24:13 +02:00
Jason McDonald
ae1810658b Move QTRY_VERIFY/QTRY_COMPARE into testlib.
These functions have lived in tests/shared/util.h for a long time, but
they really belong in qtestlib.

Change-Id: I60d569d002dea220b51563931d8b7aa77a20b98b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-19 07:23:44 +02:00
Jason McDonald
fe48366b48 Don't build empty qwineventnotifier test.
This test is only useful on Windows, so avoid building it elsewhere
rather than building an empty test.

Change-Id: I01d91266bcb2dd242e02e70741ad5b81a13c33f0
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-17 03:30:55 +02:00
Kent Hansen
45358303d1 Improve the QMetaType::create() autotest coverage
It only tested creating a copy of QSize.
This change adds testing of all core types, both
copy and non-copy creation.

Change-Id: If2b8fb45718c4a976dd8b883b332878f7fb0da6f
Reviewed-on: http://codereview.qt-project.org/6343
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-10-14 14:46:35 +02:00
Jędrzej Nowacki
3bdce9a8ba Small re-factor of QVariant autotest.
Enrich playWithVaraint template by a macro that returns correct line
number in case of failure.

Change-Id: I7684169852481a6905b71e4420135e7e3f298b12
Reviewed-on: http://codereview.qt-project.org/6570
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-10-14 13:13:01 +02:00
Kent Hansen
e5ce564b1d Rename QMetaType::construct() to create()
create() is symmetric with destroy().

Also rename the internal methods and fields to be
consistent (qDeleteHelper already had the "right"
name, though!).

This change will allow us to use construct() and
destruct() for something else: Placement new-style
allocation (QTBUG-12574).

The old construct() is still kept for now, until
the other repositories have been updated to use
create().

Change-Id: Iceb184af6cffcb0a634359cfc3516c718ba0c2f5
Reviewed-on: http://codereview.qt-project.org/6342
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-10-11 16:01:45 +02:00
Jason McDonald
924d810dbd Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at
run-time to be inapplicable or unsafe.  If a test function can be
determined to be inapplicable at compile-time, the entire test function
should be omitted instead of replacing the body of the test function
with a QSKIP, which only serves to slow down test runs and to inflate
test run-rates with empty, inapplicable tests.

Task-number: QTQAINFRA-278

Change-Id: I95feba3edbfa092c0ef4d85bb8c6877bd6be698e
Reviewed-on: http://codereview.qt-project.org/6128
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-07 04:30:30 +02:00
Jason McDonald
7cfad460c5 Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at
run-time to be inapplicable or unsafe.  If a test function can be
determined to be inapplicable at compile-time, the entire test function
should be omitted instead of replacing the body of the test function
with a QSKIP, which only serves to slow down test runs and to inflate
test run-rates with empty, inapplicable tests.

Task-number: QTQAINFRA-278

Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9
Reviewed-on: http://codereview.qt-project.org/5942
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-05 03:04:31 +02:00
Jo Asplin
fe90725ced Added bug ref in insignificant_test comment
Task-number: QTBUG-21814

Change-Id: I56907f2a1fb5555d338b6f1f695b741e1590e5d2
Reviewed-on: http://codereview.qt-project.org/5936
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jo Asplin <jo.asplin@nokia.com>
2011-10-03 19:16:02 +02:00
Friedemann Kleint
f18b690cca Tests: Fix compilation on Windows.
Replace Q_WS_... by Q_OS_... in corelib tests.

Change-Id: I14c41dca1ec490b3c49ba2c24e60def14c6de9da
Reviewed-on: http://codereview.qt-project.org/5778
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-03 07:57:41 +02:00
Sergio Ahumada
7440f0ea75 test: Re-enabled `tst_qtranslator' test that is now passing on Linux
This test was fixed by db3418c10b

Task-number: QTBUG-21125
Change-Id: I1bc549353f16c0df2b6c33533298b302fcc4d4ed
Reviewed-on: http://codereview.qt-project.org/5877
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-10-03 05:58:25 +02:00
Jason McDonald
95cebd34eb Remove Symbian-specific code from tests.
Symbian is not a supported platform for Qt5, so this code is no longer
required.

Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa
Reviewed-on: http://codereview.qt-project.org/5657
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-09-29 06:41:42 +02:00
Holger Ihrig
f57f01e201 Re-enabled test that was marked insignificant and passes
Added comment why QVariant Autotest is marked insignificant

Task-number: QTBUG-21424

Change-Id: I5b911bd36e376ad529342055180ff9c5de19de67
Reviewed-on: http://codereview.qt-project.org/5399
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-09-26 07:50:20 +02:00
Kai Koehne
9a096d9eb0 Move handling of -qmljsdebugger argument to QCoreApplication
Move handling of -qmljsdebugger= argument from QApplication
to QCoreApplication. It makes sense to allow debugging also
for applications based on QCoreApplication (which we intend
to support in QtDeclarative).

Change-Id: I5a03a4510fc166cea5aad146da673ee0e7cd5d36
Reviewed-on: http://codereview.qt-project.org/5121
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2011-09-19 16:37:51 +02:00
Kent Hansen
b8d656d878 Fix autotest gui/widgets dependencies
This is in preparation of removing testlib's
dependency on QtGui and QtWidgets.

Autotests that need QtWidgets api must
explicitly include it (since the types are no
longer provided by the QtGui master header).

Autotests that don't need QtGui or QtWidgets
api shouldn't link against those libraries.

Change-Id: I2808289068514fcac582808828ad4634e2631733
Reviewed-on: http://codereview.qt-project.org/5093
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-09-19 10:24:25 +02:00
Gunnar Sletta
b62bd0584a Merge branch 'refactor'
Conflicts:
	mkspecs/qws/linux-lsb-g++/qmake.conf
	src/gui/image/qpixmap_mac.cpp
	src/gui/painting/qpaintengine_x11.cpp
	src/gui/painting/qtessellator.cpp
	src/gui/text/qfontengine_qws.cpp
	src/gui/text/qfontengine_x11.cpp
	src/gui/widgets/qlinecontrol.cpp
	src/opengl/qgl.h
	src/opengl/qgl_x11egl.cpp
	src/plugins/plugins.pro

Change-Id: If52dcd55cd55f2983a756c2f843967702b60a310
2011-09-13 08:54:45 +02:00
Holger Ihrig
3a7e6157d1 Moving relevant tests to corelib/kernel
Added Test for qmetaproperty

Marked QSocketNotifier Autotest as insignificant. See QTBUG-21204

Marked qtranslator Autotest as insignificant. See QTBUG-21125

Marked corelib/io/qfile/largefile as insignificant. See QTBUG-21175

Task-number: QTBUG-21066
Change-Id: I2a7f6587845c355091bb07c8dd3d1557d16db0be
Reviewed-on: http://codereview.qt.nokia.com/3598
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-09-01 12:42:14 +02:00