Commit Graph

6551 Commits

Author SHA1 Message Date
Friedemann Kleint
23bed9f820 Remove tst_QWidget::immediateRepaintAfterShow().
It tested whether a paint event was received when calling QWidget::repaint()
right after QWidget::show() without waiting for the window to be exposed.

This caused a QEvent::UpdateRequest to be sent, which ended up in
QWidgetBackingStore::sync() which returns after checking
QWidgetBackingStore::discardSyncRequest(), since Qt::WA_Mapped is not set
on the non-exposed widget.

The test passed on Windows since it contains one call to
QCoreApplication::processEvents() which causes the the initial WM_PAINT
message to be processed in QWindowsWindow::handleWmPaint() which calls
QWindowSystemInterface::flushWindowSystemEvents() and causes Qt::WA_Mapped
to be set. This seems counter to the intention of the test.

Remove the test since it won't pass anymore in Qt 5 unless Qt::WA_Mapped is set.

Task-number: QTBUG-26424
Task-number: QTBUG-38327
Task-number: QTBUG-39842
Change-Id: Iede026d52825dcf1f2e9014a316d26d260309214
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-06-04 18:47:54 +00:00
Morten Johan Sørvig
22667483e1 Blacklist modalDialogClosingOneOfTwoModal on OS X
Passes locally (on 10.10), but seems to have become
unstable on the CI system.

Task-number: QTBUG-53790
Change-Id: I0432fca4121b97bcdd6cec529fc4e148dfb8c1ab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-06-04 18:36:04 +00:00
Liang Qi
688f70634c Merge remote-tracking branch 'origin/5.6.1' into 5.6
This merge also blacklists a flaky tst_QGL::clipTest test on
OpenSUSE 13.1.

Conflicts:
	src/network/socket/qnativesocketengine_winrt.cpp
	tests/auto/opengl/qgl/BLACKLIST

Task-number: QTBUG-53133
Change-Id: I14b431aa5a189b7dd1d3e2dfff767d15df20fde3
2016-06-02 06:01:25 +02:00
Alexandru Croitor
a1de7c40f4 Blacklist tst_QOpenGLWidget::stackWidgetOpaqueChildIsVisible test.
It fails randomly on Windows, possibly due to timing issues.

Change-Id: I0ef74f203455eb4ea8aeee4c8fc9bf1fbf6fb8ff
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-06-01 11:17:31 +00:00
Eskil Abrahamsen Blomfeldt
8fb29ed259 Don't alter input string in QTextLayout with ShowLineAndParagraphSeparators
When ShowLineAndParagraphSeparators was set, we would replace the
separator character in the user's string in some cases, since we never
detached from the input string and just const_cast the pointer to the
shared buffer.

[ChangeLog][QtGui][Text] Fixed bug where a QTextLayout with
ShowLineAndParagraphSeparators would modify the layout's input
string.

Task-number: QTBUG-42033
Change-Id: I92f9100b750f16e52b38b718245c13e5c4a0ebb9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-06-01 10:04:02 +00:00
Jake Petroules
a160bd4fcc Fix bugs causing Thin font weights to be ignored or mishandled.
Task-number: QTBUG-53196
Change-Id: If12b3cab3d8de5e0e452fca844b0a484c29e9e86
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-06-01 02:29:51 +00:00
Friedemann Kleint
ed08e3be34 tst_QPlainTextEdit/tst_QTextEdit: Do not output unprintable characters.
The test selectWordsFromStringsContainingSeparators() duplicated
in boths tests caused tab and Nbsp characters to be output to the
log, which upsets editors.
Use an array of ushort instead of a wasteful QStringList and
output the hex codes for the unprintable characters.

Change-Id: I08724268f376b4c0da492b4109570e44f7d4a3fb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-05-31 11:46:36 +00:00
Alexandru Croitor
00061b968d Fix opaque texture-based widgets not being always shown.
Whenever a regular QWidget contains a child render-to-texture widget
(like a QOpenGLWidget) that is opaque (attribute
Qt::WA_OpaquePaintEvent is set) and completely covers the parent
geometry, the child widget would not be shown.

This happens because QWidgetBackingStore::doSync contains a check to
see if an opaque child completely covers its parent, in which case it
does not draw the parent, and only draws the child.

This is an issue if the widget is actually a texture-based one, because
for it to be seen on screen, the parent widget has to be redrawn with a
proper blending mask, so that the rtt widget gets properly composed
into the place where the mask is.

The fix consists in keeping the parent widget being marked dirty, in case
it has an opaque texture-based child that completely covers it. This will
force a redraw of the parent widget with a proper blending mask.

Change-Id: If1feec04b86bff2c49158b8d72f175cec252dea1
Task-number: QTBUG-52123
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-05-30 12:35:37 +00:00
Thiago Macieira
32c301e229 Fix crash when connecting a non-PMF with Qt::UniqueConnection...
...if a PMF connection had already happened. Since UniqueConnection
isn't implemented for non-PMFs (functors and lambdas aren't comparable,
even if static member functions or non-member functions are), we pass a
null pointer for comparison argument. The disconnect() code already
protected against a null pointer there, but not the connect code path
with Qt::UniqueConnection

Change-Id: I87e17314d8b24ae983b1fffd145324beced0494d
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Dario Freddi <dario.freddi@ispirata.com>
2016-05-30 00:19:39 +00:00
Thiago Macieira
0f559a2d99 Force the use of the C++11 alignof keyword instead of an extension
If the compiler supports C++11 alignof, let's use it. No point in
perpetuating the use of __alignof__ or __alignof.

There's a fallback implementation in qglobal.h that works even without
compiler extensions. We can't drop it just yet (alignas is not a
required C++11 feature), but at this point I doubt that fallback is used
anywhere anymore.

The tst_compiler test was wrong to use alignof(variable). That's not
permitted by the standard nor would it work with our fallback
implementation. MSVC 2015 enforces this, but ICC, GCC and Clang don't.

Change-Id: Ifea6e497f11a461db432ffff1448abfa86672c63
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-29 18:45:13 +00:00
Edward Welbourne
07667b4390 tst_QNetworkReply: Un-blacklist recently fixed test.
A recent fix now makes
authenticationCacheAfterCancel(http+socksauth)
work again, so un-blacklist it.
Added a helpful comment while I was at it.

Change-Id: I2d7eae8d80c12957d22659a82e5072301735c41f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-25 11:12:00 +00:00
Thiago Macieira
e9041c7fc1 Fix parsing of tzfile(5) POSIX rule zone names with bracket quotes
POSIX.1-2001 allows quoting a zone name so that it can contain other
characters besides letters, by enclosing it in angle brackets ('<' and
'>'). This hadn't been used until recently (tzdata2016b), when the
Asia/Barnaul rule started using a zone name "+07" (the name variable
contained the value "<+07>-7").

Thanks to Paul Eggert for reporting and investigating the root cause.

Task-number: QTBUG-53071
Change-Id: Id5480807d25e49e78b79ffff1449bc410776cb66
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-24 19:31:40 +00:00
Laszlo Agocs
61521b64a4 Avoid missing paints when resizing GV with QOpenGLWidget viewport
There is nothing guaranteeing there will be a paint request after
resizeViewportFramebuffer() is called. However we must not be left
with a framebuffer with uninitialized content. So trigger an update.

Include also a half-hearted autotest. QOpenGLWidget (or QGLWidget)
viewports have not been autotested at all. Try to verify that it
is functional at least, even if we cannot check the actual output.

Change-Id: I34d78fe32e94c39dad919216b5a4f4bb2aea3cc2
Task-number: QTBUG-52419
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
2016-05-24 19:16:46 +00:00
Gabriel de Dietrich
1acb29c3dd QMenu auto-test: Add test for two-level tearable menus
This has been fixed in 5.6.1 but we can afford the extra test
to guard against regressions.

The setup for this test is two menus, one parent of the other.
The submenu is tearable. We open the parent menu, open its
submenu and then move the mouse cursor straight over the
submenu's tear-off area. The submenu should stay open even
after a short delay.

Change-Id: Ia8ad326d78dde31b6dd91b0ebacf0db1898715d4
Task-number: QTBUG-53068
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
2016-05-19 18:17:40 +00:00
Błażej Szczygieł
bc410cc706 QtWidgets: Reduce paint events when resizing native widget
This patch reduces paint events by removing code which sets native
widgets dirty in QWidgetWindow::handleExposeEvent. Native widgets are
also marked dirty in QWidgetPrivate::drawWidget, so it is enough for
proper painting.

