Commit Graph

6481 Commits

Author SHA1 Message Date
Thiago Macieira
dcc36d7aa3 Autotest: remove the check that broadcast = ip | ~netmask
It's possible to configure an interface so that it isn't the case. I have
no idea if this is a valid scenario, but the unit test shouldn't enforce
that.

ip addr can report:
    inet 192.168.1.1/32 brd 192.168.1.255 scope global vlan0
       valid_lft forever preferred_lft forever

Change-Id: I8de47ed6c7be4847b99bffff141c337575760bd9
Reviewed-by: Richard J. Moore <rich@kde.org>
2016-01-21 05:19:13 +00:00
Jani Heikkinen
7b2fb038ae Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6 2016-01-21 04:27:06 +00:00
Edward Welbourne
1967accb64 Expand springForward_data() to cover a few more time-zones.
The important one is EET, for the benefit of our CI system; but other
European zones and the USA's coastal zones likely have enough hackers
in them to make this worth checking.

Change-Id: Idcc703bce29808e1a0a6279680cc8d3cbed38dac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:58 +00:00
Edward Welbourne
f7d9e34b96 Be fussier about setting tst_QDateTime's globals.
Time zones change on the whim of politicians.  Consequently, we can
seem to be in CET/CEST or on UTC (because we tested sample dates when
our zone coincided) when we aren't (i.e. we're in a materially
different zone at the time probed by some particular test).  Make the
initialization of the globals that test this more robust against
governmental meddling and document the unfixable problem with Algeria:
a DST transition *on the epoch*.

Change-Id: I17c5c81d339b80af12f4ffab367e28052dd6c2fa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:49 +00:00
Edward Welbourne
722df6e0a2 Nomenclature corrections relating to CET.
There are several European time zones; the only one relevant to the
tests here is CET.  They won't work with WET, GMT or EET.  So name
them and related variables for CET, not for Europe.

CET's summer-time isn't called CST; and the (existing) spring forward
test works only in CET/CEST, not elsewhere in Europe.

Change-Id: I55c7544bf792de7495700b749b935ec534831d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 17:11:33 +00:00
Kevin Funk
8dad3bf212 Fix toDisplayString(QUrl::PreferLocalFile) on Win
When using QUrl::PreferLocalFile we do want to strip the leading slash,
as toLocalFile() would do as well.

