Q_ASSERT uses __FILE__, which has undefined contents, and thus the
selftest cannot always match Q_ASSERT messages in actual output with
those in expected output. The test was calling QEXPECT_FAIL() in this
case, but doing so implies that (a) it's a failure and (b) we intend to
fix it one day. Neither of these is true, so instead we should simply
tolerate this difference in actual and expected outputs, in the same way
that we do in a couple of other similar cases.
Change-Id: I8b8609a400e9b798936875f6eb1ca18a83660efc
Reviewed-on: http://codereview.qt-project.org/5358
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Add support for test cases which require an event loop, but do not need
GUI up and running. Such cases are best accommodated by code similar to
QTEST_MAIN, but using QCoreApplication instead of QApplication.
Change-Id: I04ce82d26b80a4edeba6bf7604a7f8d974232a11
Merge-request: 919
Reviewed-on: http://codereview.qt-project.org/5427
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
If we have trailing spaces at the end of a line, cursor will disappear
because the position we returned exceeds line end, thus the widget
border. By limiting it within line.width we can make sure it always
visible, which is more consistent to the behavior in common platforms.
Reviewed-by: Eskil
(cherry picked from commit c750afe0e0f043389d30850070889946e4c6e8af)
Change-Id: Ifc60b718369639bbb6f5afb35c29a6eb0dccd219
Reviewed-on: http://codereview.qt-project.org/5458
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
These functions should not take care not to unconditionally set the
capacityReserved private member, since the d may be referencing the
const shared_null or shared_empty which live in read-only memory.
The squeeze() methods check for ref > 1 instead of ref != 1 to prevent
detaching from the shared_null/shared_empty unnecessarily; the
shared_null/shared_empty ref count is -1, meaning squeeze() will never
detach from it.
Change-Id: Id3f1725a6f08b3a462343640a47bbe78f08ca7e7
Rubberstamped-by: Lars Knoll
Reviewed-on: http://codereview.qt-project.org/5454
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
QByteArray::squeeze() needs to make sure to detach if the
data is shared, otherwise it would end up crashing when
squeeze() is called on a QByteArray using the shared_null
or shared_empty.
Change-Id: I89c178659d8c7448681304f050fd69e17b2387de
Reviewed-on: http://codereview.qt-project.org/4528
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
QWidget's move() sets the position of the window including the window
frame, unlike setGeometry(). There was no equivalent for this in
QWindow, so several QWidget auto-tests were failing. Now we add
setFramePos() to achieve the same purpose in QWindow.
This fixes tst_QWidget::windowState(), which uses move().
Change-Id: I9a3e558bd615a8f0234cc3dd94fbb2bf5ecbc148
Reviewed-on: http://codereview.qt-project.org/5405
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
In QWidget::setWindowState() there was some code to emulate window
states when they're not supported by the backend, by hiding the window
on minimize or using the screen geometry and the frameless window hint
to manually try to make a window fullscreen.
However, some of this code was being run even when the backend does
support setting window states, specifically calling setParent(0) to
force a re-creation of the platform window and calling show(). These led
to the window getting the wrong position after being minimized or
fullscreen and going back to the normal state.
Apart from storing the normal geometry of a widget when going away from
the normal state we shouldn't do any magic when the call to
QPlatformWindow::setWindowState() succeeds.
tst_QWidget::windowState() still fails due to calling move() to set the
position of the widget including the frame, when QWindow currently only
supports setting the position of the widget excluding the frame.
Change-Id: I1c1a337d3c15f14c1c842bd1e347f94e6b67d7eb
Reviewed-on: http://codereview.qt-project.org/5367
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
The X server sends a series of expose events, where the count member
specifies how many expose events are remaining in the current series. By
merging them into an expose region we can send a single expose event to
the lighthouse interface.
Change-Id: If73c9972fe02c5e4137e8742aaaf5679ccea5a09
Reviewed-on: http://codereview.qt-project.org/5366
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
It's dangerous to set them as dirty in anticipation of a configure
notify event, as if frameMargins() is called before the event is
received the computed values are bogus.
Change-Id: Ib6db975fba5fcb13a2511e4716cbb5ca79265c34
Reviewed-on: http://codereview.qt-project.org/5365
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
We need to compare against the window's currently known geometry to know
when to send resize and move events. Also make sure at least one resize
event is sent, instead of sending one before each expose.
Change-Id: Id7ebe4c1c0e723af9198c668a0c736d64efdbf3e
Reviewed-on: http://codereview.qt-project.org/5364
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Simplify the combobox implementation by removing child logic.
Instead have an option to open the combobox.
Change-Id: I1bb517d0d064aefa28594b8fa957b8b2c9d48e88
Reviewed-on: http://codereview.qt-project.org/5032
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
The call is unnecessary; it does nothing since the shared_null ref count
is negative.
Change-Id: I0d0c35a554e4fc5b734a25dab06f04bee7a9ae24
Reviewed-on: http://codereview.qt-project.org/4637
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
QFontDatabaseQPA should be able to reinitialize database and
reregister all the fonts when an application font is added, because
it will trigger db->invalidate().
Add cloneWithSize support to QFontEngineBox so that even no usable
font is found in QFontDatabase, QRawFont::setPixelSize can still
work (without making the result rawfont invalid).
Register application fonts with QFontconfigDatabase, the code is
adapted from QFontDatabaseX11.
Reenable QRawFont tests for QPA, these usages are now supported in
QPA.
Fix QStaticText tests, raster in QPA does support transformations.
Translate the text before ZAxix rotation so that it will be visible
in canvas.
Add back fixedPitch support to QPA, and fix QFontDatabase tests.
Fix QGlyphRun tests, ignore non-existence glyphs in alphaMap
locking.
Fix QFontMetrics tests.
Task-number: QTBUG-21415, QTBUG-20754, QTBUG-20977,
QTBUG-20976, QTBUG-20760, QTBUG-20759
Change-Id: I24aea7d6ec6b2ac6342134d1f2591327c23a692b
Reviewed-on: http://codereview.qt-project.org/5384
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
252d1b34b2 introduces a mapFromGlobal
call in QWindowSystemInterface::handleTouchEvent. This has two issues:
It ignores the fact that the tlw parameter can be null, resulting in
an instant crash with the touch support of some platforms, and the
mapping itself is unneccessary because
QGuiApplication::processTouchEvent() will perform the same, the
rect set via setRect() is basically ignored due to the touchPoint.d.rect
= ... just before sending the final event to the widget in qguiapplication.cpp.
Using setScreenRect instead of setRect is a valid fix from the
previous patch, but the parts for the mapping need to be removed.
Change-Id: I0bb40c7d647fb062106b151e5987f9970d6ab2c8
Reviewed-on: http://codereview.qt-project.org/5448
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Bjørn Erik Nilsen <bjorn.nilsen@nokia.com>
indexOfMethod() requires a full signature, not just a method name.
Change-Id: Icb15ab46cab61b35f5d56e8e94b71f5e3b72f97a
Reviewed-on: http://codereview.qt-project.org/5386
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Adding a page flipping API for platform plugins. This
enables Wayland compositors to show full-screen client windows directly
without copying any data - if supported by the platform.
Change-Id: I19abe366434140f9e20a0655fe7cd41ea9264fca
Reviewed-on: http://codereview.qt-project.org/5385
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Tests for widgets should select the
QWidget * version of overloaded QTestLib
functions rather than the QWindow * version.
Change-Id: I8b540b630758c0e7ba7ed88aba45d624c83ff378
Reviewed-on: http://codereview.qt-project.org/4977
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
Each destination and the format of output to write there is specified by
adding "-o filename,format" to the command-line. The special filename
"-" indicates that the log output is written to the standard output
stream, though standard output can be used as a destination at most
once.
The old-style testlib output options are still supported, but can only
be used to specify one logging destination, as before.
If no logging options are given on the command-line, a plain text log
will go to the console, as before.
To log to the console in plain text and to the file "test_output" in
xunit format, one would invoke a test in the following way:
tst_foo -o test_output,xunitxml -o -,txt
This commit also enhances the selftests to test with multiple loggers,
but negative tests (e.g. bad combinations of command-line options) are
left for future task QTBUG-21567.
Task-number: QTBUG-20615
Change-Id: If91e752bc7001657e15e427aba9d25ab0a29a0b0
Reviewed-on: http://codereview.qt-project.org/4125
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Modify the selftest to be able to run each subtest with a list of one or
more test loggers. The addition of tests that use this capability will
be part of a subsequent commit.
Task-number: QTBUG-20615
Change-Id: Iac3efe8220e8245aa7e5589348d2c86b8034dd28
Reviewed-on: http://codereview.qt-project.org/5292
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Fix menu duplication bug: make QCocoaMenu::addAction
do nothing before the native menu has ben created.
Change-Id: Ifca192421f2073264de9f5faeb053008ecb8532e
Reviewed-on: http://codereview.qt-project.org/5135
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
To allow optimizations in the scene graph, we export the private
QTextImageHandler class and add a function which will fetch
a given image when required, or return the cached image in the
document resources.
Task-number: QTBUG-20917
Change-Id: If45e51b0d9a267bc198623165e7a2cc1fb2b961f
Reviewed-on: http://codereview.qt-project.org/5227
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Group the widgets-specific ("legacy") api under as
few ifdefs as possible. (The diff can look confusing;
rest assured that this change "only" moves entire
functions around in the files.)
Change-Id: I27bdec7d1c96d0b040dc22a8fed17e4e47766276
Reviewed-on: http://codereview.qt-project.org/5290
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
Make sure we move the drag pixmap when required,
and readd some commented out code from Qt 4.x.
Change-Id: Ib4302b394f4ac7b966d0146267651b9c3860c62b
Reviewed-on: http://codereview.qt-project.org/5262
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Re-add the support for drag pixmaps to qdnd.
Use the new WindowTransparentForMouseEvents
flag for the window that shows the drag pixmap.
Change-Id: I4b594085c161475988b9be0ffdc02c75fcc37f66
Reviewed-on: http://codereview.qt-project.org/5261
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Add a flag for output only windows that are
transparent for mouse events and implement it
for the xcb backend.
Change-Id: I24afdb6b27de34bcdf0c061a5a4987ac2880e4ae
Reviewed-on: http://codereview.qt-project.org/5260
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
We need to create the XWindow here to
avoid crashes, when resizing the backing store
before creating the window.
Change-Id: Ib8d9efca3552e5a91f5f63a9262449080ae301e5
Reviewed-on: http://codereview.qt-project.org/5259
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
When the platform window is created, it is the
authorative source for geometry information.
It would however be better if we could completely
avoid duplicated places for the geometry data.
Change-Id: Id90b24b9c40acb57f3d11b8b927292c06bac335e
Reviewed-on: http://codereview.qt-project.org/5258
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Also use QList::at instead of operator[].
Fixes: QTBUG-21403
Reviewed-by: Gabi
(cherry picked from commit 6997b836f445908cf53c1c96a69e3eb7ba535706)
Change-Id: I5d9de189e931b2b55fbd7baab0baad94adae352b
Reviewed-on: http://codereview.qt-project.org/4782
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
Commit 37d76a6798
made testlib depend on gui and widgets. It shouldn't.
Changing the includes was enough.
It's the application (e.g. autotest) that uses the
gui/widgets features that should link against gui/widgets.
Change-Id: If80d30a7eca2cac78cb5c6e5d29c82a06fb9f1dd
Reviewed-on: http://codereview.qt-project.org/5095
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jo Asplin <jo.asplin@nokia.com>
Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
There's api in testlib that should only be available
if the application links against widgets.
Change-Id: I22e382c6710690866ed8ffed81bae27b548dc830
Reviewed-on: http://codereview.qt-project.org/5094
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jo Asplin <jo.asplin@nokia.com>
Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
The multiexec test runs the same test object five times. If the -o
option is given, the output file is overwritten by each run of the test
object, meaning that tst_selftest only sees 1/5 of the test output in a
file compared with what it sees on the console. This makes it
impossible to use the expected output file to verify the test for both
console and file output. This issue is noted in QTBUG-21561.
Change-Id: I00031a2ea43a7ef78e8317473a089306ec062d8e
Reviewed-on: http://codereview.qt-project.org/5270
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
The warnings selftest verifies that qtestlib correctly handles output
sent via qDebug() and friends. The test had a number of printf calls
that were used to tell the user what output they should expect to see
next, but by bypassing testlib's logging, these made the testlog differ
depending on whether the test log was directed to the console or a file.
The printf calls are no longer needed, as any regressions in qDebug will
be detected by tst_selftests, which compares the output of the warnings
test with a reference copy of the expected output.
Change-Id: I8c3a3237463141fa494c50ca02062760cb583090
Reviewed-on: http://codereview.qt-project.org/5200
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
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).
Change-Id: Ifd15f72e2c553fba0c399c921957c4e955bb590d
Reviewed-on: http://codereview.qt-project.org/5191
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jo Asplin <jo.asplin@nokia.com>
Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>