This restores Qt4 behavior when one resize means one repaint for native
widgets. Without this patch the native widget is marked as dirty on
every expose event, so one repaint is from syncBackingStore and second
(or more) is from marking the widget dirty explicitly.

This patch improves performance of native widgets and it also reduces
locks when paint event is v-synced, e.g. on OpenGL swap buffers or on
any other technology like VDPAU, VA-API, etc.

Added autotest for checking number of paint events for native widgets.

Task-number: QTBUG-50796
Change-Id: I4e1649069e2e73d15b038fd1834d0551915252ee
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-05-19 10:11:27 +00:00
Liang Qi
640441882d Merge remote-tracking branch 'origin/5.6.1' into 5.6
Conflicts:
	src/network/socket/qnativesocketengine_winrt.cpp

Change-Id: I8edb72f8ba958d80c3d7993b3feaaae782ca8d9c
2016-05-19 06:31:06 +02:00
Felix Bourbonnais
b627dd2c24 QMenuBar: nested parenting fix
QMenuBar now receives a parent changed event for each of its parent,
grand-parent, ... This fixes a crash caused by an invalid QWidget
pointer and makes sure the keyboard shortcuts events are relayed to the
menu bar in all parenting/re-parenting cases by installing an event
filter on each parent

Task-number: QTBUG-53205
Change-Id: I419e6cbc52e28a67fb08a848a7161b4cb8ae4ae5
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
2016-05-18 17:40:11 +00:00
Olivier Goffart
27425e62c0 Moc: fix crash when a file ends with \\\r
make the 'cleaned' more robust by making sure we do not read past the
buffer in some cases. We must also use resize and not reserve on the
outpt buffer because reseve is meant as a hint and we are not supposed
to write past the size of the QByteArray even if it is reserved.

[ChangeLog][moc] Fixed crash on file ending with \\\r

Task-number: QTBUG-53441
Change-Id: I901e6c0ffc7f8877de3d07fd08cf26495461d294
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
2016-05-18 10:34:13 +00:00
Olivier Goffart
45eba73492 Fix QVariant conversion to an enum type.
QVariant::canConvert<Enum> was returning true for everything can can be converted
to integer, but not for integer itself. That's because in QVariant::canConvert
we set the targetType to Int of it's an enum, but the Int->Int case was not
on the conversion matrix. So this commits adds it to the conversion matrix
and now QVariant::canConvert<Enum> returns consistently true for int itself.

But even tough canConvert returned true, it did not actualy do any conversion
to the enum type itself. Fix that by handling the case properlt in 'convert'

[ChangeLog][QtCore][QVariant] Fixed QVariant::canConvert and conversion from
integer types to enumeration types.

Task-number: QTBUG-53384
Change-Id: I6ac066f3900e31bfcea7af77836ddfc7730bd60b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-16 15:58:28 +00:00
Friedemann Kleint
474af0a61d QWidget::mapTo/FromGlobal(): Rewrite using a QTransform.
Introduce a function going up the widget hierarchy determining a QTransform
for mapping the coordinates applying the transformations of any QGraphicsView
instances found. In mapFromGlobal(), use the inverse of it. This fixes the
case of widget hierarchies embedded into QGraphicsView with transformations.

Increase fuzz in the tests due to float rounding errors.

Task-number: QTBUG-41135
Task-number: QTBUG-50030
Task-number: QTBUG-50136
Task-number: QTBUG-52507
Change-Id: I507e0bccd546250fe9c2d1b74ef38657d61490b4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-14 06:51:10 +00:00
Thiago Macieira
a26435d65c Print the QStorageInfo dump on test start
So we know what we're looking at if there's a test failure. This is like
QNetworkInterface.

Change-Id: Id75834dab9ed466e94c7ffff1444bf51f615e944
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-14 01:21:27 +00:00
Eskil Abrahamsen Blomfeldt
186d391f25 Work around QFont bug in QFontDialog test
The QFontDialog test will currently fail for some PCF bitmap fonts
because the list of smooth sizes it uses to populate its size list
contains unsupported sizes. We work around this by adding
QEXPECT_FAIL when we detect that the failure is going to happen.

Task-number: QTBUG-46056
Task-number: QTBUG-53299
Change-Id: Ia665cca220f3622405d1a2336e8d587545cccbc6
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-13 21:08:07 +00:00
Timur Pocheptsov
ae975859f9 Revert "tst_qudpsocket - remove insignificant"
This reverts commit 11ad50074b.
Unfortunately, udpsocket strikes back this time on OS X < 10.10 -
never seens these test failing before. Since this prevents 5.6->5.7
merge, I have to revert it until the problem investigated/fixed on OS X.
Alas :(

Change-Id: I52f6512d88c25d2e3071cb845e91faefbd455e27
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-05-13 19:07:56 +00:00
Eirik Aavitsland
5316befba2 ICO image format: fix regression in writing when size >= 256
In commit c6c9304, the earlier size limit of 128 was raised to the
format's defined maximum of 256. But the required special storage of
this size in the image structures was not implemented. Hence,
attempting to store such big icons would result in invalid image
files.

Fix the size storing details, and add some autotests of ico format
writing since that was practically uncovered.

Task-number: QTBUG-53259
Change-Id: I00e17a04e90c32dcf1124ba5adaf53728fb74dc7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-05-13 04:37:15 +00:00
Jesus Fernandez
2ac3fab45f Fixed crash in QAuthenticator::operator==
[ChangeLog][QtNetwork][QAuthenticator] Fixed crash when
comparing a initialized QAuthenticator with an uninitialized
QAuthenticator.

Task-number: QTBUG-53338
Change-Id: Ib8b732b9c65c02ee542885e5d6fe9bd1589a6b1a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-13 03:58:06 +00:00
Alexander Volkov
acf43c17b6 QFileSystemModel: create nodes with correct QFileInfos
Create parent nodes with the corresponding paths, not with
the absolute path of the child node. Otherwise we will get
incorrect QFileInfo at least in the following case:

    QFileSystemModel model;
    model.setRootPath("/usr/bin");
    QModelIndex idx = model.setRootPath("/usr");
    qDebug() << model.fileInfo(idx).absoluteFilePath();

Without the fix it prints "/usr/bin".

It's a regression triggered by 61cefb2f7a
(De-inline QFileSystemModel::fileInfo() and implement it efficiently).

Change-Id: I3b4e5f5b256711e27ad50824eaa8492dbc096808
Task-number: QTBUG-51586
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-10 20:51:15 +00:00
Oswald Buddenhagen
33c5df2887 decruft project files
the "generated by qt creator" header is not supposed to be checked in.

Change-Id: I7626c0bd16f83d81b3facd216a04e7d505942256
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2016-05-10 11:12:04 +00:00
Morten Johan Sørvig
7e539002ee Enable movedAndResizedAttributes test.
The test passes on OS X now.

Task-number: QTBUG-8941
Change-Id: I7b57dc30ede7c1ed0bcb8bacb458ea56f222d987
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-10 10:36:08 +00:00
Morten Johan Sørvig
95b8dfdb6f tst_qwidget: remove sheetOpacity test
Sheets are no longer transparent on newer OS X
versions.

Change-Id: Iaaed5aea9c9b130a5d991acd36717b76c3927cfb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-10 10:26:51 +00:00
Morten Johan Sørvig
7f5e8a5e34 OS X: Remove unified toolbar test.
The Qt 5 unified toolbar implementation does not move
the toolbar to the “non-client” area. This test is
no longer relevant.

Change-Id: Ia32de2260f8ef400a0dc5acf3e5e3ff59083657a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-10 08:15:09 +00:00
Thiago Macieira
50723bf3d0 Make sure the QDBusVirtualObject virtuals are called in the right thread
Change-Id: I42e7ef1a481840699a8dffff1409e30f191e822f
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-05-09 16:21:50 +00:00
Friedemann Kleint
9f6f06c319 tst_QMdiArea::subWindowActivated2(): Allow for several activated events.
On some X11 window managers, 2 events are received when
hiding/reshowing and activating the window, which became
apparent after 91f536dd71.

Change-Id: I66fdc4f69d87ac898b18d5dfddc957617bb8f916
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-09 08:40:00 +00:00
Thiago Macieira
d9f6b6d1f8 QStorageInfo: update the detection of pseudo filesystems
Allow tmpfs filesystems to be reported, as they're often usable by the
user, mounted in /tmp and in /run (the fs for $XDG_RUNTIME_DIR).

But disallow anything whose device is not a pathname. This catches most
of everything else that wasn't specifically tested for before, like
virtual fuse filesystems, like GVFS.

Change-Id: I3e15a26e0e424169ac2bffff1417b7cee0f8ec97
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-09 06:04:26 +00:00
Thiago Macieira
b168c6c824 QStorageInfo: fix matching of mountpoints to sibling directories
The path "/usrfoo" starts with "/usr", so if you tried to get
QStorageInfo("/usrfoo") when "/usr" is a mount point, you'd get the
wrong filesystem.

[ChangeLog][QtCore][QStorageInfo] Fixed a bug that caused QStorageInfo
to report information for the wrong filesystem if there is a mounted
filesystem at a path that is a prefix of the requested path (e.g., it
would report "/usr" filesystem for "/usrfoo").

Task-number: QTBUG-49498
Change-Id: I3e15a26e0e424169ac2bffff1417b7a27cd0132d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-05-09 06:04:21 +00:00
Thiago Macieira
fe23db053a Add an autotest for the QtDBus message spy hook
There's exactly one application that needs this functionality (kded/
kiod), but we should test it too.