Behavior change by means of an example:
  QUrl url(QUrl::fromLocalFile("C:/file.txt")
  url.toLocalFile() --> "C:/file.txt"

Before:
  url.toDisplayString(QUrl::PreferLocalFile) --> "/C:/file.txt"

After:
  url.toDisplayString(QUrl::PreferLocalFile) --> "C:/file.txt"

Task-number: QTBUG-41729
Change-Id: I7d425541f6077ebcf3fcf46feeb7e0f03a0d7fe2
Reviewed-by: Dominik Haumann <dhaumann@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-20 13:24:53 +00:00
Robert Loehning
49a61f35f3 Add manual test for shortcut using implicit shift
In German layout, "Ctrl+/" is "Ctrl+Shift+7".

Change-Id: I50f3d77c4c76e7eb7cffe31283a3b73074324fea
Task-number: QTBUG-47122
Task-number: QTBUG-50360
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2016-01-20 12:50:11 +00:00
Eskil Abrahamsen Blomfeldt
4de1d0cb28 Android: Fix some QGraphicsScene tests
1. Use qrc for test data so that it can be found on all platforms.

2. Skip a test which does not work on platforms where show() implies
showMaximized(), as it depends on the window size being 150x150.

3. Skip test for hover event which depends on having a valid
mouse cursor position.

4. Skip a couple of tests that fail on some Android devices.
It's not worth spending a lot of time investigating this at the
moment.

Change-Id: Icb2b7f1d82981546a2154a76535b95606d7f40da
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2016-01-20 07:48:34 +00:00
Thiago Macieira
7ffcafd1b5 Remove all the atomic code besides MSVC and std::atomic
[ChangeLog][Important Behavior Changes] Starting with Qt 5.7, Qt
requires a C++11 compiler with support for C++11 atomics. This affects
user code too: Qt headers no longer compile with a C++98 compiler. The
minimum compiler versions for this release are:
 * Clang 3.4 (found in XCode 5.1)
 * GCC 4.7
 * Microsoft Visual Studio 2012

Change-Id: Ib056b47dde3341ef9a52ffff13ef1f496ea9363f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
2016-01-19 23:41:52 +00:00
Timur Pocheptsov
b530ca770f tst_qtextcocumentlayout::blockVisibility - make the test more robust
The test inserts strings "0" ... "9" into the text document,
takes the half of resulting document's size, makes half of
lines invisible and compares sizes. On OS X 10.11 after inserting
"4" the width changes, so making "4" invisible also reduces the width
and QCOMPARE(currentSize, previosHalfSize) fails. Instead of digits,
insert the same string "A" 10 times.

Change-Id: Ie88a0442703f98949cea9bcdb694cecee59695f3
Task-number: QTBUG-49848
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-19 14:48:47 +00:00
Liang Qi
8f569c740a Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	config.tests/common/atomic64/atomic64.cpp
	configure
	src/3rdparty/forkfd/forkfd.c
	src/corelib/io/forkfd_qt.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
	tools/configure/configureapp.cpp

Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414
2016-01-19 10:03:01 +01:00
Stephen Kelly
99e25dd7d8 CMake: Don't attempt gui-tests if Qt is built with -no-gui
Change-Id: I5f327fa1b0c7827535a4b00ca7d0d4281b1eec7b
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-18 13:00:03 +00:00
Alex Trotsenko
294111e25a QHttpSocketEngine: ensure pending EOF triggers a notification
When the remote peer closed the connection, a read notification needs
to always be emitted, otherwise the higher layer does not get the
disconnected signal. From the other side, underlying QAbstractSocket
object could temporarily disable notifications from the engine at
any time. To avoid possible blocking of the socket, take a pending EOF
into account when the read notifications are re-enabled.

Change-Id: Iac9d4e2f790530be3500baf5a2000f1f63df5cc2
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
2016-01-18 11:08:34 +00:00
Alex Trotsenko
184d66caa5 QDataStream: handle incomplete reads from QIODevice
This adds a way to resume reading from a stream after a ReadPastEnd error.
This is done by introducing a stream read transaction mechanism that keeps
read data in an internal buffer and rolls it back on failure.

[ChangeLog][QtCore] Added QDataStream startTransaction(),
commitTransaction(), rollbackTransaction(), abortTransaction()
functions to support read transactions.

Task-number: QTBUG-44418
Change-Id: Ibf946e1939a5573c4182fea7e26608947218c2d9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-13 16:31:33 +00:00
Andy Shaw
8c89a8b1ef [Android]: Java uses some deprecated locale codes so account for these
There are three deprecated language codes that Java still uses for the
locale so we need to account for these inside QLocale by mapping them to
the right language.

Task-number: QTBUG-49632
Change-Id: Ib66b3f2763e085f7384228f2490b048bb56be259
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-13 12:37:56 +00:00
Simon Hausmann
9a969182cf Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev 2016-01-13 07:19:44 +00:00
Dan Cape
f7020a31c0 Add ability to specify precision of float/double currency strings
Added a new overload function that allows the developer to
specify the desired precision. Until 6.0, it will require
the symbol and precision to be passed to it. Once Qt is at
version 6.0, it will replace the overload function that
requires a value and optionally a symbol.

[ChangeLog][QtCore][QLocale] Added an overload for toCurrencyString()
that allows the decimal precision to be specified.

Change-Id: I1fb7dde3583f46de2ed20ec2a7abaeca23a903ef
Task-number: QTBUG-46595
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-13 06:35:14 +00:00
Tor Arne Vestbø
af45b352d7 Fix reentrancy regression in QShortcutMap after c7e5e1d9e
When closing a popup dialog using a shortcut, when the popup
was originally opened using a shortcut, the closing-shortcut
would interfere with the state of the first shortcut, and we
ended up sending a key event for the original shortcut.

Task-number: QTBUG-50360
Change-Id: I62e5ddb9ca43b28519ede629775bc0d7598dccc4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-01-12 22:08:04 +00:00
Alex Trotsenko
771220ebc8 Allow to use QRingBuffer in containers
Make a private member mutable to enable default assignment operator.

Change-Id: I1216875c186ed800e07c6b41a5bae18c3b71b2fa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-12 18:03:24 +00:00
Alex Trotsenko
7d257aab81 QIODevice: handle incomplete reads
Introduce a transaction mechanism that gives the ability to read the
data atomically. Current implementation supports transactions for both
types of devices. For sequential devices, it records the whole input
stream during transaction. For random-access devices, device position
is saved when transaction starts. If an error occurs, the application
may be able to recover the input stream by rolling back to the start
point.

Also, QIODevice::peek() was rewritten to make use of transactions
internally. The replacement of QIODevicePrivateLinearBuffer by
QRingBuffer is closely entangled with that, which makes it unfeasible
to do separately.

Bump the TypeInformationVersion field in qtHookData, to notify the
Qt Creator developers that the offset of QFilePrivate::fileName was
changed and dumpers should be adapted.

[ChangeLog][QtCore] Added QIODevice's startTransaction(),
commitTransaction(), rollbackTransaction(), isTransactionStarted()
functions to support the read transactions.

Task-number: QTBUG-44418
Change-Id: I3564b343ebeeaaf7c48a1dcdb7ef0a7ffec550f2
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-12 18:00:58 +00:00
Simon Hausmann
6b8c0a5058 Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I5839bded07e23af65ced9491c4f50242f964dd31
2016-01-12 11:07:56 +01:00
Edward Welbourne
81858bf172 Don't pretend we know what DST to use for an offset date.
When QDateTime::addDate() and friends sanitize their end-state, they
were using the DST status of their start-state (if known) to control
it.  This lead to misguided results and, in particular, inconsistent
results given that a raw-constructed QDateTime comes into being
ignorant of its DST, while a .toLocalTime() one knows its DST.

Furthermore, the code to do this was triplicated, tricky and poorly
explained.  So pull it out into a local static function and explain
what it's doing, and why, more clearly and only once.

Task-number: QTBUG-49008
Change-Id: Ia4bb3c5e9267fff8bb963ea705267998218ed623
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-12 09:23:55 +00:00
Marc Mutz
08775e4bd7 Revert "QString: preserve embedded NULs when converting from QByteArray"
This partially reverts commit e486d69133.
It broke too many users, even though all of them deserved to be broken.
The new functionality will be provided by differently-named functions,
where possible (problem: equality operators).

I did not revert the fix for the off-by-one error in
tst_qtextdocumentfragment.cpp.

I also didn't revert the change in the inequality relational operators,
since for all strings s1, s2 and s2' where s2' is s2 truncated at the
first NUL, s1 < s2 ⟺ s1 < s2' (since NUL < c for any c != 0), and,
trivially, for ≤, >, ≥, too. This does not hold for = and ≠, of course,
since "foo\0bar" ≠ "foo".

[ChangeLog][Important Behavior Changes][EDITORIAL] Reverted: All
conversions from QByteArray to QString now preserve embedded NULs...

Change-Id: If4b47048b39ae5be6ed08e6d91809626a67ea7f5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-12 06:13:05 +00:00
David Faure
e8479592c5 Doc: mention that Qt::AA_X11InitThreads isn't used anymore
Whether or not to call XInitThreads() doesn't apply since Qt-5.0's switch to XCB.

Change-Id: I5f1e5e664a251c98af6357c87fc9a6bb03a46ce3
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-01-11 17:28:52 +00:00
Kevin Funk
558f69a18b CMake: Ensure that -fPIC is passed in tests.
CMake newer than 2.8.12 automatically adds the
appropriate flag, but CI still runs 2.8.11.

Change-Id: Ie61375f2feb54a92c9d8f0ed6ad5227a67343bc5
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-11 09:53:37 +00:00
Friedemann Kleint
f186c4a819 Diaglib: Fix and extend dumping of native windows (Windows).
When recursing over the windows, the code did not take into account
that EnumChildWindow enumerates grand children as well. Exclude
those by checking for the direct parent in the recursion so that
the hierarchy is printed correctly. Add more information about
class and module and rearrange the output a bit so that the window
title is more prominent.

Task-number: QTBUG-50206
Change-Id: Iffb12c44eda9d09da5eb14a8405aee52ed3aa849
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-11 07:56:17 +00:00
Edward Welbourne
89293e6b19 Make DST-transition test more general.
Widen its interval (to work in more TZs) and test spring as well as
autumn.  Anywhere that does have a DST transition probably has it
between August and December; and there's no benefit to using a narrow
window.

There's also no sense skipping the test if we don't know there's a DST
transition: the test should still work, it just won't be testing
anything (about DST transitions).

Combine date and time checks into date-time checks, so that, when one
of them fails, QCOMPARE lets us know how the other changed, too.

Task-number: QTBUG-49008
Change-Id: I145b939ffef0dd0b54fd0e3cdf72a159c57ec00b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-11 07:31:19 +00:00
Thiago Macieira
ac2bde9caf QVariant: make sure two floating points compare equal if they are equal
Not just fuzzily equal. The fuzzy comparison fails for infinities, since
the expression p1 - p2 where p1 = p2 = infinity is NaN. And NaN
comparisons are always false.

As a nice side-effect, we don't do the more expensive computation of a
multiplication if the two numbers really are equal.

Task-number: QTBUG-50036
Change-Id: I11f559ef75544c50b3f8ffff1420cec7c7273295
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-11 05:20:23 +00:00
Thiago Macieira
71c0bb3fd1 Revert "dbus: Add method serial() and replySerial() to class DBusMessage."
This reverts commit 618e2cc081. The
original commit has a section of code that I failed to review properly
and is of questionable functionality.

Change-Id: I61c53d7b8b2aa7c3312292b017a18aba7da11bc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-11 05:19:41 +00:00
Kevin Funk
000c4358ce CMake: Make all tests link to Qt libraries
This is needed as of commit v5.6.0-beta1~483 (Add an automatic use of
the ELF-versioned QtCore symbol, 2015-10-20).  Even if a translation
unit only contains

 #include <QtCore/QString>

 int main(int,char**)
 {
     return 0;
 }

it must link to QtCore which provides the qt_version_tag symbol.

Change-Id: I827c0a7403320e7e5b384d8608face20fcecdaea
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-09 15:35:20 +00:00
Marc Mutz
1e2b42523f Fix UB in tst_QObject::disconnectDoesNotLeakFunctor()
If CountedStruct is passed a GetSenderObject object,
it will attempt to call a member on it from within
its own destructor.

That works usually quite well, but in this test case,
which tests for function object leaks when a connection
is torn down because the sender object is destroyed,
the destruction of the CountedStruct happens when all
connections are severed in ~QObject. At that point,
what used to be a GetSenderObject instance no longer
is one and the call into one of its member functions
invokes undefined behavior.

Fix by making QObject::sender() public by a using
declaration instead of a wrapper function.

Found by UBSan:
  tests/auto/corelib/kernel/qobject/tst_qobject.cpp:6007:104: runtime error: member call on address 0x7ffc6e7538b0 which does not point to an object of type 'GetSenderObject'
  0x7ffc6e7538b0: note: object is of type 'QObject'

Change-Id: Ia973140037b3c1b5a670a8a3949d09b956f40349
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-09 15:18:50 +00:00
Thiago Macieira
49c743bdb9 QDate: fix calculation of the week number for the last days of 2020
Off-by-one error: we should have calculated whether the current year is
leap, not the next year. This affected any 53-week leap years.

Task-number: QTBUG-50273
Change-Id: I134ce5db2f82468585ffffff14264cb9f12998fd
Reviewed-by: Martin Klapetek <mklapetek@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-09 09:13:44 +00:00
Oswald Buddenhagen
5783a915c4 don't rely on transitive dependencies
Change-Id: Ide872b452e02ebefb3eeb51464c8d59e8bf58bc4
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-08 18:51:02 +00:00
Frederik Gladhorn
ad16478a76 Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi

Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
2016-01-08 12:35:24 +01:00
Simon Hausmann
c7797184f0 Prospective fix for running cmake tests with -no-widgets
Don't try to run test_interface when Qt is configured without QtWidgets.

Change-Id: If6c376c250215c1d639b06881d16c0141091f288
Reviewed-by: Stephen Kelly <ske@ableton.com>
2016-01-07 19:29:36 +00:00
Marc Mutz
c38b14e251 Fix UB in tst_QSharedPointer::basics()
Binding a reference to the nullptr is undefined
behavior.

Just skip that particular test when 'ptr' is null.

Found by UBSan:
  tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp:258:32: runtime error: reference binding to null pointer of type 'struct Data'

Change-Id: I125588b9d269a6f76716d660d03142f409513885
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-07 13:00:40 +00:00
Marc Mutz
9c7be0a7ec Fix UB in tst_QDialog::showExtension()
Don't cast a QDialog to a subclass it is not.

Fix by creating it as the required subclass in the
first place.

Found by UBSan:
  tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp:203:20: runtime error: downcast of address 0x2b5f5000ad40 which does not point to an object of type 'DummyDialog'
  tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp:203:46: runtime error: member call on address 0x2b5f5000ad40 which does not point to an object of type 'DummyDialog'

Change-Id: I63ae7e782bda6a78d11af5c2bc2f7d88aacd0ac0
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-07 13:00:32 +00:00
Marc Mutz
f5291bf8b4 Fix UB in tst_QObject::noDeclarativeParentChangedOnDestruction()
If QObjectPrivate::declarativeData is set, it is
in various places in Qt expected to point to a
QAbstractDeclarativeDataImpl, from which ownedByQml1
is unconditionally read.

In noDeclarativeParentChangedOnDestruction(), the
declarativeData pointer is, however, set to a local
QAbstractDeclarativeData instance, which, being an
empty class, has size 1 and alignment 1.

Depending on the compiler's idea of bit field order,
this code either read uninitialized data from the
dummy object, or else some random stack memory outside
any (valid) object.

What caught UBSan's attention, though, was the
difference in alignment between the two classes:

  src/corelib/kernel/qobject.cpp:917:9: runtime error: member access within misaligned address 0x7fffc9cf706f for type 'struct QAbstractDeclarativeDataImpl', which requires 4 byte alignment

Fix by providing a properly initialized object of the
correct type.

Change-Id: Iae83a949ee5a7bc98df13e35ea614c063085fa13
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-01-07 13:00:28 +00:00
Ralf Habacker
618e2cc081 dbus: Add method serial() and replySerial() to class DBusMessage.
This patch includes setup of class member 'msg' in
QDBusMessagePrivate::toDBusMessage() to be able to get the
serial after message sending.

Testcases for comparing the 'reply serial to' with the 'serial'
are included.

Task-number: QTBUG-44490
Change-Id: Iae7c48f5b0c70a6c5ae500904072b38b46dfd876
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-01-07 07:42:35 +00:00
Marc Mutz
bccbb70de5 Fix UB in tst_QMetaType
Don't pass around meta-type IDs in QMetaType::Type
variables. It leads to reading values from an enum
variable that are invalid.

Fix by passing the IDs around as int.

Found by UBSan:
  tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp:408:5: runtime error: load of value 4028, which is not a valid value for type 'Type'

Change-Id: Idd106ee3d7960fe3d8fefc0fc5830fc22d38a513
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-06 22:07:09 +00:00
Marc Mutz
033205bb59 Fix UB in tst_QIODevice::getSetCheck()
The reinterpret cast from a QTcpSocket → QAbstractSocket → QIODevice
to MyIODevice → QIODevice was undefined.

Fix by simply instantiating a MyIODevice, which must then inherit
from QTcpSocket, of course.

Instead of fixing the class name in the overridden setOpenMode()
method, simply make the base class' implementation public with
a using declaration.

Found by UBSan:
  qtbase/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp:84:22: runtime error: member call on address 0x7ffcca2d23f0 which does not point to an object of type 'MyIODevice'
  0x7ffcca2d23f0: note: object is of type 'QTcpSocket'

Change-Id: I939b3548949b9b5765df4a6cc81875e169fd69dd
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-06 17:25:05 +00:00
Friedemann Kleint
a62132b22c Diaglib: Output more information about QWindow.
Output surface class/type, screen name and scaling factors.

Task-number: QTBUG-50206
Change-Id: I88d3494962b29985cd9e492c1761361b73e0172e
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2016-01-06 13:04:59 +00:00
Timur Pocheptsov
daeed4631a Blacklist failing tst_QFile tests (OS X)
openStandardStreamsFileDescriptors and openStandardStreamsBufferedStreams
fail on OS X: lseek somehow works on sequential streams (standard streams)
but QFile has pos() == 0 (since it's sequential).

Change-Id: I6a6161c012a91de189f59c533880fb8fe7a66d37
Task-number: QTBUG-49841
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
2016-01-06 09:38:55 +00:00
Alex Trotsenko
02f70004c2 Allow socket events processing with a foreign event loop on Windows
While a native dialog is open, the application message queue is
handled by the native event loop which is external to Qt. In this
case, QEventDispatcherWin32::processEvents() does not run and socket
notifiers will not be activated. So, this patch moves the notifier
activation code into the window procedure, which enables socket
event processing with native dialogs.

Task-number: QTBUG-49782
Task-number: QTBUG-48901
Change-Id: Icbdd96b2e80c50b73505f4fe74957575b83d6cf1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-01-05 13:05:35 +00:00
Ulf Hermann
9d6a4e7094 QLocale: Accept trailing junk in qstrtod()
qstrtod() used to accept trailing junk until libdouble-conversion was
introduced and we need this behavior in order to implement EcmaScript's
parseFloat() correctly. The QString and QByteArray methods should not
accept trailing junk, though.

Task-number: QTBUG-50131
Change-Id: Ide922da0d65b2576be2c9f47f6053057eff77994
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-05 11:29:29 +00:00
Masaru Ueki
e0a5f661e5 QStateMachine: fix ignore high-priority events.
When a high-priority event is posted in overrided
'QStateMachine::beginSelectTransitions', the event may be remained in
event queue, and be not dispatched until another event posted.

Change-Id: Ifda288d9c00ac7985e426b9cc02bda382ebaac35
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2016-01-05 10:05:40 +00:00
Friedemann Kleint
38c8af7231 Revert "Fix global coordinate mapping for child widgets in QGraphicsView."
This reverts commit 56aad2ad60.

QWidget::mapFromGlobal() does not work correctly when the widget is
a child widget of another widget embedded into a QGraphicsView with a
transformation (scaling/rotation). It starts applying offsets going
up the widget tree (just as mapToGlobal) until it hits the embedded widget
not taking into account the transformation.

It would need to go in from to top to bottom or better be reimplemented
such that a QTransform for mapping coordinates from/to global is determined
which is then applied in reverse.

Task-number: QTBUG-50030
Task-number: QTBUG-50136
Change-Id: Iadeb891d793be1938c64942bfbf38d541a281c33
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-05 08:18:18 +00:00
Oliver Wolff
190c76f685 winrt: Use winsock2 API for hostname resolution on WinRT/WinPhone
That API has been available for WinRT and Windows
Phone for some time now. By using it to get the
machine name and for hostname resolution we can get
rid of some winrt-only code and use qhostinfo_win.cpp
on WinRT and Windows phone as well.

Additionally the required capability was added to
tst_qhostinfo so that this auto test can be run without
any manual editing.

Change-Id: I63fa5521bf8cdb0c919bd5a0100ea977c865622a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2016-01-05 08:14:31 +00:00
Timur Pocheptsov
4ed8733d90 tst_Gesture - fix failing tests on OS X 10.11
This test seems to be quite broken on OS X: qWaitForWindowExposed returns
too early (while no window is on screen) so gestures can not be dispatched
QApplication::topLevelAt(pt) - returns null.
Use qWait + isExposed combo instead (similar to qWaitForWindowExposed, but
there is no isExposed test before the loop).

Change-Id: I85fbd773ccce0ca92b2dceb1749d67ef767aa0cf
Task-number: QTBUG-49849
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2016-01-05 06:08:18 +00:00
Sebastian Lösch
73ad2bf32f Make ephemeral server key available
When using cipher algorithms with forward secrecy an ephemeral key is
used to generate the symmetric session key. Beside the SSL certificate's
key, this ephemeral key is of cryptographic interest.

The ephemeral key is chosen by the server side - currently statically in
the Qt implementation - so it is only of interest on the client side to
check it. Therefore the ephemeral key is the null key if the connection
is set up in server mode or a cipher without forward secrecy is used.

Change-Id: If241247dbb8490a91233ae47f2b38952c6591bf4
Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
2016-01-04 18:10:14 +00:00
Edward Welbourne
374d35d5ba Make use of preprocessor easier to understand.
The #if had a condition that was needlessly hard to understand;
and was widely separated from its #else clause.

Change-Id: I43f4282993f4f2e8c4b5ad07dc2c2e06a6b95aa9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-01-04 13:59:14 +00:00
Thiago Macieira
b08d84d39e Autotest: Make sure that we can place calls with disabled delivery
This often happens in applications. Besides, we are expecting at least a
call to RequestName to happen.

Change-Id: Ifd2454ffba454fd591d0ffff1425a84563267d19
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-03 19:16:33 +00:00
Thiago Macieira
0828d4e8ea Autotest: test both libdbus-1 load failure and connection failure
Change-Id: I39cc61d0d59846ab8c23ffff14242294649c1a45
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:06:10 +00:00
Thiago Macieira
9510d99f08 Autotest: Mark D-Bus tests that don't connect to the bus as parallel
There's no problem running them in parallel.

Change-Id: I39cc61d0d59846ab8c23ffff142420a127ab6968
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2016-01-02 02:05:52 +00:00
Thiago Macieira
1f6fa1f37a Suspend processing of some messages in the default busses by default
To retain a bit compatibility with applications developed in the last 9
years that expect that QDBusConnections won't process their events until
the event loop runs, we now suspend the handling of incoming messages
in the two default buses (and only in them) and resume when the event
loop starts. This is required because the new threaded QtDBus would
otherwise process incoming messages that the application didn't expect
it to.

For example, if the application first acquires names on the bus and only
after that registers objects with QtDBus, there's a small window in
which the name is acquired and visible to other applications, but no
objects are registered yet. Calls to those objects may be received,
would then be processed in the QDBusConnectionManager thread and fail.

The work around is to disable the actual handling of method calls and
signals in QDBusConnectionPrivate::handleMessage. Instead, those
messages are queued until later.

Due to the way that libdbus-1 works, outgoing method calls that are
waiting for replies are not affected, since their processing does not
happen in handleMessage().

[ChangeLog][Important Behavior Changes] QtDBus now uses threads to
implement processing of incoming and outgoing messages. This solves a
number of thread safety issues and fixes an architectural problem that
would cause all processing to stop if a particular thread (usually the
main thread) were blocked in any operation. On the flip side, application
developers need to know that modifications to a QDBusConnection may be
visible immediately on the connection, so they should be done in an
order that won't allow for incomplete states to be observed (for
example, first register all objects, then acquire service names).

Change-Id: I39cc61d0d59846ab8c23ffff1423c6d555f6ee0a
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-02 02:05:45 +00:00
Marc Mutz
be94e009ae QFileDialog: optimize string handling in qt_tildeExpansion
- Instead of QString::split()-ing the path, just to inspect the
  first item in the list returned, simply find the location of
  the first separator and work with that.
  -> saves creating a QList, and its QString elements
  -> saves attempted detaches of that list when calling
     first()
- When extracting the user name, don't do it in a QString, do
  it in a QStringRef.
- When constructing the result, don't use QString::replace(),
  use QStringBuilder with a QStringRef into the original string.
- Eradicate the out parameter, it is easily calculated from the
  return value.
- Don't calculate userName on VXWORKS and INTEGRITY, where it
  is not used. Requires a different #ifdef sequence. Fixed
  preprocessor directives' indention as a drive-by.

Costs 84b in text size on optimized GCC 4.9 Linux AMD64 builds.

Change-Id: I61f1e8d558db7fb0c5c1170bdfd6f5ac1f1a9e62
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-01 23:32:13 +00:00
Thorbjørn Martsum
024a52d0d1 QHeaderView - fix broken stretchLastSection
In setStretchLastSection we restore a default section size
if we no longer use stretch. That size was however not
sufficient - we should restore the actual size.

Furthermore we should also always stretch the last section
(last visible index) - and not leave a section with a
huge size and stretch another.

This patch refactors stretch handling and keeps track
of the last section and its size in eg. moveSection,
swapSection, hideSection, showSection etc.

There is an auto test showing and guarding its behavior.

[ChangeLog][QtWidgets][QHeaderView] Fixed some issues
(e.g QTBUG-39010) with restoring of section size after
a section is no longer the last visible section
(in stretchLastSection mode).

Task-number: QTBUG-39010
Change-Id: Id47075b5a9dfeb250027374ecbd10eb8babbf9ef
Reviewed-by: David Faure <david.faure@kdab.com>
2016-01-01 12:56:29 +00:00
Marc Mutz
d681107f1f Add qHash(std::pair)
We already include <utility> in <qglobal.h>, so we might
as well provide a qHash() overload for std::pair.

[ChangeLog][QtCore] Added qHash(std::pair), defined in
<QHashFunctions>.

Change-Id: I0f61c513e82e05ce9d2e56bcf18f3be9e2da4da9
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-30 11:37:53 +00:00
David Faure
72b4f0d474 QMimeDatabase: follow symlinks when checking for FIFO etc.
This was documented, but not what the code did.

Task-number: QTBUG-48529
Change-Id: I4849778c61dcae13be27c62b24717693c0c07d78
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-29 11:06:13 +00:00
Marc Mutz
8f166ccf40 QString: add resize(int, QChar)
This will be used in QTextStream to speed up padding processing.

[ChangeLog][QtCore][QString] Added resize(int, QChar) overload.

Change-Id: Id51f8cdacb167310157100b05cacf20e9a5d2716
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-28 09:14:59 +00:00
Alex Trotsenko
6b6955c2ff QAbstractSocket: do not enable read notifications on TCP in bind()
In bind+connect scenario, rejected connection can trigger a read
notification while the socket is opened. But unlike UDP, reading from
the socket engine or emitting a readyRead() signal is not allowed for
the TCP socket in bound or connecting state.

To make a bind+connect scenario work properly, disable the read
notifications until a connection is established.

Task-number: QTBUG-50124
Change-Id: I7b3d015b0f6021fb9ff9f83560478aa5545f41f5
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-12-24 14:05:26 +00:00
Alex Trotsenko
27479c1323 Enable a test for QFilePrivate::fileName offset on 32 bit Linux
Change-Id: I3577ff7126263ddbe4b7714095480e6f1da7b661
Reviewed-by: hjk <hjk@theqtcompany.com>
2015-12-23 14:36:15 +00:00
Marc Mutz
a2d218cc41 tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'"
Probably correct.

The question is just why this code has survived for so many years.

Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 08:35:49 +00:00
Marc Mutz
29ddfc3be7 tst_collections: "explicit instantiation of 'NS::QList' must occur in namespace 'NS'
Probably correct.

The question is just why this code has survived for so many years.

Change-Id: Iaf01850476f9b066243abebb9ee6c5928d7ada19
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-23 07:27:39 +00:00
Friedemann Kleint
3690bcfda3 Refactor tst_QGraphicsWidget::setTabOrderAndReparent().
The test produces compiler warnings in release builds:

tst_qgraphicswidget.cpp: In member function 'void tst_QGraphicsWidget::setTabOrderAndReparent()':
tst_qgraphicswidget.cpp:1521:89: warning: 'w2' may be used uninitialized in this function [-Wmaybe-uninitialized]
tst_qgraphicswidget.cpp:1536:88: warning: 'w1' may be used uninitialized in this function [-Wmaybe-uninitialized]

Use arrays instead of the variables w1,2... and rewrite the helper
function compareFocusChain() to work on iterators allowing to
remove some temporary lists. Also return error messages in a
QByteArray ready for the Q[TRY_]VERIFY2 macros.

Change-Id: I43466921af59521d1faf00b75fe943508418abb3
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-22 11:45:47 +00:00
Friedemann Kleint
f7a167223b tst_QTemporaryDir::nonWritableCurrentDir: Add a check for write protection.
/home has been observed to be writable on some CI machines.
Add checks verifying existence and correct permissions.

Change-Id: Ie0f952e20d0d8eb0b57234eea2e2ecb78f5a7b58
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-22 10:59:03 +00:00
Lars Knoll
26237f0a2d Fix QJsonValue::fromVariant() if the variant contains a json object
If the variant contains a known json type (value, array, object or
document), simply unwrap those. In the case of the json document
wrap the contained object/array into a QJsonValue.

This should be the expected behavior, and makes more sense than
returning a null QJsonValue.

Task-number: QTBUG-41234
Change-Id: Id084fc11220d51aaf78b7694fd0ebef1411f5c51
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-22 10:00:46 +00:00
David Faure
2e1de7f3c4 QUrl: revert path-normalization in setPath().
Path normalization should happen only when NormalizePathSegments is set.
Use a less intrusive fix for the setPath("//path") issue that
commit aba336c2b4 was about.

This allows fromLocalFile("/tmp/.") to keep the "/." at the end,
which is useful for appending to the path later on (e.g. to get "/tmp/.hidden")

Change-Id: Ibc3d4d3276c1d3aaee1774e21e24d01af38fa880
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-22 09:56:27 +00:00
David Faure
5f03b48cb3 QStandardPaths: warn if $XDG_RUNTIME_DIR doesn't exist
If the environment variable is set, but points to a non-existing directory,
the user would get a warning about chmod failing. Better be clear and
warn about the fact that the directory itself doesn't exist.

Also warn if $XDG_RUNTIME_DIR points to a file rather than a directory.

Task-number: QTBUG-48771
Change-Id: If84e72d768528ea4b80260afbbc18709b7b738a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-22 09:56:23 +00:00
Gabriel de Dietrich
64481bcc67 QWidgetWindow: The alien widget should be from the window's hierarchy
This partially reverts commit 025d6a778c.

Change-Id: I7b964b0d598abe46137c22177fe2b5dcca5bb812
Task-number: QTBUG-49831
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2015-12-21 23:02:40 +00:00
Joerg Bornemann
e96fa5a780 Fix timeout calculations using qt_subtract_from_timeout
Commit ed0c0070 introduced qt_subtract_from_timeout but used it
incorrectly in several places.

Change-Id: I80ea16088707929a45d5a61ec6f3370f8e63d1cd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-21 22:26:40 +00:00
Oswald Buddenhagen
e5f3b653f0 add enablers for printing project errors in cumulative mode
this doesn't actually do anything in qmake.

Change-Id: Ia14953a5a9dc31af56ad6c338017dd5b85bb4494
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
(cherry picked from qttools/08d0cb6f8e90a818bf6d3bec7a6d00f16419b8c0)
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-21 16:39:31 +00:00
Oswald Buddenhagen
57ca8d2698 make write_file() capable of making files (not) executable
Change-Id: I9ca96bc3408160261781697a3471c1f446c86c3a
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-21 16:34:26 +00:00
Erik Verbruggen
1823c8f2dd Fix utf8->utf16 BOM/ZWNBSP decoding.
When the byte sequence for a BOM occurs in the middle of a utf8 stream,
it is a ZWNBSP.

When a ZWNBSP occurs in the middle of a utf8 character sequence, and the
SIMD conversion does some work (meaning: the length is at least 16
characters long), it would not recognize the fact some charactes were
already decoded. So the conversion would then strip the ZWNBSP out,
thinking it's a BOM.

The non-SIMD conversion did not have this problem: the very first
character conversion would already set the headerdone flag.

Change-Id: I39aacf607e2e068107106254021a8042d164f628
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-21 09:56:49 +00:00
Jędrzej Nowacki
55eaf11bb7 Stabilize tst_qtimeline::resume
Change-Id: Ife0ce27c680196ed1fe3d037ea0367e511560c96
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:53:21 +00:00
Jędrzej Nowacki
8dd84c6420 Speedup tst_qtimeline::finished
Change-Id: Id9ae42663d8830365d4dcfab92b48621eb1b409f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:53:13 +00:00
Jędrzej Nowacki
6606b151c4 Get rid of qWait in tst_qtimeline::restart to make it less flaky
Change-Id: Iba3a9e5dce6bd7ff6e241fae738cfc51386f0c75
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:53:00 +00:00
Jędrzej Nowacki
4e012cb083 Improve tst_qtimeline::value
The test was improved by:
 - Use QCOMPARE instead of QVERIFY
 - Use QTRY_ macro instead arbitrary qWait
 - Use longer time line

The test executes faster and it should be less vulnerable to
an unreliable timer.

Change-Id: I92675015a6251b47eaf20b0fc916f3a36b52d783
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:49 +00:00
Jędrzej Nowacki
266511401f Improve tst_qtimeline::currentFrame
The test run faster and it less vulnerable to an inaccurate time.

Change-Id: I19475095395dcf1e6d47fdbba5eeffabab1fc7b9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:40 +00:00
Jędrzej Nowacki
70e290411a Improve tst_qtimeline::currentTime
Now the test is less fragile to time and it executes 4s faster

Change-Id: Id3eb8ed2c03317e7d2f2c3cd17f889a8d8e7e5b4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:33 +00:00
Jędrzej Nowacki
229c03cd88 Make tst_qtimeline::range less prune to timing errors
Change-Id: I5fd84c58250a9dfa237fcb7fca4da50c35a9f57e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:27 +00:00
Jędrzej Nowacki
bcc23e7942 Make tst_qtimeline::duration less fragile to timings
The test still can fail because 1s is quite a short time.

Change-Id: I6f42c182f2932d5a053f6a69667210529c9a7697
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-21 08:52:13 +00:00
Liang Qi
beb65dcd79 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/gui/painting/painting.pri
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
	tests/auto/corelib/tools/qlocale/test/test.pro
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
	tools/configure/environment.cpp

Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
2015-12-18 08:37:31 +01:00
Friedemann Kleint
e3288f246b Windows: Restore window geometry after normal->maximized->fullscreen->normal.
- Do not save geometry when going from maximized->fullscreen
- Use SW_SHOWNA instead SW_SHOWNOACTIVATE as otherwise the
  maximized geometry is restored.
- Add a test for Windows.

Task-number: QTBUG-49709
Change-Id: Ic81e7398ee90d499a50b02192a45cb09276a2105
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-12-17 14:58:29 +00:00
Edward Welbourne
d6efc0aab3 qmake: teach findMocs to handle backslash-newline gracefully.
Change-Id: Id71352c0cf71ab84bd81d4f3d11bb19dc7965903
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-17 13:47:33 +00:00
Allan Sandfeld Jensen
d290424f2a NEON optimized bilinear sampling
Adds NEON version of interpolate_4_pixels used by smooth upscaling, and
bilinear sampling.

The SSE2 version is reordered to match the NEON version so they have
the same order of operations and a faster version that loads directly
into vector registers.

Testing is extended so we have a test of smoothness that can catch more
possible mistakes.

Change-Id: I0de4aecf5cb79468e7c8f19f421aa24b2955547c
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
2015-12-17 01:11:57 +00:00
hjk
2d3b04e4f6 Sanitize JSON test data
Strings do not have to be overly specific to test parser function.

Change-Id: I345dfec7fb4b8004661f6757cfd53b428ad87b6b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-12-16 08:54:57 +00:00
Edward Welbourne
5e7492325a qmake: teach moc-detector to handle C++-11 raw strings
As for the #include-parser, the moc-detector's minimal C preprocessor
could be confused by a raw string into ignoring large chunks of code.

Change-Id: Id688e9a1f04628ce75a51a7d15269078c734288e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-15 16:40:08 +00:00
Edward Welbourne
209a26c6c4 qmake: Fix comment false-alarm bug in findMocs().
If a / wasn't part of a comment-start, it and the character after it
were none the less stepped over.  If the character after started an
enclosure, this would duly be missed, leading to mis-parsing of the
subsequent text.  As for similar bug recently fixed in findDeps().

Change-Id: Ie5329ec633c23a554b42a6351723c980e27fb9a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-15 16:40:02 +00:00
hjk
85eb7d9897 Complete a test for QFilePrivate::fileName offset on Linux
This extends the test suite introduced in 497f0af1f7 for
a known-to-be-good case also for 32 bit systems.

Change-Id: Ia231bcb9b0102c28483d932be18767662b7a6afd
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2015-12-15 12:40:54 +00:00
Friedemann Kleint
bece6fa0b9 QDockAreaLayout/QPlaceHolderItem: Store geometry excluding frame.
Previously, the geometry stored for floating dock widgets
in QPlaceHolderItem::topLevelRect and QDockAreaLayoutInfo::saveState()
included the window frame (frame position/content area size).
This does not work in the case where a floating dock widget is deleted
since the geometry is determined after reparenting the widget when the
frame geometry is no longer available. Change the behavior to store
the geometry excluding frame to avoid such problems and adapt
QDockWidgetPrivate::setWindowState() accordingly.

Task-number: QTBUG-49832
Task-number: QTBUG-45780
Change-Id: I84b5c80df6e1c9e738bbb1407b9047cc84719ce0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-15 12:05:26 +00:00
Tony Sarajärvi
40804ad868 Extend blacklisting of tst_qsettings to OSX 10.11
This test is marked as blacklisted on 10.10, and it
is found to still fail in 10.11.

Task-number: QTBUG-49834
Change-Id: Ibddb1af6b61f3fca2b2aea18102bbaa5390a40d3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-12-15 09:45:51 +00:00
Edward Welbourne
214e271b93 Rewrote qmake's #include-detection to be more faithful to CPP.
The C preprocessor allows backslash-newline anywhere and allows
comments anywhere it allows space.  Testing wilfully perverse
applications of that revealed qmake's parsing of #include directives
wasn't very robust.  So rework to actually follow the rules and add
those tests.

Change-Id: If5cc7bfb65f9994e9ab9ed216dd1ee7285c63934
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-15 09:21:27 +00:00
Edward Welbourne
d47baa7236 Revert "tests: fixed compilation of tst_qtextstream"
This reverts commit 9a6a58a95a,
which was a work-around for a qmake bug, now fixed.

Task-number: QTBUG-19393
Change-Id: Id467bb5907a88f03eac0e29a90f4ff7e97045423
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-15 09:21:14 +00:00
Maurice Kalinowski
acdd57cb43 Fix compilation for WinRT
TEST_HELPER_INSTALLS cannot be used on platforms with no
QProcess support.

Change-Id: I2a6a283d94ca4487fc628449c53fc37140dd291d
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2015-12-14 08:43:15 +00:00
Marc Mutz
a8ff0bc887 tst_QChar: add a check for comparing against int/uint
This is used throughout Qt and resolves to
   operator op(QChar, QChar)

This test makes sure we don't break those
use-cases as we fix missing relational
operators as found by tst_QStringBinOps.

In the other direction, 0 op QChar is
ambiguous, due to op(const char*, QString)
etc, so only test the uint op QChar case.

Change-Id: Ifae7fb65bf3269583898cfea3fc6c95547c75122
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-13 13:14:43 +00:00
Giuseppe D'Angelo
3b093034b6 QFileSystemModel: report special files which are not symlinks
Since special files have file size == -1, they were always filtered
out by QFileSystemModel, even when passing QDir::System as filtering
option. Keep them instead.

The testcase is more convoluted than it should be because QFSM
is so broken that it returns valid indexes for invisible elements
in the model (such as filtered out elements).

Change-Id: I023a9813dbfeed7be99dded42c66b1191afdc17e
Task-number: QTBUG-20968
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-12-13 11:46:17 +00:00
Giuseppe D'Angelo
69efc425b2 QFileSystemModel autotest: fix a broken sort() test
The test was comparing an "unsorted" file listing read from disk
with a reference listing, checking whether the two were different.
Obviously that's a nonsense test, as there's no stable order
for the entries returned by readdir_r and friends.

Change-Id: I1d781a6513c42bb0b585d02e57a771c5336c7df4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-12-12 10:38:53 +00:00
Giuseppe D'Angelo
4b35c91a77 QLineEdit: a validator fixup() should keep it modified; add failing test
I still have no idea how to fix this properly given the absolute mess
of QWidgetLineControl. For now add a failing test.

Change-Id: Ieb5ad6994c8ce7deb0cd0f2f47d51073d042244e
Task-number: QTBUG-49295
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-12-12 07:53:23 +00:00
Juha Turunen
672f7dfdcd Fix a crash when calling QOpenGLTexture::setData with a null QImage.
Change-Id: Idf8ae00cff6929114b38dcb003c259c83a11dbaa
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-12-11 17:58:21 +00:00
Edward Welbourne
8fd05e6289 Don't ignore first character after a string.
The parser in QMakeSourceFileInfo::findDeps() would step over the
closing quote of a string, only to have a for loop then step over the
character just after that closing quote, which was thus never studied;
this could lead to problems in various ways.  Fixed that and expanded
findDeps() test to catch regressions.

Task-number: QTBUG-17533
Change-Id: I7dec5222e38fa188495b39376ffee70bc7bbc87f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-11 13:50:58 +00:00
Giuseppe D'Angelo
824af4aac9 QFileDialog test: make the right subwidget visible
It makes little sense to give focus to a hidden widget; in order
to make the treeview visible, we need to set the view mode to Detail.

Change-Id: I453111e83593a790a656651b603a9c9b1a78dd9d
Task-number: QTBUG-7690
Reviewed-by: Jan Blumschein <jan@jan-blumschein.de>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-10 22:26:01 +00:00
Giuseppe D'Angelo
0d54b0f4dd QFileSystemModel: do not unwatch directories if removal fails
... otherwise we would not detect subsequent file/directories added
into the non-removed one.

Change-Id: I43018dfb9a9c6c0399190800da3f0d572ec5d8d8
Task-number: QTBUG-49307
Reviewed-by: David Faure <david.faure@kdab.com>
2015-12-10 17:07:48 +00:00
Joerg Bornemann
068baa9bb6 add a way to modify CreateProcess parameters
[ChangeLog][QtCore][QProcess] Added method
setCreateProcessArgumentsModifier to QProcess on Windows to enable
users to intercept and modify CreateProcess parameters.

With such a modifier, calling code can decide whether to inherit
handles, modify the STARTUPINFO struct, and pass its own
combination of process flags to CreateProcess.

Task-number: QTBUG-390
Task-number: QTBUG-6917
Task-number: QTBUG-9350
Task-number: QTBUG-24619
Change-Id: I14757dbbacfebb1c89f52402d36fba0ba9c45f3a
Reviewed-by: Björn Breitmeyer <bjoern.breitmeyer@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-10 16:29:33 +00:00
Friedemann Kleint
1289bc8172 Tests: Remove empty init/cleanup slots, constructors and destructors.
Move some code (like registrations of meta types) from init() to
initTestCase() in the process.

Change-Id: I57db5156647cfadab554fbed853b2e68b2815f3b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2015-12-10 05:26:05 +00:00
Giuseppe D'Angelo
872b9b231e QLineEdit: fix the shortcut override events on a readonly line edit
When a QLineEdit is readonly there's a discrepancy between key press
events and shortcut override events. For instance, presses Ctrl+C
copies the text unless there's also a shortcut for the same key sequence.
In this case, the shortcut override event is not handled, and no text
is copied. Fix it by splitting the handling of shortcut override
events between "read only" access (copy, select, etc.), which still
makes sense on a read only line edit, and write access (paste, ...)
which doesn't.

[ChangeLog][Important Behavior Changes][QLineEdit] QLineEdit will
now accept certain shortcut override events even if it is read only.

Change-Id: Ie5b048259b99a1eff0581129e3ad97f27a88fe86
Task-number: QTBUG-21217
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2015-12-09 19:04:59 +00:00
Thorbjørn Lund Martsum
410aa20f07 QAIV - allow users to control single step in ScrollPerPixel mode
The documentation says that we scroll one pixel, but changing the
behavior in 934f062203 to do that
was not well received.

People were relying on the undocumented behavior - and the new behavior
was considered to be a regression. (Nobody called setSingleStep since
Qt in many cases provide a reasonable singleStep - which implied that their
programs scrolled with 1 pixel which was quite slow). Furthermore getting
the old behavior (auto set of single step) was nearly impossible.

However the revert (done in 0e69230d02)
gets us back to QScrollbar::setSingleStep not working in pixel scroll mode
(even without it being documented - but we should also have a working API
rather than documenting that it is not working)

The previous approach was directly prevented Qt from changing
single step (on e.g resize) at all. This patch only prevents Qt from
changing when a user explicitly has called the function
QScrollBar::setSingleStep (in pixel scroll mode).

That is we expect that calls to setSingleStep means that the user actually
wants to set the singleStep and doesn't want Qt to control that value.

Furthermore it is possible to switch back to the automatically adjusted
singlestep with QScrollBar::setSingleStep(-1).

[ChangeLog][QtWidgets][QAbstractItemView] QTBUG-7232 - In ItemViews
when scrollMode is set to scrollPerPixel, it is now possible to
change the single step. Qt will automatically adjust the single step
until setSingleStep is called. When setSingleStep is called it will
however respect the set and stop doing automatic changes of the value.
Calling setSingleStep(-1) will switch mode back to automatic adjust.

Task-number: QTBUG-7232
Change-Id: Ibfe0caa9751d3bcc11bfc6e0654a3d1ac35ac8ae
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2015-12-09 17:53:59 +00:00
Giuseppe D'Angelo
c5e972eb87 QFileDialog: Call reject() on Key_Escape even when itemview has focus
Replace hide() call (present in itemViewKeyboardEvent since Qt 4.5)
by reject(). Add signal spy to existing test function.

QDialog doc states that reject() will always be called on Key_Escape.
hide() is not enough: it makes exec() terminate and return the proper
value, but the signals finished(int) and rejected() will not be sent.

Task-number: QTBUG-7690
Change-Id: Ica4ae2843574478c5b9a7672f871f3ef3f16f3c9
Done-with: Jan Blumschein <jan@jan-blumschein.de>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-09 09:36:00 +00:00
Marc Mutz
6de49f4ab6 QString: where possible, re-use existing capacity in op(QChar/QL1S)
If the LHS is detached and has existing capacity that is large
enough to hold the RHS, re-use the memory instead of allocating
a new buffer and throwing away the old.

Change-Id: I53d42825da92c264c7301e8e771cba9fb35c321b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-08 23:48:12 +00:00
André Klitzing
63827c4d27 Add PointerToMemberFunction for ctor of QSignalTransition
[ChangeLog][QtCore][State Machine] Added constructor overload that
takes a pointer-to-member for the QSignalTransition.

Change-Id: I80ac6e16d0edf7d2ab09882b6f6db4cbd73364e1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-08 17:07:04 +00:00
Edward Welbourne
64ab4de4b0 Teach qmake's #include parser to recognize C++11 Raw strings.
Can't sensibly test unless the compiler does support raw strings,
since any test that would catch qmake's (prior) inability to parse raw
strings would necessarily confuse the C++ compiler in the same way.
This even applies (in test app code) to any #if-ery around the raw
string, since tokenization happens before preprocessor directives are
resolved.  So the #if-ery on Q_COMPILER_RAW_STRINGS has to be in
tst_qmake.cpp, not the test app it builds.

Change-Id: I4a461f515adff288b54fb273fd9996f9b906d11c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-12-08 08:13:32 +00:00
Thiago Macieira
bdd4ddd8fa QNetworkInterface: fix support for address labels on Linux interfaces
Commit 64a1448d87 (Qt 5.2) caused
QNetworkInterface to report address labels (a.k.a. interface aliases) as
separate interfaces. This is caused by the fact that glibc, uClibc and
MUSL copy the address label (netlink address attribute IFA_LABEL) to the
ifa_name field, which made QNetworkInterfaceManager think that it was an
interface it hadn't yet seen.

Address labels are the old way to add more than one IP address to an
interface on Linux, for example:
    ifconfig eth0:1 192.0.2.2

Those do not create a new interface, so the "eth0:1" label maps to the
same interface index as the parent interface. This has been deprecated
for 10 years, but there are still tools out there that add addresses in
this manner.

This commit restores behavior compatibility with Qt 4.2-5.1. The Qt
5.2-5.5 behavior is incorrect because it reports more than one interface
with the same index. On systems configured like the above, the
tst_QNetworkInterface::interfaceFromXXX test was failing.

Change-Id: I8de47ed6c7be4847b99bffff141c2d9de8cf7329
Reviewed-by: Richard J. Moore <rich@kde.org>
2015-12-08 06:32:22 +00:00
Thiago Macieira
401507b348 Fix constructing a QSharedPointer<const> of a QEnableSharedFromThis type
It should compile, since the std::shared_ptr does.

[ChangeLog][QtCore][QSharedPointer] Fixed a problem that would cause a
compilation error when constructing a QSharedPointer of a const type
when the type derives from QEnableSharedFromThis.

Task-number: QTBUG-49748
Change-Id: I8de47ed6c7be4847b99bffff141c84f5e0b6bea8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-12-08 06:32:20 +00:00
Thiago Macieira
7499e642e0 QVariant: retain duplicate keys when converting
Task-number: QTBUG-49520
Change-Id: I3e15a26e0e424169ac2bffff1417e3f4398c2277
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-08 06:32:18 +00:00
Simon Hausmann
3ec31ef9c5 Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I2532c7f7db5e6cc3ef09753d886279816dd662b2
2015-12-08 07:09:47 +01:00
Marc Mutz
1264c22b86 QAbstractItemView: replace a QPair with a dedicated struct
In a QPair, the member names {first, second} have no semantic
value. A simple struct, while not as featureful as QPair, can
be given meaningful member names, {rect, index}, in this case.

Change-Id: If1e289ecee82a1cb020ac3a854efd2ec1096493b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2015-12-07 13:41:13 +00:00
Louai Al-Khanji
f0a6d45cc8 qt_poll: split out into separate file and sanitize build
The qt_poll function calls recv to query whether fds marked by select
as readable should be marked POLLIN or POLLHUP in the pollfd structure.
On many platforms such as QNX this requires extra link-time libraries
which were not previously required by QtCore.

While the qt_poll function is intended as a fallback mechanism only for
those platforms which do not implement poll natively, the function was
compiled unconditionally whenever QT_BUILD_INTERNAL was defined, e.g.
in developer builds.

Additionally the function was included on those systems that define poll
in system headers so that configure determines build-time availability,
but do not define _POSIX_POLL > 0 or indicate POSIX:2008 compliance via
either the _POSIX_VERSION or _XOPEN_VERSION macros. On those systems a
sysconf query for _SC_POLL was performed to determine at runtime whether
to call the system poll or qt_poll.

Both of these cases are in fact counterproductive. In the first case the
sole consumer of the function is a single manual unit test. In the
second, to my knowledge no platform requires the runtime fallback.
Despite that, we were forcing an extra dylib in both cases.

Both cases are fixed by 1) moving the implementation into its own file
for the unit test to include and 2) dropping the dynamic fallback if
configure determines availability of poll at compile-time.

