GCC 4.8 warns:
src/testlib/qtestmouse.h:219:67: warning: ‘popupMenu’ may be used uninitialized in this function [-Wmaybe-uninitialized]
{ mouseEvent(MouseClick, widget, button, stateKey, pos, delay); }
tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp:862:12: note: ‘popupMenu’ was declared here
Change-Id: I19cfd1790fbd948e97bf740d4412ccf3bb98a330
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This test is doing a brute-force mapping. Coupled with changes to
QCOMPARE last year, this now allocates and deallocates a lot of memory
per iteration. On my Sandybridge, it takes two minutes to run:
111136.781153 task-clock # 0.999 CPUs utilized
371,692,633,238 cycles # 3.344 GHz
182,641,818,708 stalled-cycles-frontend # 49.14% frontend cycles idle
57,951,552,830 stalled-cycles-backend # 15.59% backend cycles idle
477,216,332,971 instructions # 1.28 insns per cycle
# 0.38 stalled cycles per insn
86,959,637,669 branches # 782.456 M/sec
309,185,237 branch-misses # 0.36% of all branches
111.264868818 seconds time elapsed
Changing the iteration step from 1 to 5 reduces the runtime to about 5
seconds.
Change-Id: I9cad6f85f535f472319da7cd6c4aa28e12ddf1b7
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This test has recently timed out in CI, but appeared to be making
progress. Give it more time to complete.
Change-Id: Ied0fb7aad35ed6d5889dd585a7545687617e5e19
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
Task-number: QTBUG-26793
Change-Id: Ic19cb6581cd5838d26713998e152772a5d12da4f
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
SRCDIR was not defined for WinCE but it should no longer be used.
Fixed test case to use QFINDTESTDATA instead.
Change-Id: I07cbf7d42790d33e2d205d1682ec10e7577a92bd
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
This is consistent with QAbstractButton, QCalendarWidget,
QDialogButtonBox and QGroupBox (ie, all other widgets with
a clicked signal)
Task-number: QTBUG-26105
Change-Id: Ieafe988b5c03216796b69a7cd70ac1a03fc12b0a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
The argument has been obsoleted and not documented since 2007. Get rid
of it now before Qt 5.0
Task-number: QTBUG-25089
Change-Id: I91a5508a5e1606f5b5c289501295c67be4abe6a0
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Add new qt_handleXXX functions that forward to the QWindowSystemInterface
functions, and use those in the testlib inline functions. Remove use of
struct QWindowSystemInterface::TouchPoint from the testlib header files
(requiring some slight increase in ugliness in the two tests that use
that struct).
Also remove the qmake hack that adds private headers to all tests
Change-Id: Iec23537e55a44802f6e9cd463f7a0f82007c5250
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.
Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
QWindow::setWindowState is not supposed to set the window active.
The method requestActivateWindow() should be used for that.
When switching from and to fullscreen mode we're always passing
SWP_NOACTIVATE to SetWindowPos to not change the activation state
of the window. This is inverse to the old behaviour, which did not
have an effect.
Change-Id: I339337935cdad76b3ef252202e92177f37543038
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
QApplication::setActiveWindow doesn't activate the native window but
marks the widget as active inside Qt.
We need to use QWidget::activateWindow instead. See docs.
Also moved the activation call further down because on Windows a
minimized window cannot be activated using the activation-by-focus
fake we're currently using.
Change-Id: I752f6ada1f463931fa9cfb3c35f42dbec0207bfa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Previously synchronous window system events were
implemented by bypassing the queue and processing
the event immediately. This is not ideal since the
event order is not preserved - there might be "happened
before" events waiting in the queue.
Add QWindowSystemInterface::flushWindowSystemEvents
and change all handleSynchronous* to 1) queue the
event 2) call flushWindowSystemEvents.
flushWindowSystemEvents is almost identical to the
already existing sendWindowSystemEvents with the
exception that it does not call QApp::sendPostedEvents.
Move the common implementation to a new private function.
Task-number: QTBUG-20778
Change-Id: Ie98a83875bc0a14e335e36bed0dd9e0ed4a1dea0
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
The test has a member QWidget *topLevel which it recreates
and shows in init() without waiting for it to be exposed
although it is not used in every test case. This apparently
interferes with some tests that create separate top levels.
Do not show in init(), delete the topLevel.
Add wait to the cases where the topLevel is shown.
Change-Id: Ib428020b36dc82991d41e68478fd583bdfb004c7
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Use QTRY_VERIFY for the mappped attribute check.
Change-Id: I3cbde9122405bf7067f3702193e80636edc8c5c6
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
- Introduce smart pointers to delete widgets and resources
to ensure tests are not affected by left-over widgets
also in case of failure.
- Replace deprecated QTest::qWaitForWindowShown() by
QTest::qWaitForWindowExposed() and use QVERIFY,
remove some hard-coded timeouts.
- Set some titles and object names.
- Add verbose debug output of event lists in tests
childEvents.
- Set minimum sizes on widgets to avoid Windows warnings.
- Stabilize GDIWidget, trigger on first event only.
Change-Id: I64119a2e7113e4a9f0156d00c72ce0935d03bb81
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
In touch event terminology the global position is the screenPos,
scenePos is the windowPos.
Fixes a tst_qdeclarativepincharea test failure in qtquick1.
Change-Id: Ie98fe12be8cbedc9b019913b066e7c4bce75278d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Make sure the test subdirectories are actually visible
in the file model before the tests start.
Change-Id: If640456bba4362b19d7ad9d9184736c2eb8d3bde
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This avoids test instabilities and prevents test directories
from being cluttered with temporary files. Change tests
accordingly. Remove unused createLink() method.
Change-Id: I843c28ab81c8a476c71c5211a7479b22d3d9fc93
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
This allows to check whether QMetaTypeId2::MetaType exists, and can help
turn run-time into compile-time expressions, even without constexpr support,
or in situations where constexpr can't be used (because you can't overload
on it). This was designed for the QMetaType::registerConversion feature,
but it's much more widely applicable.
Change-Id: Iafa04add04bcb531b3f7fe3e751c7e91ee6a3bc0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Remove usages from autotests with the exception of
widgets/kernel, widgets/widgets and widgets/graphicsview.
Change-Id: I917b2857ed0cd07a6b3dbcd69244f558086c6586
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Using qRegisterMetaType<T>() has the advantage that multiple calls
during a program run are much more efficient, since an inlined
atomic is used to store the result. It also ensures that
Q_DECLARE_METATYPE(T) has been used, whereas qRegisterMetaType<T>("T")
will happily register anything.
Had to add Q_DECLARE_METATYPE to QFileInfo, for
QList<QPair<QString,QFileInfo>> of QFileSystemModel to work with
the partial specialisations of Q_DECLARE_METATYPE for QList, QPair.
In order to synchronize this change with other modules that did
their own Q_DECLARE_METATYPE(QFileInfo), a sync macro is defined
that can be tested in other modules, and will later be removed again.
Change-Id: I3004664e07e64cd885d5a03a57ff4e4379804aec
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
While the qWaitForWindowShown(QWidget *) is inherited
from Qt 4.8, the qWaitForWindowShown(QWindow *) was introduced
in Qt 5. As it is identical to qWaitForWindowExposed()
and removed already, it can be deprecated in Qt 5.
Remove its usages in qtbase.
Change-Id: I28788d120ad687a49f02b2b44de6b38a2832fe5c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This patch implement the equivalent of
468626e99a90d6ac21cb311cde05c658ccb3b781 in qtdeclarative but for
QtWidgets.
If a widget doesn't accept a touch event, then QApplication gives it
another try by synthesizing a corresponding mouse event. This way
QtQuick and QtWidget behave in a similar way, removing the need for
platform backends to try to emulate a mouse event from a touch event
unconditionally.
Also add relevant unit tests and adjust old QApplication ones.
Change-Id: Iddbf6d756c4b52931a9d1c314b50d7a31dbcdee9
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This allows building the QVariant tests without the QtWidgets module.
Change-Id: I7cd7e78a60c7bc7614ec16df1abe1e93e45d4923
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
The previous API was hard to use (global function, no type safety,
manual chaining), and confusing (app vs dispatcher split only made
sense on Windows). Installing and removing out of order would have
the risk of setting back a dangling pointer (crash). Meanwhile QPA
added type safety, and this new API models the QObject::installEventFilter
API for ease of use. The virtual method is in a new interface,
QAbstractNativeEventFilter.
QPA was even calling the dispatcher event filter with QPA-private event
classes, which made no sense (refactoring leftover from when the code
was in the dispatcher). Now the QPA plugins trigger the qcoreapp event
filters with the actual native events directly.
Change-Id: Ie35e47c59c862383bcaf857b28d54f7c72547882
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
- Implement waitForWindowExposed() for toplevel windows.
- Implement waitForWindowShown(QWidget *) and mark as
deprecated in line with waitForWindowShown(QWindow*).
- Use in tests.
- Simplify tests (collapse waitForExposed, setActive
into setActiveWindow, waitForActive), remove most
hard-coded timeouts.
- Stabilize graphicsview tests by using waitForWindowActive.
Change-Id: Ic7c061e2745b36f71a715ee4e47c0346b11a91e8
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
When turning off fullscreen mode and restoring the widget's geometry
we must inform the QWindow about the geometry change synchronously.
Otherwise QWidget::geometry() will return the old value.
Using the same technique for the state transition to fullscreen mode
without sending a separate resize event.
Autotest: tst_QWidget::saveRestoreGeometry
Task-number: QTBUG-26421
Change-Id: I869e36cd302d9a94e398f48949ab3cb7ee9cdf51
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
QtWidgets and QtGui are currently compiled without exceptions,
which causes a crash with gcc 4.6.3.
Change-Id: I8f872f3bec6266444adf08d51a6678150c5fae8e
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
When mixing native and regular widgets in same QMdiArea, some
subwindows didn't properly get set native. This was because
when a native parentless widget was given a parent, it wouldn't
enforce native window on the new parent and its ancestors.
This happened because window flags were adjusted too late in
relation to createWinId() call in setParent_sys().
Fixed by moving the createWinId() call to its proper place.
Also removed some old Q_WS_* ifdeffing in QWidget::setParent() that
masked some native enforcement code.
Additionally removed few QEXPECT_FAILs from QWidget autotest now
that those cases work correctly.
Task-number: QTBUG-26424
Change-Id: Ib6f9d0531e5c7299e2c307734d49c81f1ffa9713
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
A virtual method was reimplemented to return an always-empty string,
probably a leftover from a refactoring.
This fix showed that tst_qwidget_window was buggy: between Qt4 and Qt5,
a "Before" became "After", which made "Before" unused, and was masking
the fact that the app name was empty by default. In addition, the
earlier Qt5 change that made the app name default to argv[0] now requires
updating this test, now that it's actually working.
Change-Id: I5360026821a9b95bedd0ff09dba3d51a22e542b7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
Deprecate qWaitForWindowShown for Qt 6 as it is just a wrapper.
Change-Id: I0f8195679679120bd402e273fed4d331dc926708
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Change-Id: I19d3b2e9a5180b13deb828b55195404ef20be295
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This is a bigger test after this change:
c3e1abad4e
Beside the test of behavior it has the class
FastEditItemView which could be useful in the future.
QTestEventLoop::instance().enterLoop(1) does not perform well.
(IE it makes CI slower). My class could be used to extensions.
(or maybe even to remove a few of these calls)
Change-Id: I4f1460873cd07ddc482d5cfe462b59c47ebb189f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
removed printsupport tests for wince as there
is no print support on wince and removed the special
handling for wince from 4.8 on some tests as the dependent
modules are not part of qt base anymore
Change-Id: I4ffb22da11f98beee1013f775cb5ce4b936d3211
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
To let this test pass, a bunch of test cases had to be disabled.
Task-number: QTBUG-25300
Change-Id: I26bc08f366c43fb2bf3ba42a5fcbeb3888ed02c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>