Change-Id: Icaa7fb2a490246bda156ffff143d210c6f5f207f
Reviewed-by: David Faure <david.faure@kdab.com>
2016-05-09 05:31:11 +00:00
Thiago Macieira
8de2986a42 tst_QDBusMarshall: make sure we compile on linked, old dbus
If we're linking to libdbus-1, qdbus_symbols_p.h #includes dbus/dbus.h,
which may be old and not #define the Unix FD macros. tst_QDBusMarshall
had the definition for one of the macros but not the other, so add the
missing second one.

Change-Id: Id69569111e7d4e619e22ffff144c35edcd6f348b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-05-09 05:30:43 +00:00
Vyacheslav Grigoryev
558718ff44 QTableView: Fix selection for reordered or hidden rows/columns
The old code sometimes made incorrect selections when rows or columns were
hidden or moved. It used logical top left and bottom right indexes to create a
selection rectangle. However on moved or hidden cells a wrong rectangle was
made. This fix calculates a simple rectangle without hidden cells and makes use
of the row/column select functionality provided by the selection model, to make
the right selection.

[ChangeLog][QtWidgets][QTableView] Fixed a selection bug when rows or columns were hidden (QTBUG-50171)

Task-number: QTBUG-50171
Change-Id: Id186012af26da7b2051ff5eb1c13e6b7494cca77
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2016-05-09 05:14:38 +00:00
Thiago Macieira
194a56ea79 QTest: Fix printing of values of Q_ENUMs
QMetaEnum::key(n) returns the n-th key, which is not necessarily the one
of value n. For the key of value n, we want QMetaEnum::valueToKey(n).

Change-Id: Ic90fe6b1cbe84978a02fffff141bf4a06074917a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-08 08:57:16 +00:00
Thiago Macieira
e1d0da6526 Fix Clang -Wexpansion-to-defined warning by deprecating QT_SUPPORTS
The C and C++ standards say it's undefined whether the preprocessor
supports macros that expand to defined() will operate as an ifdef.
Clang 3.9 started complaining about that fact.

One solution was to change QT_SUPPORTS to check for zero or one, which
means we need to change the #defines QT_NO_xxx to #define QT_NO_xxx 1.
The C standard says we don't need to #define to 0, as an unknown token
is interpreted as zero. However, that might produce a warning (GCC with
-Wundef), so changing the macro this way is not recommended.

Instead, we deprecate the macro and replace the uses with #ifdef/ndef.

Change-Id: Id75834dab9ed466e94c7ffff1444874d5680b96a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-05-08 04:25:27 +00:00
Timur Pocheptsov
11ad50074b tst_qudpsocket - remove insignificant
BLACKLIST should make it, recent regression in QUdpSocket went unnoticed
(first) because of 'insignificant'. We'd like to avoid such regressions
in future (again, using BLACKLIST if needed and fixig the real problem then).