This also reverts commit 1377709711, which
added -lsocket for QtCore on QNX.

Change-Id: I2dd10695c5d4cac81b68d2c2558797f3cdabc153
Reviewed-by: James McDonnell <jmcdonnell@qnx.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-05 00:47:36 +00:00
Jan Arve Saether
118d5dc496 Skip testing empty window sizes on Windows
Change-Id: Ib4f3bc63196527583a274180c40d0f7847e13f55
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-04 15:13:59 +00:00
Allan Sandfeld Jensen
c04e7dead8 QImage pixelColor and setPixelColor must use unpremultiplied QColor
QColor always uses unpremultiplied alpha, but the new QImage methods
were based on the QRgb versions which might be either. This patches fixes
the two new methods so they treat QColor alpha correctly.

Change-Id: I78a5b875ad4e78ad7fde3b811c6187482b4f6d15
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2015-12-04 09:54:39 +00:00
Friedemann Kleint
2366ecfb2d Manual dialog test: Build also when QtPrintSupport is not available.
Fixes the build on WinRT.

Change-Id: I68510b70b61433ceed6bf06a31424f93a02230dc
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@theqtcompany.com>
2015-12-03 15:55:47 +00:00
Friedemann Kleint
d93a4158e0 tst_QLocalSocket::threadedConnection(): Add failure message.
Introduce QVERIFY2() to get some information when exactly it fails.