NB: BLACKLIST in this patch was extended to deal with previously unnoticed failures on
Windows and OS X. 'multicast' and related family of of functions on OS X
will probably stay like this (seems to be a Darwin's quirk), datagram
size related tests - fixed in dev or 5.7 (change is in nativesocket engine,
'bytesAvailable').

Task-number: QTBUG-52714
Change-Id: I039b05935a02983ce1648de449907dfa765f7db7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-05-06 11:59:03 +00:00
Timur Pocheptsov
88c4388022 tst_QWidget: make it stable on OS X
This patch QSKIPs all tests that:
- take to much time sitting in some QTRY_VERIFY or similar before failing
- result in 'not in fullscreen mode' warning (with PASS) - thus completely flaky.
- Where previously determined to not apply to OS X using QT_OS_MAC

The intent is to make the test run-time more reasonable,
both when running the test locally and on the CI system.

Reduce the BLACKLIST - to avoid a 'double elimination' the tests that are skipped now,
should not be BLACKLISTed so that we fix them for good.

Task-number: QTBUG-52974
Change-Id: I34dc2010d0debc6b5b99f2375a6da902b7a17b29
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-05-06 09:07:51 +00:00
Friedemann Kleint
728a1b4f29 tst_QKeyEvent::modifiers(): Ensure test data row names are pure ASCII.
The test used to output random character sequences which contained
terminal control characters. Change it to output plain ASCII and
Unicode syntax for non-ASCII characters.

Change-Id: Ifaa72f50242bd27416a8698a1f5152bc8b902898
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-05-04 13:06:37 +00:00
Morten Johan Sørvig
dec0b15685 Change Q_OS_MAC -> Q_OS_OSX
Q_OS_DARWIN is the general replacement for Q_OS_MAC,
but most/all of the MAC sections in this test are
OS X specific.

Change-Id: Ic54af9d3dce1e1952a57e15b74acdedf2af60c79
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-04 11:23:16 +00:00
Morten Johan Sørvig
2c60125ef9 Add missing Q_DECL_OVERRIDEs
Change-Id: I54552d9fdd0bc8871247246aea1da14848c4f7a0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-04 11:23:03 +00:00
Friedemann Kleint
54781edbaa Manual touch test: Add color for Qt::MouseEventSynthesizedByApplication.
Fix a warning about a missing case statement.

Change-Id: Ic89646704d62668cf83c463dbf6e9b549a4b5200
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-05-04 09:50:50 +00:00
Jędrzej Nowacki
67509693bd Improve tst_qtimeline::setPaused resilience
The test should not depend on qWait explicitly

Change-Id: I13c01c47c9f7bae8b0c30afa2ac8550dc0fbf028
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
2016-05-04 09:26:57 +00:00
Friedemann Kleint
22a7edd816 tst_QTcpSocket, tst_QUdpSocket: Improve diagnostics.
Add more error messages on failures.

Task-number: QTBUG-25367
Task-number: QTBUG-25368
Change-Id: I064143a058b7b98d9d5eecab8b5da49f5307e1eb
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-05-02 19:20:33 +00:00
Oswald Buddenhagen
be6a92ec09 remove redundant OTHER_FILES assignments
newer versions of qt creator understand QMAKE_EXTRA_COMPILERS and
INSTALLS, so there is no need to list the files twice.

Change-Id: Iccf3cc3248daf3422b8c366c2eb2d2f46c5f08d1
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-02 18:34:47 +00:00
Alex Trotsenko
a4d26cf522 QWindowsPipeWriter: ensure validity of the write buffer
QWindowsPipeWriter uses asynchronous API to perform writing. Once a cycle
has been started, the write buffer must remain valid until the write
operation is completed.

To avoid data corruption and possibly undefined behavior, this patch
makes QWindowsPipeWriter::write() take a QByteArray, which it keeps alive
for the duration of the write cycle.

Autotest-by: Thomas Hartmann
Task-number: QTBUG-52401
Change-Id: Ia35faee735c4e684267daa1f6bd689512b670cd2
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-04-30 13:13:26 +00:00
Allan Sandfeld Jensen
002112e805 Fix scroll regression near scroll-view ends
Fix regression in a7b0cb467c which caused
it to be hard to start scrolling at the ends of a scroll-view if using
fine grained scrolling events.

Change-Id: I55f3210150b993281545c3ad5a7356d892fa30b5
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-04-29 10:25:45 +00:00
Friedemann Kleint
91f536dd71 tst_QMdiArea::subWindowActivated2(): Add activateWindow().
The widget is hidden, reshown and tested for active window, which
is flaky. Add a call to activateWindow() which increases
the chances of it becoming the active window should another window
appear.

Change-Id: Ibbecdbc43e2ac9638aec497c47fffaaffa1855af
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-04-29 08:58:15 +00:00
Thiago Macieira
ab2f768a8f Autotest: fix the QTimeZone::tzTest failure when database contains LMT
On some operating systems, tzdata files carry the Local Mean Time (LMT)
for the city in question, which better represents how time was tracked
before standard, hourly timezones were introduced in the early 20th
century. The test was asking for the data for 1653-02-09 and assumed
that it would find the first Central European Time (CET) rule, which
Germany didn't start using until 1893-04-01.

This fix allows us to remove the blacklist that had been applied to this
test without investigation. It wasn't related to OpenSUSE, aside from
the fact that OpenSUSE tzdata carries the LMT data.

Change-Id: Id5480807d25e49e78b79ffff1449bdaf46901367
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2016-04-29 08:23:11 +00:00
Kai Pastor
8c2b7405b4 QPdf: Force miter limit into valid range
Miter limits below 1.0 are not valid in PDF and trigger an error in the
Reader. This change enforces a minimum miter limit of 1.0, and it adds
a manual test for producing a PDF file demonstrating this issue.

Task-number: QTBUG-52641
Change-Id: I1c78b1c4a44579e95e1cddfb459926d304e60165
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-28 20:10:17 +00:00
Weng Xuetian
9be4ee5202 QtDBus: finish all pending call with error if disconnected
libdbus will send a local signal if connection gets disconnected. When
this happens, end all pending calls with QDBusError::Disconnected.

Task-number: QTBUG-51649
Change-Id: I5c7d2a468bb5da746d0c0e53e458c1e376f186a9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-04-28 05:38:10 +00:00
Thiago Macieira
adac71c044 tst_compiler: Expand the attribute test
This is not exhaustive, but was enough to discover ICEs.

Change-Id: Ib60be1d298a66b72e3eb9b75ad538f0bf15b5f62
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Simo Fält <simo.falt@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-04-28 02:45:49 +00:00
Friedemann Kleint
3a8f895d35 tst_QWidget/XCB: Use bottom/right corner of screen as safe cursor position.
Pushing the mouse rapidly to the top left corner causes KDE / KWin to
switch to "Present all Windows" (Ctrl+F9) mode, showing all windows.
This has been observed to be triggered programmatically by
QCursor::setPos(0, 0) if there is no other window beneath and apparently
depending on the perceived mouse "speed".
Suppress this by using the bottom right corner for XCB.

Change-Id: Id18d2f45a095ed4d4f365f010cf45a20b0d9435e
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
2016-04-26 13:12:16 +00:00
Shawn Rutledge
3d5e9a0ba1 Tablet device_information manual test: show wheel events received
We have a bug that proximity events are generating them spuriously;
this is a way of testing it.

Task-number: QTBUG-52921
Change-Id: I490dfcf8d5b325f612b733e29fd49de9418bb19e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-04-26 13:10:52 +00:00
David Faure
16fa29352b QMimeDatabase: fix mimeTypeForUrl for mailto URLs
The "path" of a mailto URL isn't a file, so we shouldn't try to do
glob-based matching. I was getting application/x-ms-dos-executable
for a .com domain and application/x-perl for a .pl domain...

Change-Id: Ifc346c3bba83ba1a8476db3202492f4c2e4d52bb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-04-23 08:44:45 +00:00
Friedemann Kleint
84a49594d0 Windows/tst_QTcpServer: Suppress crash notification of crashingServer.
Suppress message dialog of the test helper as does QTestlib.

Task-number: QTBUG-52714
Change-Id: I5efd7d72f77c7689500ecaccf46f1f9dfb312140
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-04-23 06:09:44 +00:00
Alexander Volkov
e27fae353c QFileSystemModel: fix updating QFileInfo for a node after a file rename
Use the correct parent path for the renamed file when creating
QFileInfo. It must be a path to the parent directory, not to the
root directory of the model.

Modify tst_QFileSystemModel::setData() to test renames in subdirs
of the root directory of the model.

Change-Id: I69d9e3a937616857a81617791ed118af3f6eea05
Task-number: QTBUG-52561
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-22 09:49:53 +00:00
Friedemann Kleint
ccfe33dc67 QWidget::grab(): Use device pixel ratio.
Return pixmaps with device pixel ratio similar to QScreen::grabWindow(),
cf c0963486ce.
Adapt kernel tests accordingly.

Task-number: QTBUG-52137
Change-Id: I9ce276d5e2d87ae0d39c8639267d1ac283fed854
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-04-22 06:31:10 +00:00
Vyacheslav Grigoryev
072485048f QHeaderView: fixing selection of reordered rows and columns
The old code incorrectly calculated visual region for a selection (specified by
QItemSelection object) in case of reordered / swapped rows or columns. It used
the leftmost and rightmost (upmost and downmost for vertical mode) logical
indexes directly. However some middle logical index (in case of reorder) may be
the leftmost or rightmost visual index. In such cases the repainting didn't
work properly. This fix first checks whether reordering / swapping is in use.
If it isn't (ie visual=logical) we use code similar to the old code. Otherwise
the new code scans all selected logical indexes, translates them into visual
ones and gets the correct leftmost and rightmost indexes.

[ChangeLog][QtWidgets][QHeaderView] Fixed a repainting issue when items had been reordered.

Task-number: QTBUG-50171
Change-Id: If6afabebf445cf32a8e0afe262b6ee149e7c4b2b
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
2016-04-21 21:13:38 +00:00
Friedemann Kleint
5386a35d35 Add a manual styles test.
Task-number: QTBUG-49374
Task-number: QTBUG-52622
Change-Id: Ic205590725780147aec3abc0f4be2058d001d358
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-04-20 11:35:48 +00:00
Friedemann Kleint
daebbcf5f4 Manual test qcursorhighdpi: Add drag and drop.
Add dragging functionality to the labels showing a pixmap
cursor, allowing for testing DnD with pixmaps with device pixel ratio.

Task-number: QTBUG-46068
Task-number: QTBUG-50938
Change-Id: If6781f380864e614efd4328e8b880b57cd900511
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-04-15 12:12:53 +00:00
Thiago Macieira
77fb9ca271 Fix encoding of IDN hostnames with QUrl::host
When the formatting parameter wasn't exactly QUrl::EncodeUnicode, it
wouldn't encode, despite having to.

Change-Id: Id75834dab9ed466e94c7ffff1444bacc08dd109b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
2016-04-13 22:08:26 +00:00
Thiago Macieira
7ab0829823 Fix parsing of empty port sections in URLs
The RFC does allow it. It even has examples showing them as valid. In
section 6.2.3, it shows:

      http://example.com
      http://example.com/
      http://example.com:/
      http://example.com:80/

Change-Id: Id75834dab9ed466e94c7ffff1444b7195ad21cab
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-04-13 22:08:22 +00:00
Olivier Goffart
dbe9a8c969 Don't copy the functor object for each signal emission
The behavior was different in the variadic template code and in the C++98
code. The code without variadic template support was not copying the functor
object (e.g. a lambda) before calling it.
However, in the variadic template section, QtPrivate::FunctorCall::call
took the functor by value instead of by reference resulting in a copy.

QtPrivate::FunctorCall::call is a helper function for
QtPrivate::FunctionPointer::call which is only needed for variadic template
expension.

[ChangeLog][QtCore][QObject] If the compiler supports variadic templates,
no longer copy functor connected to a signal each time the signal is
emitted. Restoring the C++98 behavior.

Task-number: QTBUG-52542
Change-Id: I3ca20ef6910893b8a288e70af7de4c7b69502173
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-04-13 09:35:13 +00:00
Edward Welbourne
541c9d4d2a tst_QNetworkReply: Commentary fixes on test server workarounds.
Follow-up to commit 6fd205d5: document which version of danted shall
make one work-around redundant, document that another work-around is
still needed even with that v1.1.19; and remove a comment that
referred back to an XFAIL that commit 6fd205d5 removed.

Change-Id: I270b662528127c82184bff20b3cecea4f0c41b41
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-04-12 13:51:58 +00:00
Edward Welbourne
949aaffb4f tst_QNetworkReply: fix mis-guided use of QSKIP().
QSKIP() causes the whole test to be skipped, where this work-around
for a known quirk of the test server only requires skipping a single
Q_COMPARE(); the rest of the test passes fine without it.

Change-Id: Ie4612bd428f4cb4b342fad908cc2784fbadf069c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-04-12 13:25:30 +00:00
Jesus Fernandez
0f7171f290 Better error message when trying to load an invalid resource
Before this change QFile::errorString function was returning an
"Unknown error". Now it will return the typical ENOENT string.

Task-number: QTBUG-45259
Change-Id: Ib7634f1aa5d91f77151cf92c58d3956e20a4cc6b
Reviewed-by: hjk <hjk@theqtcompany.com>
2016-04-12 10:18:57 +00:00
Joerg Bornemann
7b4c02d527 Fix finding a helper executable in tst_QLocalSocket
Use QFINDTESTDATA to find the socketprocess helper executable.
Now tst_QLocalSocket::processConnection() passes when started from Qt
Creator without adjusting the working directory.

Change-Id: I97ca3334a381b3cd646647487529bcd90b969528
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-04-11 10:47:26 +00:00
David Faure
b6eea89b67 Fix crash when using QLockFile in a global destructor
(for instance any global object which writes out to a config file in the
destructor). If the global cache isn't available anymore, don't use it.

Change-Id: I851a6e394d0b073aebf3ffd88b1966d424bfb92e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-10 07:37:51 +00:00
Thiago Macieira
8c427e5bdf Autotest: confirm that QHostAddress obeys RFC 5952 recommendations
Change-Id: I0c94a5c2846b48c8aea7ffff1435b8a7ccbd4d9e
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
2016-04-09 05:16:40 +00:00
Alexander Grishkov
f39e542eb8 Fix parsing of IPv4 addresses with certain symbols
Add some extra checks to the parser to make sure that addresses
like "300-05" aren't interpreted as valid IPv4 addresses.

Change-Id: I12475eebc9452e060779bb05e2b4ad9512a28281
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-08 15:09:50 +00:00
Liang Qi
8e103902de tests: fix tst_QFontComboBox on OS X
After 909d3f5c7, private families will not be shown in user interface.

Task-number: QTBUG-41318
Change-Id: I15ae77cacd2a27c9db4b1a8ffbb582416258988c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-04-08 15:02:58 +00:00
Shawn Rutledge
3c08035b7b QScreen manual test: add MouseMonitor to test multi-screen scenarios
- QMouseEvent::screenPos() should be global desktop position
- QDesktopWidget::screenNumber() should tell the correct screen
- QGuiApplication::topLevelAt(screenPos) should find the window where
  the mouse is clicked

Change-Id: I9a63ab3ee1944b7246551d0f3d5e37f0d2aa5457
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-04-08 14:49:59 +00:00
Rolland Dudemaine
2b09d371eb Resolve build failure in network stress tests.
strncmp() needs 3 arguments, not 2.

Change-Id: Ia7077108a533321d5218cc35fd78ada8863f8200
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-07 07:22:54 +00:00
Marc Mutz
f72152381b tst_QStringBuilder: add a check for self-assignment
Change-Id: I78094146bf534163af12d6e265276d987d5ce994
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-07 07:02:38 +00:00
Friedemann Kleint
d37239aa41 QFtp: Use UTF-8 encoding.
According to RFC 2640, FTP uses UTF-8 encoding. Fix the conversions
accordingly.

Task-number: QTBUG-52303
Change-Id: I615199b3d074fc3861f25df113dda672525766b6
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-04-07 04:25:57 +00:00
Friedemann Kleint
2a282551ac Remove empty first lines of files.
They might upset licensing related tools.

Change-Id: I858d21fc418ba16959c88847b559b11bea29ed6b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-06 18:26:26 +00:00
Hannah von Reth
1726352207 Make sure QStyleOption is correctly initialized.
Ensures that QStyleOption is correctly initialized.
This prevents possible styling issues due to
QStyleOption's reporting version 0, see qstyleoption_cast.
This enables users to handle more cases in their QProxyStyle.
For now the test is only used for QCommonStyle.

Change-Id: I768db00b12b46890343fffe44e4f562762e9cf80
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-05 20:32:26 +00:00
Marc Mutz
284016c7e6 network-settings.h: don't crash when running without the test server
Don't access first() of a potentially-empty QList.
Check for QHostInfo::error() first.

Also change to constFirst() to prevent a detach.

Change-Id: I91fa0bbfb21f62af29abdb23b4869a7f039b259e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-05 06:52:39 +00:00
Stephen Kelly
bedf0367ac QVariant: Fix flags for type-erased associative iterator key
The flags here are passed to a private QVariant constructor, and they
really represent a boolean - IsPointer or not.

Because the flag for the key_type was incorrectly populated with the
flag for the value_type, memory would be corrupted when using a mapping
type whose value_type is a pointer, but whose key type was not, such as

  QMap<QString, int*>

This typo has been there since the concept was introduced in commit
v5.2.0-alpha1~807 (Add container access functionality for associative
containers in QVariant., 2013-04-05).

Task-number: QTBUG-52246
Change-Id: I9ecb13c603015eed2dc2ca43947fa0ecd6be8b5a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-03 10:58:12 +00:00
Kai Pastor
f805d7075a Fix QtGui dependencies in tests/benchmarks
Before this change, -no-gui builds failed already while running qmake.

Change-Id: I3e300a16669371098589822806c5cf8aa9b801c7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-01 20:24:04 +00:00
Marc Mutz
b7c7beacda QPointer: add a test for const QPointer<X>
People use this, so make sure there's a test for it.

I don't expect this test to fail, but static and
dynamic checkers should be presented with this
use-case, so they have a chance of warning, because
certain implementation strategies of QPointer may
make this code undefined.

Change-Id: I334bd73204ba4e186c4098fc6b7188917407e020
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-04-01 18:57:25 +00:00
Simo Fält
f44d826751 Autotest: Remove blacklistings
Removing blacklistings from tests that are now passing.

Change-Id: I00aa1ce286d3e7715fb4bee4a36d0d77049a29ae
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-04-01 05:41:21 +00:00
Eirik Aavitsland
ea122fa9e3 Fixup for text labels in lancelot graphics test
Some strings were drawn with a different size or scaling than what the
string itself said, causing confusion.

Change-Id: I4b187cba6d467cfa0900576bdf451052baa806e6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-31 10:27:39 +00:00
Joerg Bornemann
479ee4fa46 moc: bail out early on missing or invalid options file
If moc is invoked with the @ argument and no options file is specified
or the options file cannot be read, do not try to parse the empty
arguments list. Otherwise QCommandLineParser will print an additional
error message that is of no value for the user.

Task-number: QTBUG-51847
Change-Id: I9aa1eb20a44097b553123be8bc6fded87473a03a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-31 08:57:39 +00:00
Eskil Abrahamsen Blomfeldt
a4e2f2e687 Fix possible crash in QImage::pixel()
QImage::pixel() assumed that the color table was valid
for the values in the bitmap. This was always wrong
for indexed images with explicit no color table set and
was wrong for mono images that were constructed from
preexisting data.

For mono images, we default to a black/white color table,
like we do when constructing with uninitialized data.

For indexed image, we always default to no color table,
but instead of crashing in pixel(), we warn and return
an undefined value.

[ChangeLog][QtGui][Image] Fixed possible crash in QImage::pixel()
for mono or indexed images.

Change-Id: Ieaf19c03984badddfd06e1855a7e287b862adc70
Task-number: QTBUG-50745
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2016-03-31 08:54:03 +00:00
Kai Pastor
9bc352e38d Enable cmake auto tests for -no-gui
This change disables tests which require QtGui.

Change-Id: Ib647afd086f54536054cb4c0cde5696d762ee8c4
Reviewed-by: Stephen Kelly <steveire@gmail.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2016-03-30 07:16:50 +00:00
Friedemann Kleint
086317d72a QTextEdit::inputMethodQuery(): Preserve types when applying offset.
The old code converted QRectF into QRect when applying the offset. Change
the offset point to QPointF and change the conversions accordingly. Add an
autotest similar to that of QPlainTextEdit.

This minimizes rounding errors and prevents conversions since
the input method logic mostly uses qreal.

Task-number: QTBUG-51923
Change-Id: I0c2f80ccae028d8bbbb97ec603f8782f69959c76
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-03-30 07:12:57 +00:00
Błażej Szczygieł
88fae806a8 QtWidgets: Add autotests for Qt::WA_OutsideWSRange flag
Task-number: QTBUG-48321
Task-number: QTBUG-49445
Task-number: QTBUG-51788
Change-Id: I6c04919ff788cad684df69d0aee73d86fd985bb9
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-03-29 12:06:10 +00:00
Friedemann Kleint
b169b5a4f3 QPlainTextEdit: Take vertical offset into account when answering input method queries.
Determine offset point to similar to QTextEdit::inputMethodQuery()
and add an autotest.

Task-number: QTBUG-51923
Change-Id: I8232eb348063e2cd95d0632fe74a6eb30c897eda
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-03-29 11:10:27 +00:00
Edward Welbourne
717724b17a Purge sRGB chunks from PNGs in tests.
Subjects each *.png file that matched grep -law "sRGB" to:
pngcrush -ow -brute -rem allb -reduce
(Two needed -force but did get smaller.)

Change-Id: Ia030f0bc1d3617ba716bcc26677ff919ef58423c
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-03-29 08:39:43 +00:00
Hannah von Reth
f64640f441 Allow to style arrows drawn with drawPrimitive in QCommonStyle.
Its currently not possible to style the arrows with QCommonStyle because
drawPrimitive from QCommonStyle is called instead from the proxy.

Change-Id: I910b13df110601cb18578bc16edfa5ddaa17bbd2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-25 16:31:31 +00:00
M. Moellney
705d29585b Fix qSetMessagePattern to have many time/backtrace parts
The previous implementation overwrote multiple 'time' parts in the
qSetMessagePattern with the last setting in the pattern line.
%{time}%{time process}%{time boot} ended up to be output as if
%{time boot}%{time boot}%{time boot} was set.

This fix keeps the arguments of each individual 'time' part.

The same holds for multiple 'backtrace' parts. The previouse
implementation overwrote multiple 'backtrace' arguments with the
arguments of the last occurrence.

This fix keeps the individual arguments for the 'process' parts.

The individual arguments are applied in qFormatLogMessage.

A new test to verify the individual 'time' arguments application
is added, too.

Task-number: QTBUG-51944
Change-Id: Ib757614a482c5f31ed0a61b550daa2eea4b907b4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-25 11:03:43 +00:00
Joerg Bornemann
1534297323 Update comment in tst_QLocalSocket::readBufferOverflow
QWindowsPipeWriter doesn't write in a separate thread
anymore.

Change-Id: Id978bfdfa2531be91cce94476ab9b0dff237bd61
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2016-03-24 20:35:18 +00:00
Marc Mutz
aedda12ef1 tst_QAtomicInteger: fix UBs (signed overflow)
Drop addSub() test. It executes exactly the union of fetchAndAdd()
and fetchAndSub(), which have already had their UBs fixed.

No need to do fixes in duplicated code.

Change-Id: Ib72caab0310fce3ff9a40c261d8a38518f91ecaf
Reviewed-by: David Faure <david.faure@kdab.com>
2016-03-24 16:16:15 +00:00
Joerg Bornemann
24411e9743 Add a write buffer to QLocalSocket/Win
Commit 0307c008 removed the buffering of data-to-be-written from
QWindowsPipeWriter, because it was assumed that users of this class
(QProcess and QLocalSocket) already buffer data internally.

This assumption was wrong for QLocalSocket. The following sequence
    localSocket->write(someData);
    localSocket->write(someMoreData);
would not write anything on the second write.

Add a write buffer to the Windows implementation of QLocalSocket.

Task-number: QTBUG-52073
Change-Id: I6d0f03a722ec48138cbde3e2f69aae7dafe790d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-24 16:12:46 +00:00
Giuseppe D'Angelo
4ca7785161 QAbstractItemView test: check that the selection model is in sync with the view
Change-Id: Ifca91154b47184a9d9a1979e1fba471517e16698
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-03-23 22:10:07 +00:00
Giuseppe D'Angelo
fce83bd9f8 QAbstractItemView: trigger handlers (and redraw) when changing selection model
The most visible problem is that changing selection model didn't update()
the view, resulting in the old selection/current item still being drawn.
In general trigger the handlers for when the selection/current item
changes.

Change-Id: Ib3b2ad70412e6a21a182d4c173e617710bcc630d
Task-number: QTBUG-50535
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-03-23 15:12:04 +00:00
Marko Kangas
1bbbb682b5 Initialize input method for read-only QTextBrowser
Set input method attribute to be aligned with read-only
value in QTextBrowser initialization

Task-number: QTBUG-52071
Change-Id: If0e64bf09e2a2d505ed66fcbfb8cd12ae39844d3
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-03-23 09:46:24 +00:00
Kai Pastor
4ccfb1eb92 Fix tests for build with -no-gui
Change-Id: I48d5452daeaf3490ed7a5b8c30953da019bb33af
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
2016-03-23 06:52:46 +00:00
James McDonnell
005a8bfbf0 Remove QPROCESS_USE_SPAWN and all that it surrounds
The spawn code was only used to make QProcess work on QNX 6.5.0.  Fork
works on QNX 6.6.0.  The QNX spawn implementation has a flaw that causes
a deadlock in certain situations.  When a working directory is specified
for the process, the QNX spawn implementation stops all threads except
the one doing the spawn so that it can temporarily change the process'
working directory.  This can lead to a deadlock if the thread does
anything that conficts with something being done in a stopped thread.
QNX 6.5.0 is no longer supported in Qt 5.6.0 so we can just switch QNX
to the fork implementation and get rid of the spawn implementation.

Made a QNX specific adjustment to the hardExit test.  There's a bug
in the OS that the test can run into because it does something that
normal applications wouldn't.

Task-number: QTBUG-47250
Change-Id: Ib32567d2c15ce651815858000035ac5aa6f35224
Reviewed-by: Dan Cape <dcape@qnx.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2016-03-22 15:20:06 +00:00
Gabriel de Dietrich
e342a2e05f Add auto-test for crash in QCocoaBackingStore
This issue has been solved some time between 5.6 and 5.6.0.
We just make sure to protect against further regressions.

Change-Id: Ic3fdad901ed5f36792ae04b3d65047da95eea668
Task-number: QTBUG-50561
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-21 08:36:41 +00:00
Stephen Kelly
6ec89bec0a Fix QFINDTESTDATA when using cmake ninja generator
The Qt CI does not have ninja, but the autotest can be used for manual
regression finding.

 cd qtbase/tests/auto/cmake
 qmake
 make check
 cd build
 cmake . -DHAVE_NINJA=ON
 ctest -R FINDTESTDATA

Change-Id: Ic3f3748f6ab04e37fa5287c59486e5cd46dcabb4
Reviewed-by: Stephen Kelly <steveire@gmail.com>
2016-03-19 13:44:21 +00:00
Friedemann Kleint
ca4c33a886 Manual High DPI test: Create Dnd pixmap with device pixel ratio.
Apply the device pixel ratio from the widget unless Shift is pressed.

Task-number: QTBUG-46068
Task-number: QTBUG-50938
Change-Id: Ib806b7e545fa228043566800d22d1002728732bf
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-03-16 14:40:15 +00:00
Maurice Kalinowski
e7cd32274e WinRT: Fix QTimeZone transitions by switching backend
Previously WinRT was using the UTC backend which fails on all platforms
for some QDateTime autotests related to timezone items. Hence switch to
the Windows implementation for WinRT as well.

However, the windows backend does query the registry heavily, which is
not supported on WinRT. Instead use the API version provided by the SDK.

Long-term we might want to switch to this version on desktop windows as
well, as direct registry access would not be required and we could
harmonize the codepaths for both platforms.

Change-Id: I620b614e9994aa77b531e5c34c9be1da7e272a30
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-16 10:30:26 +00:00
Friedemann Kleint
9c3c350627 Manual High DPI test: Add test for window masks.
Add a toggle for setting a triangular mask on the main window.

Task-number: QTBUG-50938
Change-Id: Id4a3ee0b80e170f4ee1d195e60ce7bfa8e524359
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-03-16 09:19:59 +00:00
Maurice Kalinowski
e830fa8fc2 tst_QXmlStream::writerHangs(): Create file in temporary directory
A test should not write to its directory.

Change-Id: I34dfc36387cf5a637b325be29c8a19ff51d9b9c3
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-16 08:15:59 +00:00
Maurice Kalinowski
eef3afaa97 QTextStream test: Change current directory
For platforms with builtin testdata/sandboxed platforms we need to
change the current directory to be able to create files.

Change-Id: I440205c95dd6df1308c6bf24b1b0f67fd697feab
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-16 08:16:03 +00:00
Milla Pohjanheimo
e363817498 tst_qtabbar sizeHints fix
tst_qtabbar uses fixed values to check the minimumSizeHint and it fails
with screens that have a higher resolution. The test still uses the
default values, but now in the beginning it creates enough tabs so that
it goes over the default.

Change-Id: I3f891d2661288d7fad50ad522d73f634b3e91958
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-03-16 07:39:22 +00:00
Marc Mutz
e4c6d73f92 QRect: fix UB (int overflow) in center()
QRect::center() should be defined for any
  QRect(x1,y1,x2,x2), INT_MIN <= x1, x2, y1, y2 <= INT_MAX
because the average of two signed integers is always
representable as a signed integer.

But not when it's calculated as (x1+x2)/2, since that
expression overflows when x1 > INT_MAX - x2.

Instead of playing games with Hacker's Delight-style
expressions, or use Google's patented algorithm, which
requires two divisions, take advantage of the fact that
int is not intmax_t and perform the calculation in the
qint64 domain. The cast back to int is always well-
defined since, as mentioned, the result is always
representable in an int.

Fix a test-case that expected a nonsensical result due
to overflow.

[ChangeLog][QtCore][QRect] Fixed integer overflow in
center(). This fixes the result for some corner-cases
like a 1x1 rectangle at (INT_MIN, INT_MIN), for which
the previous implementation could return anything
(due to invoking undefined behavior), but commonly
returned (0, 0).

Change-Id: I1a885ca6dff770327dd31655c3eb473fcfeb8878
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 11:23:46 +00:00
Marc Mutz
5784c064a9 tst_QRect: drop a test that depends on int overflow
The compiler can statically check that this is undefined
behavior:

  tst_qrect.cpp:3173:52: warning: integer overflow in expression [-Woverflow]
               << QRect(QPoint(0,0), QPoint(INT_MAX+(0-INT_MIN),INT_MAX+(0-INT_MIN)));
                                                   ~^~
  tst_qrect.cpp:3173:72: warning: integer overflow in expression [-Woverflow]
               << QRect(QPoint(0,0), QPoint(INT_MAX+(0-INT_MIN),INT_MAX+(0-INT_MIN)));
                                                                       ~^~

Fix by skipping the test (like most of the others are
in the block).

Change-Id: I359a5e16db6c660c9f11d7dd8fbb40730bd63887
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 10:39:38 +00:00
Marc Mutz
add95c5510 tst_QSqlQuery: fix UBs (invalid downcasts, member calls)
The existing code derived a helper class from QSqlResult and
overloaded two protected functions as public ones so the test
could call them after casting QSqlResults to that helper class.

Both the cast (which is a C-style cast, but with combined
static_cast and const_cast semanics) and the following member
function call are undefined behavior.

Fix by making the test class a friend of QSqlResult, and
dropping the casts.

Change-Id: I09de2e2b46976d01cfce25892aec6ad36881d3eb
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2016-03-15 10:39:20 +00:00
Milla Pohjanheimo
1a9e1fbbfc Remove restoreDockWidget from BLACKLIST
Tested on the Ubuntu 14.04 VM. The test didn't fail anymore with
2000 test rounds

Change-Id: Ic12c60e5ebf9c234358a6983bf87fa0a88d7886e
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-03-15 09:41:09 +00:00
Friedemann Kleint
514c202da9 Add a manual test for foreign windows.
Add a command line tool that can either take a list of window ids and output
information on them using a verbose debug stream or embed foreign
windows using QWidget::createWindowContainer().

Task-number: QTBUG-41186
Change-Id: I14e436b5d08828f5b78b29e0701daeffe11367d3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-03-11 16:03:34 +00:00
Friedemann Kleint
a8c72b7671 tst_QTextStream::textModeOnEmptyRead(): Create file in temporary directory.
A test should not write to its directory. Amends change
d0b54cede8.

Task-number: QTBUG-47176
Change-Id: If15258b4aed199792fab422b7ac1d74e22a9e322
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-03-11 11:26:14 +00:00
Maurice Kalinowski
71a36d0b65 Disable tests requiring shared build when compiling statically
Change-Id: I06ec53e46d2f61f1685899b0f8a4d385051095d6
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-11 08:30:27 +00:00
Joerg Bornemann
ac8dae8b5e QLocalServer/Win: Fix race condition in listen().
Suppose a client connects while the QLocalServer is still in the loop
that calls addListener. The connection would SetEvent(eventHandle),
but every call to ConnectNamedPipe would ResetEvent(eventHandle).
Thus, the connection is never detected by the notifier on eventHandle.
  Callers of addListener must check the connection state of every
listener to make sure that no client connected while setting up
listeners.

Task-number: QTBUG-49254
Change-Id: Ia961927ea76973708e6e3f73510695eb5d6a0e4c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 17:32:49 +00:00
Allan Sandfeld Jensen
8589bb334f Enable most of tst_qstatictext on non-developer builds
Only two tests inside tst_qstatictext required private symbols, so
we can enable the rest on all builds.

Change-Id: Id222ba01d9676c40b6447c1526ee127fcc2090d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 15:45:41 +00:00
Joerg Bornemann
39efe3c84d Fix glitch in tst_QLocalSocket::sendData
In one code path the test checked for the emission of a readyRead()
signal without waiting for it.
This code path was never hit, neither on Windows nor on Unix platforms.

Change-Id: Ifbe464400a2a1ba8eab49bd60315289040e6bbde
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-03-10 15:03:37 +00:00
Friedemann Kleint
45dc347a95 tst_QStaticText: Output verbose message for test failures.
Factor out function to check on the pixel color that
outputs a verbose message on failure.

Change-Id: I2331fe45f35327d1ff8ae547a58d93a2e6fe9184
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-10 12:37:47 +00:00
Marc Mutz
f647375275 Fix signed integer overflows in tst_QAtomicInteger
Signed integer overflows and underflows are undefined
behavior. A test that invokes UB tests nothing, because
the standard permits any outcome.

Fix by guarding the respective operations so
they are not executed if they would overflow
or underflow.

Change-Id: I40354ee88f40e4b47b70eac7790dc3a79ac70a57
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-10 07:17:55 +00:00
Marc Mutz
2020d2cb63 QObject: fix GCC 6 warning about qt_static_metacall's 'hidden' attribute use
This warning is triggered when we try to apply the Q_DECL_HIDDEN
attribute to a class in an unnamed namespace. Such classes are
already not exported.

  qobjectdefs.h:175:108: warning: ‘visibility’ attribute ignored [-Wattributes]
  qobjectdefs.h:198:108: warning: ‘visibility’ attribute ignored [-Wattributes]

Added a test on gadgets (and QObjects) in unnamed namespaces,
because qtbase currently does not contain such Q_GADGETs.

Done-with: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Ic747cc2ab45e4dc6bb70ffff1438c747b05c5672
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-09 20:11:28 +00:00
Dyami Caliri
f8f1bac3f0 Accept LFCRLF to mark end of HTTP Headers
Some embedded servers use LF to mark the end of an individual header,
but use CRLF to mark the end of all the headers. The GoPro WiFi
interface does this, as an example.

Change-Id: I227ab73622c84f439a6cf8703d020393c4d8bf69
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-03-09 15:47:18 +00:00
Friedemann Kleint
d29443c9c8 Manual touch test: Remove QDebug operator for QTouchDevice.
It now exists in QtGui.

Task-number: QTBUG-48849
Change-Id: I9107c96e0010252bc50bcb02ef006cb46bd942df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-09 14:26:04 +00:00
Jarek Kobus
cb24903ef4 Generate QVariant::fromValue(enum_value) for enum values
Instead of just QVariant(enum_value).

Task-number: QTBUG-49383
Change-Id: Id57c65b68d4328816046bc35301dc6afba47b727
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-09 13:51:39 +00:00
Marc Mutz
62e89f4745 tst_QMetaType: fix misleading indention
As found by GCC 6:

  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1476:9: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
         tn += ">";
         ^~
  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:1474:5: note: ...this ‘if’ clause, but it is not
     if (tn.endsWith('>'))
     ^~

Fix += argument from char[2] to char as a drive-by.

Change-Id: I814dc58830934cac7fcf81eb7fd7564b2abeb631
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-03-09 13:18:26 +00:00
Friedemann Kleint
4ef990ce4a tst_QKeyEvent: Fix MSVC warning about 64bit shift.
tst_qkeyevent.cpp(140): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)

Change-Id: Id3e0eea125f7f7ec13f9b9428e034b922d2ce204
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-03-08 14:57:14 +00:00
Lars Knoll
d0b54cede8 Ensure QTextStream doesn't modify the Text flag on the underlying iodevice
An empty read or a failed write on the underlying QIODevice of the text
stream would lead to an early return where we wouldn't correctly restore
the QIODevice::Text flag of the io device.

Change-Id: I5b632f45dea6ede3f408113556c3dad1b96574e2
Task-number: QTBUG-47176
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-08 08:59:19 +00:00
Alexander Volkov
559152d911 Make an implicit grab on TouchBegin for a widget subscribed to a gesture
A receiver of TouchUpdate and TouchEnd events is determined either
as a widget which has an implicit grab for the touch point or as a
visible widget if there are no implicit grabs. The events are sent
if the receiver has accepted TouchBegin event or if it is subscribed
to a gesture. Before sending the events to the widget they are
delivered to the gesture manager. Thus, in order to detect gestures
for the widget, it must own an implicit grab or be a visible widget.

It can happen that the parent widget is subscribed to a gesture, but
doesn't accept TouchBegin event, as in the case of QScrollArea. Then it
will not get an implicit grab and gesture detection will be impossible.

Activate an implicit grab for such widgets. Also don't send TouchUpdate
and TouchEnd to them, because it's against the documentation.