Change-Id: Icaddf2ecae434d0bafc90c18458c5ee067dfd506
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-03 15:03:17 +00:00
Liang Qi
72f5867f14 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/kernel/qcoreapplication.cpp
	src/corelib/kernel/qeventdispatcher_blackberry.cpp
	src/network/bearer/qnetworkconfiguration.cpp
	src/plugins/bearer/blackberry/qbbengine.cpp
	src/plugins/platforms/android/androidjnimain.cpp
	src/plugins/platforms/android/qandroidplatformtheme.cpp
	src/plugins/platforms/qnx/qqnxbpseventfilter.cpp
	src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp
	src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
	src/plugins/platforms/qnx/qqnxintegration.cpp
	src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
	src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
	src/plugins/platforms/qnx/qqnxwindow.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	src/widgets/styles/qwindowsvistastyle.cpp
	src/widgets/styles/qwindowsxpstyle.cpp
	src/widgets/widgets/qtoolbararealayout.cpp
	tests/auto/corelib/global/qflags/qflags.pro
	tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
	tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
	tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp

Change-Id: I37be88c6c185bb85404823353e027a0a6acdbce4
2015-12-02 23:33:06 +01:00
Jake Petroules
4f1b6749c3 Fix possible null pointer dereferences.
This follows up 130c2baa93.