Task-number: QTBUG-43277
Change-Id: Id767583991def6d76c48ad15eb39af822cad115d
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-03-05 21:49:59 +00:00
Tony Sarajärvi
43e535dd6f Blacklist tst_qnetworkreply tests that fail in RHEL 7.1
Task-number: QTBUG-51545
Change-Id: I0f5fdef315f87401ca5e638bce5dd2dbe85bcb83
Reviewed-by: Akseli Salovaara <akseli.salovaara@theqtcompany.com>
2016-03-03 09:17:44 +00:00
Joerg Bornemann
2b2232b5ea Speed up tst_QLocalSocket::sendData
The data function for this test re-used listenAndConnect_data that
has an additional column "connections" which was never used in sendData.
Thus sendData executed three times the same code which is just uselessly
burned CI time.
Copied the actually needed code of listenAndConnect_data to sendData_data.

Change-Id: I6cdb1c1b72cb4ce7be7c13e90eea30ac09a14914
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-03-03 08:25:04 +00:00
Friedemann Kleint
0aed4fd941 tst_qimagewriter: Fix leaking temporary files.
Add missing slash to the prefix pointing to the temporary directory.

Change-Id: I0d00f706af58214a9922758a60d097cab7d6bc9d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2016-03-02 14:53:08 +00:00
Maurice Kalinowski
cb6d751efa Fix tests for platforms without process support
Change-Id: I2d1cefdb5ff574635a75b54499efc392aba84434
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-03-01 09:27:13 +00:00
Joerg Bornemann
6f75c189e1 Fix crash in QProcess::waitForFinished on Windows
Suppose the user connects QProcess::readyReadStandardOutput with a
slot that calls QCoreApplication::processEvents.
Assume the event loop did not handle events between QProcess::start
and QProcess::waitForFinished. The process writes to stdout and exits.
QProcessPrivate::waitForFinished calls drainOutputPipes which calls
QWindowsPipeWriter::waitForReadyRead. This in turn will trigger
_q_processDied via the readyRead signal and processEvents.
_q_processDied will delete the pid object and set pid to null.
After drainOutputPipes returns, _q_processDied is called again but it
must not be called if pid is already destroyed.