Change-Id: I2f6c9b4f995af427cec9a2162b782039debf8564
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-02 16:32:12 +00:00
Tony Sarajärvi
609aaf64dc Remove insignificant flag for qstatictext test
Task-number: QTBUG-28593
Change-Id: Idcffe328dcb8d17b12244574518bb091157ae41e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-12-02 16:31:41 +00:00
James McDonnell
d76be5530a Use correct test to add C++14 to the project configuration
Only add C++14 to the project configuration when C++14 support is
available on the platform.  Adding it because the platform supports
C++11 doesn't work when the platform _only_ supports C++11 (e.g.,
QNX 6.6.0).

Task-number: QTBUG-49491
Change-Id: I15de38bb06d912a314b9dd18c80b513cc06a855e
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-01 15:46:31 +00:00
James McDonnell
72de2ae317 Add a file to the TESTDATA list
The file exists but it isn't listed in TESTDATA.  This is only a problem
when the target is a another system as is the case with Qt for QNX.
Tests fail because the file isn't deployed.

Noticed this while testing the changes for custom spacing of JSON
output.

Task-number: QTBUG-47437
Change-Id: I098c34d2ab9027956d9233b24f30b5192ecfe96f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-12-01 14:52:33 +00:00
Friedemann Kleint
5f00d18ad3 Windows QPA: Fix window state transition from minimized to normal.
Use SW_SHOWNORMAL instead SW_SHOWNOACTIVATE as a parameter to
ShowWindow() to enforce the window to be restored to normal state,
even if the state before minimized was maximized.

Task-number: QTBUG-48449
Change-Id: I9436623b1495f574a72050e50e8b31bfc83ced5c
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2015-12-01 12:48:37 +00:00
Louai Al-Khanji
105fc117b7 Add qt_safe_poll
This function is introduced to safely provide poll(2)-like semantics for
socket multiplexing on Unix-like platforms. For platforms where no poll
system call is available, an implementation based on select(2) is provided.

Change-Id: I320e97dae5924316675a74d1897c48cae292ac6d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-01 00:13:41 +00:00
Lars Knoll
197da3d220 Use QCollator for sorting in the filesystem model
The old code was extremely inefficient, and QCollator
can provide the same functionality in a much better
and faster way.

Task-number: QTBUG-30902
Change-Id: Iaf5dbe587d9a6ebca26885259fdee74a29d3c84f
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-30 12:21:54 +00:00
Jędrzej Nowacki
2e00500b9f Fix conversion QVariant(QColor) to QString.
QVariant was using QColor::name() to convert a color to string, which by
default loses alpha value. The patch is fixing the problem by always
including the alpha value in the string when required.

[ChangeLog][Core][Variant] QVariant(QColor)::toString() uses
QColor::HexArgb format when the alpha component is different from 1.

Task-number: QTBUG-37851
Change-Id: I887460c1ea151180ba99d64dd873ba9d6e2268f2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-11-30 12:10:49 +00:00
Tony Sarajärvi
63c3515a87 Update bug ID after insignificant flag
Task-number: QTBUG-49630
Change-Id: I2dba72dd81f267b90ce5b44f68221fdf72b4af41
Reviewed-by: Heikki Halmet <heikki.halmet@theqtcompany.com>
2015-11-29 07:02:40 +00:00
Tony Sarajärvi
b857d4ca8f Remove insignificant flag for a platform not supported
VS2010 is not supported in Qt5.7+