Prevent calling _q_processDied if pid is null.

Task-number: QTBUG-48697
Change-Id: Iee047938ee1529057a1a43d71f4e882750903c7e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-02-29 17:52:58 +00:00
Friedemann Kleint
c7e213334b tst_QDialog: Instantiate test dialog on the stack.
Remove the member variable and instantiate only where needed
on the stack to prevent it from interfering with windows created
by other tests.

Remove flag Qt::X11BypassWindowManagerHint as it does not seem
to have any effect.

Task-number: QTBUG-51516
Change-Id: I3bf88bf148f365c57aaf989671f8b9c3c3f0d8e2
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-29 15:04:40 +00:00
Joerg Bornemann
d345783e4d Remove superfluous Windows CE special cases from tst_qprocess.cpp
Use default timeouts for wait functions. The increased timeouts will
only have an effect if the tests fail.
Print process errors if the process could not be started, while we're at
it.
Contract consecutive "#ifndef Q_OS_WINCE" blocks.

Change-Id: I6324e4c5b91b89ebb2580635b88705bbda922907
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-02-29 10:01:40 +00:00
Friedemann Kleint
c3761bf6a7 tst_QDialog::snapToDefaultButton(): Do not check on exact cursor position unless hint is set.
Given the flakyness of cursor positioning, loosen the check to only verify
that the cursor is outside the window. The hint is only active on Windows
depending on a system setting.