Change-Id: I9961c49750d39dd92b593ae4c29e11d57a3fbbfa
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-29 07:02:20 +00:00
Friedemann Kleint
4eea99788b Fix closing a QMenu by pressing Alt.
In QMenuPrivate::hideMenu(), delay clearing of 'causedPopup.widget'
to after the QMenu::close() call, so that it is still accessible
in QMenu::hideEvent() which calls QMenuBarPrivate::setCurrentAction(0)
if the caused widget is a QMenuBar.

Task-number: QTBUG-47377
Task-number: QTBUG-49592
Change-Id: Idbda48e918dae799afea84068a60d7383d7b4971
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-11-27 22:50:33 +00:00
Friedemann Kleint
884e3bdd5d tst_QItemModel: Use a QTemporaryDir for test data of QDirModel.
Change-Id: I5943c6656da93d36e1955ac038bf656831da0c5c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-27 22:50:26 +00:00
Friedemann Kleint
fb69a09a24 QWidget::mapTo/FromGlobal(): Avoid calling QWindow helpers until shown.
The platform window geometry can be misleading until it has
been properly positioned and
QWindowPrivate::resizeEventPending has been cleared.

Task-number: QTBUG-49588
Task-number: QTBUG-48396
Change-Id: Ie065f62478fc8522a9ad51391bb897510afa5aad
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-11-27 22:50:17 +00:00
Marc Mutz
4aedfcc4b9 Clean up tst_qlabel
Remove unused ctors and dtor, add Q_OBJECT, indent,
privatize slots, don't check for nullptr before
delete'ing a pointer, and add one override keyword.