Task-number: QTBUG-51516
Change-Id: I474d251cc41e68f182baf8dba84eaf38d914d7ee
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-26 19:17:19 +00:00
Edward Welbourne
45ae0cb780 Remove a mis-placed QSKIP().
It made us skip the rest of the test, not just the small set of
sub-tests that were conditioned by the if () in whose else it sat.

Change-Id: I5e914e0aeb9d5ba44b21966d071aaccbc590365d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-02-26 09:22:35 +00:00
Marc Mutz
0a8fd9c620 tst_qguimetatype::flags(): port to QTypeInfoQuery
QTypeInfoQuery was introduced for 5.6 to decouple isStatic
and isRelocatable so old code continues to work. But since
this test still uses !isStatic to mean trivially-relocatable,
it will fail as soon as one of the checked types is marked as
Q_RELOCATABLE_TYPE instead of Q_MOVABLE_TYPE.

Incidentally, such a change is in the pipeline for Qt 5.7/5.8,
so fix the test by porting to QTypeInfoQuery. Do this in 5.6,
because that's when QTypeInfoQuery was introduced.

Change-Id: I06f815f26ca9b430e124c4a2f8de2a729999762b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-02-26 09:12:23 +00:00
Friedemann Kleint
c0963486ce QScreen::grabWindow(): Scale the coordinates.
The coordinates need to be scaled before calling QPlatformScreen::grabWindow()
On return, set a devicePixelRatio on the pixmap.

Adapt the QWidget test to scale the grabbed pixmaps.

Fixes pixeltool displaying the wrong part of the screen when High DPI scaling
is in effect.

Task-number: QTBUG-46615
Change-Id: I12de7df0da669230cf0fae74f4a42d43f061d5ff
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-02-26 07:16:48 +00:00
Kai Pastor
44357dbe42 QMacPrintEngine: Really set the printer resolution
As already reported in 2009 (Qt 4.6) QPrinter never actually set the
printer resolution. This change adds the necessary call to
PMPrinterSetOutputResolution (available since OS X 10.5).

[ChangeLog][QtPrintSupport][OS X] QMacPrintEngine now really sets the
printer resolution.

Task-number: QTBUG-7000
Change-Id: I3e851b62e1a7ed78564a8a6fd576b0a18d7eff63
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-02-25 18:42:47 +00:00
Joerg Bornemann
696a4bc2f9 Remove legacy from tst_qprocess.cpp
The windows.h include is not needed, the enums are properly known to
the metaobject system nowadays, and qprocess_p.h already has a
QT_NO_PROCESS guard.

Change-Id: I6bbdce19f097feb8260c51a29425279049aa0192
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-24 16:05:05 +00:00
Joerg Bornemann
479167cd4e tst_QProcess: Transform loop into additional test rows
Do not use a loop to execute similar but separate tests in
tst_QProcess::softExitInSlots. Use separate test rows with
distinguishable data tags instead.
This way we can deduce from CI output which part of this test failed.

Change-Id: Ic9bc996f2ced11b2bb1c33c1970e64937d860976
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2016-02-24 16:05:03 +00:00
Anton Kudryavtsev
9e59174b49 QPixmap: check data ptr in isQBitmap()
Task-number: QTBUG-51271
Change-Id: I670e074ced1217d2614fa334eb365e40ef80b8b1
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-24 12:13:56 +00:00
Błażej Szczygieł
7091be1b79 xcb: Deliver mouse enter event to window when closing modal window
When a modal window is closed and the mouse is not under the modal
window - find a proper window and send a fake enter event.

Added auto test for checking enter event on window when modal window
is closed.

Task-number: QTBUG-35109
Change-Id: I370b52d386503820ac9de21e6d05fd019ca456ec
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-02-24 09:03:14 +00:00
Friedemann Kleint
bf44f002ca Blacklist tst_QTreeView::setSortingEnabledChild() on Windows.
Task-number: QTBUG-51149
Change-Id: I7887aea5a6046353e235655665e53b5953f0854b
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
2016-02-24 08:20:11 +00:00
Błażej Szczygieł
57ecd5aeeb QtWidgets: Proper delivery of enter/leave event to context menus
First-level context menu grabs the mouse, so all mouse events are
delivered to it. This menu passes the mouse events to submenus. Any
platform delivers mouse enter/leave event differently when window is
grabbed. This patch unifies event delivery to context menus - it can
block some unwanted events and it emulates fake events if necessary.

This patch can reduce duplicated events and can provide proper enter
or leave event to additional widgets in the context menu. It can also
prevent submenu from unwanted close on Windows and X11.

Added autotest.

Task-number: QTBUG-45565
Task-number: QTBUG-45893
Task-number: QTBUG-47515
Change-Id: I7dd476d0be23afa34e947e54aef235012d173dcf
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-02-24 04:33:36 +00:00