Setting test_box (a QPointer) to nullptr is already
done by the variable's default ctor.

Change-Id: I13f06dc8104ef1c0ac08a25c960641c076f10499
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-11-27 17:47:11 +00:00
Liang Qi
37a55e8840 Merge "Merge remote-tracking branch 'origin/5.5' into 5.6" into refs/staging/5.6 2015-11-27 19:24:34 +00:00
Friedemann Kleint
45f7512bf5 tst_QThreadPool::tryStartCount(): Wait until tasks have finished.
Replace hardcoded interval by QTRY_COMPARE() ensuring that all tasks have
finished, since otherwise QThreadPool::tryStart() fails in the next run.

Remove blacklisting for MSVC2012 since it is not compiler-specific.

Task-number: QTBUG-49654
Change-Id: If49b6eb9ef4da4ba2911839166c397d84c175e00
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-27 10:58:24 +00:00
Liang Qi
8c57e8c012 Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	src/network/socket/qnativesocketengine_p.h
	src/network/ssl/qsslsocket_mac.cpp
	src/network/ssl/qsslsocket_mac_p.h
	src/widgets/kernel/qwidget.cpp

Change-Id: I39592cb37d710dfaf8640769ba3c1b637927d7f4
2015-11-27 08:35:45 +01:00
Simon Hausmann
ea5f40a788 Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: Ib43c6f126998eefcfed9a7c1f2bcbac8b4dd05ec
2015-11-27 08:27:53 +01:00
Friedemann Kleint
adc4894fca tst_QProcess: Use a QTemporaryDir for files to be created.
Ensure the test works in a working directory with read-only
permission and that the file names are unique.
The test can then be executed repeatedly by COIN even in case
left-over hanging process helpers still lock the files. Also
disambiguate the "data" files used by various tests.

Task-number: QTBUG-47370
Change-Id: I3b9c7b70828da78f400196fcbba27bc61ea4538f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-26 15:53:34 +00:00
Friedemann Kleint
ee632a21f6 tst_QWaitCondition::wakeOne(): Increase wait interval.
Introduce constants and make the interval for the 2nd thread a bit
longer.

Task-number: QTBUG-49653
Change-Id: I92ac0494ec6c9af5bde858007d08e26210215434
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-11-26 15:51:07 +00:00
Friedemann Kleint
19e295b330 tst_QWaitCondition: Prevent test functions from interfering with each other.
Introduce a base class for the threads that ensures termination in the
destructor to ensure all QThreads instantiated on the stack are terminated.
This should reduce crashes since the test thread classes have pointers
to stack variables of the test slots.

Set object names on the threads for better diagnostics.

Decouple wakeOne()/wakeAll() that impact each other via the static count
variables of the thread class by introducing a base class WakeThreadBase
keeping a pointer to an QAtomicInt count variable on the stack instead
(similar to the existing pointers to the mutexes, etc).

Task-number: QTBUG-49653
Change-Id: I73537386bf36019efa81e8e24ba9af92506f7794
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2015-11-26 15:50:36 +00:00
Marc Mutz
5e6816114d QPair: add compile test involving pair with contained C array
Task-number: QTBUG-48780
Change-Id: Ic53121d9251bfdc905c2ed28d1d9716a475e2f5b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-11-26 15:11:50 +00:00
Marc Mutz
12a9d6be28 QPair: add tests for conversion ctor/assignment operators
Change-Id: Id54ada05f477aa3262ad99d82bc243c3d17e06f0
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-11-26 15:11:32 +00:00
Friedemann Kleint
eaf160c586 Add a manual test for cursors in multi-screen/High DPI setups.
Change-Id: I4c0baeaf01f0b3d6162a16ef7fda822f5a4cb1db
Task-number: QTBUG-49511
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2015-11-25 20:50:30 +00:00
Friedemann Kleint
3c56e33a27 tst_QProcess: Remove macro QPROCESS_VERIFY().
It was used to verify waitForFinished() and printed QProcess::errorString()
on failure, which is misleading, since the process is not
in an error state - it is still running. Example:

QWARN  : tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() QProcess error: 5: Unknown error
FAIL!  : tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() 'ret' returned FALSE. ()

Use a plain QVERIFY instead.

Task-number: QTBUG-47370
Change-Id: Iacfa6e1a5ffd2be4e1257a27a400ccc59671e8c8
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-25 20:50:18 +00:00
Friedemann Kleint
2182d6ae40 tst_QItemModel: Register QAbstractItemModel::LayoutChangeHint.
Silence warning:
Don't know how to handle 'hint', use qRegisterMetaType to register it.

Task-number: QTBUG-49623
Change-Id: Iec0a823c7af87eddd9a3f126a1b970da1ff2f03f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-11-25 20:49:51 +00:00
Eskil Abrahamsen Blomfeldt
50cd0daf29 Fix kerned advances in QRawFont on OS X and Windows
On Windows, the wrong value was used to calculate the
design-to-device scale. The assumption has been that tmHeight
in the TEXTMETRIC is the pixel size of the em square, but
it is not, it's the height of the font (ascent + descent).
The pixel size of the font is defined to be the em square size
in pixels.

On OS X, the kerning data was never actually read from the
font. I've added a lazy initialization for this similar to
the one in the FT engine.

This was discovered when investigating QTBUG-48546, as it turned
out that the kerning information extracted by Qt in this case was
different from the one used by Harfbuzz.

I've changed testfont.ttf to kern "_2" so that the digit is positioned
directly on top of the underscore and constructed a test.

[ChangeLog][QRawFont] Fixed kerning on advances in QRawFont for
OS X and Windows.

Change-Id: Ic9a321ad119ea880cef89b861c75a820ab8d3182
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-11-25 19:53:46 +00:00
Tony Sarajärvi
1e761c80cf Remove insignificant from qglfunctions test
Task-number: QTBUG-26390
Change-Id: If80bf9d05a16e0d1c5933632ac96fe6c3d3df273
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2015-11-25 15:51:23 +00:00