summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
| | | * Improve performance of QColor::name, now more than 4 times fasterDavid Faure2016-08-054-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: HexRgb: 0.00230 ms per iteration, HexArgb: 0.00290 ms per iteration After: HexRgb: 0.00051 ms per iteration, HexArgb: 0.00061 ms per iteration This showed up as a relevant optimization when profiling KIconLoader which uses QColor::name() as part of the key -- thanks to Mark Gaiser for the investigation and first suggestion of a solution. I have also seen customer code writing a replacement for QColor::name() because it was too slow to be used as a hash key. Change-Id: I009ccdd712ea0d869d466e2c9894e0cea58f0e68 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | | * QNativeSocketEngine::option(): return a correct value on invalid callAlex Trotsenko2016-08-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of 'true', it should be '-1'. Change-Id: I5e8f99153da68d34b37477ef4cedbc447fba347f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | | HTTP/2 - fix QT_NO_SSL buildTimur Pocheptsov2016-08-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recently enabled cleartext fails to build with QT_NO_SSL - fix test and QNAM. Change-Id: I467edab8e4eb5113715ad2d3b3022e0d8c027de8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Long live QDeadlineTimerThiago Macieira2016-08-153-0/+631
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's like QElapsedTimer, but marks a time in the future instead. [ChangeLog][QtCore] Added QDeadlineTimer, a counterpart to QElapsedTimer, used to mark a time point in the future (a deadline) and determine whether such a deadline has passed. Change-Id: Ifea6e497f11a461db432ffff144921f7fbc1d1d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | QSslDiffieHellmanParameters: make fit for releaseMarc Mutz2016-08-122-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add missing \since 5.8 on free functions - fix \relates of qHash to point to QSslDHP, not QHash, which is in another module - API fix: use named instead of unnamed ctors - share code between ctors - API fix: add inline move ctor (for now, this requires using a naked d pointer, which isn't much of a problem, since the class is immutable). Change-Id: Ic30f9c3c03b8a3798e0676e38991ead85c587214 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
| * | | Make imageAt and formatAt more robus against different font metricsSimon Hausmann2016-08-122-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't try to locate the text by coordinates at the edge of the text but simply aim at the center vertically _and_ horizontally. Task-number: QTBUG-52991 Change-Id: Ia9e84fc5d12491840e739c4eea730fe13058f3c7 Reviewed-by: Simo Fält <simo.falt@theqtcompany.com>
| * | | Darwin: Add QImage::toCGImage() conversion functionMorten Johan Sørvig2016-08-111-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Move QT_FORWARD_DECLARE_CG to qglobal.h) This function converts to CGImage for supported formats. This is done by creating a CGImageRef that reuses the QImage data. The CGImage and QImage ref counting systems are bridged, implemented by using CGDataProvider that holds a copy of the QImage. Unlike the previous internal implementation this public version does not implicitly convert unsupported formats to ARGB32_Premultiplied. See included documentation for the complete description. Change-Id: Ie3984a7a8331e02a6f1c42943caaf76854e93538 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
| * | | Enable cleartext HTTP/2 and bring the auto-test back to lifeTimur Pocheptsov2016-08-115-70/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HTTP/2 does not require TLS connection, it can work in a cleartext mode. Plus at the moment only OpenSSL backend allows HTTP/2 negotiation via ALPN/NPN (and none of our CI configurations with OpenSSL supports these extensions, rendering HTTP/2 auto-test useless). This patch implements cleartext HTTP/2 ('h2c') in 'direct' mode - this is allowed if a client has a prior knowledge that HTTP/2 is supported by a server. Change-Id: I4978775e9732c40bc77f549b83bb4a5d1761887e Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | | remove redundant x11 handlingOswald Buddenhagen2016-08-103-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one of the effects of CONFIG+=x11 is LIBS+=$$QMAKE_LIBS_X11, so it's positively pointless for project files to do the same. Change-Id: I4085acd6254401897b34e131c2cb57f1f76a3638 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | add support for returning the command's exit status to $$system()Oswald Buddenhagen2016-08-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and make use of it in qtRunLoggedCommand(). Change-Id: I242dfde344f555800cef1f55d3cb85418a93277f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | Fix QZip autotest and enable QZip and QTextOdfWriter tests againOswald Buddenhagen2016-08-102-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | don't refer to non-existent feature 'OdfWriter', and test these classes if we have a developer build. Change-Id: I59b0d4bbba4958ed3bd76f504cd8b493dbd7f877 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
| * | | Add a benchmark for QReadWriteLockOlivier Goffart2016-08-103-0/+190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Results on current dev branch [955b2bdfc0cb1d707f8914be230e5e00c548b6ab]: thread count: 4 ********* Start testing of tst_QReadWriteLock ********* Config: Using QtTest library 5.8.0, Qt 5.8.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 6.1.1 20160707) PASS : tst_QReadWriteLock::initTestCase() PASS : tst_QReadWriteLock::uncontended(nothing) RESULT : tst_QReadWriteLock::uncontended():"nothing": 1,113,292.1 CPU ticks per iteration (total: 11,132,922, iterations: 10) PASS : tst_QReadWriteLock::uncontended(QMutex) RESULT : tst_QReadWriteLock::uncontended():"QMutex": 35,490,310.7 CPU ticks per iteration (total: 354,903,108, iterations: 10) PASS : tst_QReadWriteLock::uncontended(QReadWriteLock, read) RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, read": 40,513,695.0 CPU ticks per iteration (total: 405,136,950, iterations: 10) PASS : tst_QReadWriteLock::uncontended(QReadWriteLock, write) RESULT : tst_QReadWriteLock::uncontended():"QReadWriteLock, write": 43,179,327.2 CPU ticks per iteration (total: 431,793,272, iterations: 10) PASS : tst_QReadWriteLock::uncontended(std::mutex) RESULT : tst_QReadWriteLock::uncontended():"std::mutex": 37,733,243.0 CPU ticks per iteration (total: 377,332,430, iterations: 10) PASS : tst_QReadWriteLock::uncontended(std::shared_timed_mutex, read) RESULT : tst_QReadWriteLock::uncontended():"std::shared_timed_mutex, read": 71,517,438.7 CPU ticks per iteration (total: 715,174,388, iterations: 10) PASS : tst_QReadWriteLock::uncontended(std::shared_timed_mutex, write) RESULT : tst_QReadWriteLock::uncontended():"std::shared_timed_mutex, write": 69,967,867.5 CPU ticks per iteration (total: 699,678,676, iterations: 10) PASS : tst_QReadWriteLock::readOnly(nothing) RESULT : tst_QReadWriteLock::readOnly():"nothing": 479,393,335.3 CPU ticks per iteration (total: 4,793,933,354, iterations: 10) PASS : tst_QReadWriteLock::readOnly(QMutex) RESULT : tst_QReadWriteLock::readOnly():"QMutex": 823,493,383.2 CPU ticks per iteration (total: 8,234,933,832, iterations: 10) PASS : tst_QReadWriteLock::readOnly(QReadWriteLock) RESULT : tst_QReadWriteLock::readOnly():"QReadWriteLock": 559,816,053.6 CPU ticks per iteration (total: 5,598,160,536, iterations: 10) PASS : tst_QReadWriteLock::readOnly(std::mutex) RESULT : tst_QReadWriteLock::readOnly():"std::mutex": 961,903,416.3 CPU ticks per iteration (total: 9,619,034,164, iterations: 10) PASS : tst_QReadWriteLock::readOnly(std::shared_timed_mutex) RESULT : tst_QReadWriteLock::readOnly():"std::shared_timed_mutex": 1,786,254,363.5 CPU ticks per iteration (total: 17,862,543,636, iterations: 10) PASS : tst_QReadWriteLock::cleanupTestCase() Totals: 14 passed, 0 failed, 0 skipped, 0 blacklisted, 44507ms ********* Finished testing of tst_QReadWriteLock ********* Change-Id: I42189f7a356dcb36378e9d54111b7fbe89e62402 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/devLiang Qi2016-08-098-288/+299
| |\ \ \
| | * | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-098-288/+299
| | |\| | | | | | | | | | | | | | | | | Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
| | | * | QHeaderView: Reset lastSectionLogicalIdx on clear()Ulf Hermann2016-08-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Otherwise we can fail to stretch the last section when adding new sections. Task-number: QTBUG-52446 Change-Id: I7eb5267ac500bf4246e57c3e3a43268bb65ef1f7 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
| | | * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-057-288/+294
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
| | | | * QString: fix append(const QStringRef &str)Anton Kudryavtsev2016-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use QStringRef::isNull instead of QStringRef::string() for validation. Non-NULL str.string() may yet leave us with a useless str.unicode(), which is the actual problem here; whereas !str.isNull() does really confirm that str.unicode() is sensible. Such test prevents situation like: const QString a; QString b; b.append(a); // b.isNull() == true b.append(QStringRef(&a)); // b.isNull() == false Auto test updated: create QStringRef from QString directly, without any condition. Change-Id: I082cd58ef656d8a53e3c1223aca01feea82fffb9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | | | * QLocalSocket/Tcp: open device before making a connectionAlex Trotsenko2016-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to QLocalSocket's documentation, connectToServer() must initiate a connection attempt after opening the device. Otherwise, if a connection succeeds immediately, connected() signal will be emitted on closed device. So, this patch ensures that TCP-based implementation behaves correctly. Change-Id: I4cc9474815e091a1491a429a6dc17f9cf0154f58 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | | * Don't call virtual functions with data from an old modelBogDan Vatra2016-08-041-2/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I4f1ec56ce722110042f72761bbc2976e580b7149 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | | | * Fixed Bug in QVariant comparison when containing QStringListsClemens Sielaff2016-08-031-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As it were, QStringLists were not handled explicitly when comparing QVariants. If both QStringLists contained only a single entry, they were treated as QStrings - if both QStringLists were empty, there were equal (correctly so) - but if one of the QStringLists had more than one entry, the compare function fell through to returning always 1. As discussed here: https://stackoverflow.com/a/38492467/3444217 Added rich comparison tests for all non-numerical, non-recursive QVariants that support them (except QModelIndex and QPersistentModelIndex) Task-number: QTBUG-54893 Change-Id: Icc5480d9ba056ee5efe83da566c5829caa1509d7 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
| | | | * tst_QTreeView: Fix UB (invalid downcast, member call)Marc Mutz2016-08-011-70/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported by UBSan: tst_qtreeview.cpp:2187:36: runtime error: downcast of address 0x7ffc15749f20 which does not point to an object of type 'PublicView' 0x7ffc15749f20: note: object is of type 'QTreeView' Fix by making the test a friend of QTreeView (and, for Clang, of QAbstractItemView) instead. Change-Id: I5b748696ab441a91058f4d45a18bd5ed75a6e560 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | | | * tst_QAbstractItemView: Fix UB (invalid downcast, member call)Marc Mutz2016-08-011-178/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported by UBSan: tst_qabstractitemview.cpp:336:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView' 0x7ffe6fe96e10: note: object is of type 'QListView' tst_qabstractitemview.cpp:337:5: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView' 0x7ffe6fe96e10: note: object is of type 'QListView' tst_qabstractitemview.cpp:338:23: runtime error: member call on address 0x7ffe6fe96e10 which does not point to an object of type 'TestView' 0x7ffe6fe96e10: note: object is of type 'QListView' [etc ...] Fix by making the test a friend of QAbstractItemView instead. Change-Id: I1a08977042296eb34e9dbdb5c0595662dbd2e5ef Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | | | * QSortFilterProxyModel: Don't forward the hint from source's layoutChanged signalOlivier Goffart2016-08-011-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't forward a VerticalSortHint or HorizontalSortHint hint, because we might be filtering extra items. The documentation of QAbstractItemModel::LayoutChangeHint states: Note that VerticalSortHint and HorizontalSortHint carry the meaning that items are being moved within the same parent, not moved to a different parent in the model, and not filtered out or in. And some of the views rely on this assumption (QQmlDelegateModel for example) What happens in the test is the following: - 'model' emit the dataChanged signal when its data is changed. - 'proxi1' QSortFilterProxyModelPrivate::_q_sourceDataChanged does not forward the dataChanged signal imediatly, it will instead first re-sort the model and call layoutAboutToBeChanged / layouChanged with the VerticalSortHint - 'proxy2' would forward the layoutAboutToBeChanged with the hint, but in QSortFilterProxyModelPrivate::_q_sourceLayoutChanged, it will redo the mapping which will cause the changed data to be filtered. So proxy2 can't forward the VerticalSortHint as it removed rows in the process. Change-Id: I20b6983e9d18bf7509fe6144c74f37d24e4a18c2 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: David Faure <david.faure@kdab.com>
| | | | * Fix UB (invalid enum value) in tst_QTreeViewMarc Mutz2016-07-311-30/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported by UBSan: tst_qtreeview.cpp:663:5: runtime error: load of value 4294967295, which is not a valid value for type 'DragDropMode' Instead of abusing -1 to indicate to not set the dragDropMode, use a separate boolean field in tha data. Change-Id: I13e7539c858f3b2462d57d660062ef3cb7aec61b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | | | * QUrl: fix resolved() for data URLsDavid Faure2016-07-291-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They look relative because the path doesn't start with a '/' but they have a scheme so they shouldn't be combined as if it was one absolute and one relative URL. [ChangeLog][QtCore][QUrl] QUrl::resolved() no longer treats a URL with a scheme as a relative URL if it matches this URL's scheme. This special casing was incompatible with RFC 3986 and broke resolving data: URLs, for instance. Change-Id: I3758d3a2141cea7c6d13514243eb8dee5d510dd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | | winrt: update testsMaurice Kalinowski2016-08-091-3/+7
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | Update due to behavior differences between win32 and winrt. Change-Id: I39532de98c25cd67da49cbb20d42dccc803f1805 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * | | winrt: Make test functionalMaurice Kalinowski2016-08-091-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The adoptedThreads test never spawned any thread causing a test error later on. Hence add a winrt version using __beginthreadex which exists for that platform. Change-Id: I04f980218713df20cb41d804d732e0c99b958489 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
| * | | Make sure QDBusConnection::connect() returns false if already connectedThiago Macieira2016-08-091-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDBusConnection::connect() behaves like QObject::connect with a connection type of Qt::UniqueConnection | Qt::QueuedConnection. So return false if it's already connected. [ChangeLog][QtDBus][QDBusConnection] Fixed a bug that would cause QDBusConnection::connect() to return true if a slot was already connected to the same D-Bus signal. QtDBus does not support multiple connections. Change-Id: I87e17314d8b24ae983b1fffd1453aef5a7c9ad0b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * | | print no message at all when no argument is supplied to error()Oswald Buddenhagen2016-08-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is useful when an adequate message has already been emitted by other means, like various built-ins do. Change-Id: I092771f55969fad8b214204d666327664727c572 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | tst_QString: clean upMarc Mutz2016-08-171-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add Q_DECLARE_TYPEINFO for types held in Qt containers (incl. QVariant) - port Q_FOREACH to C++11 range-for - port uses of inefficient QLists to QVector Fixes errors pointed out by my tree's static checks. Change-Id: I7176b4b12ed47ed23166857bd127c459ea2a48d5 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | tst_QStyleSheetStyle: Extract Method sample_widgets()Marc Mutz2016-08-171-28/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only difference between the sample widget sets was: - widgets << new QLabel("TESTING TESTING"); + widgets << new QLabel("<b>TESTING TESTING</b>"); I chose the latter, because it's the more complex example and neither the hoverColors nor focusColors tests suggest the boldness of the text matters. Part of port away from Q_FOREACH. Change-Id: I9a928de4e781b96ad00a8c9515977c35ebfa6c24 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | Added capHeight() to QRawFont and QFontMetrics(F)Konstantin Tokarev2016-08-153-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cap height is an important metric of font, in particular it is required to make decent implementation of "initial-letter" CSS property in QtWebKit. Note that some fonts lack cap height metadata, so we need to fall back to measuring H letter height. Change-Id: Icf69d92159d070889085e20d31f2e397d796d940 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | | tst_QRegularExpression: clean upMarc Mutz2016-08-151-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - port Q_FOREACH to C++11 range-for (incl. one case of iterating over QHash::keys()) - port uses of inefficient QLists to QVector - add Q_DECLARE_TYPEINFO for types held in Qt containers Fixes errors pointed out by my tree's static checks. Change-Id: I30eb432528fa3008240b5c217d5f2f9ddc3679be Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | | | QSharedPointer: clean up #ifdefsMarc Mutz2016-08-151-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We require Q_COMPILER_RVALUE_REFS and _VARIADIC_TEMPLATES since Qt 5.7, so remove the non-variadic version which anyway has zero test coverage. Also drop #include <utility>, as that is included from qglobal.h already, and drop QSKIP from test. Change-Id: I1fc7f7068eac80ad6fd85e1d8f6d33c5c7bb67db Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | | Avoid synthesizing stretch on condensed font familiesAllan Sandfeld Jensen2016-08-152-2/+20
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an entire font family is condensed or stretched and we match by family name, the default stretch factor of 100 will make the font engine try to synthesize it back to medium stretched font. The existing code is already made to deal with a stretch of 0 that is no longer used. This patch reintroduces 0 stretch to indicate no specific stretch has been requested. Specifically setting stretch to 100 on a QFont will introduce the old behavior. [ChangeLog][QtGui][QFont] The default value of QFont::stretch() is now 0 to indicate any default stretch is acceptable. Task-number: QTBUG-48043 Change-Id: I574747f980fd4f9893df828818aae99a07b41623 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* | | tests/auto/corelib/codecs: clean upMarc Mutz2016-08-061-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - port Q_FOREACH to C++11 range-for - port uses of inefficient QLists to QVector Fixes errors pointed out by my tree's static checks. Change-Id: Ica50f44d862f635df06cb8f09ce506b9d30fdfc5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | tst_utf8: use QScopedPointer, not QSharedPointerMarc Mutz2016-08-061-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no sharing, and the use of QSharedPointer(T*) triggers my tree's static analyzer. Easiest fix is to port to QScopedPointer, which is the correct smart pointer to begin with. Change-Id: I105c1a334c3d6712a475600c8394b0bebc420677 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | tests/auto/corelib/global: clean upMarc Mutz2016-08-062-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - port Q_FOREACH to C++11 range-for (except in the Q_FOREACH tests :) - port uses of inefficient QLists to QVector - include QTest, not QtTest Fixes some errors pointed out by my tree's static checks. Change-Id: Ibb21a280537af74dda5679ec7c75d59477b6de55 Reviewed-by: David Faure <david.faure@kdab.com>
* | | tst_QPainterPath: clean upMarc Mutz2016-08-051-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - port uses of dynamic containers with static content to constexpr C arrays Fixes errors pointed out by my tree's static checks. Change-Id: I5e1cafa6e428500afae0d653ce48a7fb465c19ed Reviewed-by: David Faure <david.faure@kdab.com>
* | | QString: fix regression comparing null QString with null const char *Marc Mutz2016-08-051-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 4a40c717f3cf1ae181df49c91261a12d5e33e5a4 optimized QString::compare_helper(QChar*, int, char*, int), but got the case wrong where the rhs is null, but the lhs is empty, not null (which is the case even with a null QString, as QString().constData() != nullptr). The correct result in this case is 0, since in Qt empty and null strings compare equal. Fix by checking the length of lhs, not its pointer. Task-number: QTBUG-55154 Change-Id: I3ec2cd25d9bdca90cf3f5568a875b1e52c779979 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | QJsonValue::toVariant(): Differentiate between null and invalidChristian Kandeler2016-08-051-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both were mapped to QVariant() before. Instead, use a null pointer QVariant for a null JSON value. [ChangeLog][QtCore][QJsonValue] QJsonValue(Null).toVariant() now returns a QVariant of type QMetaType::Nullptr instead of an invalid QVariant. Task-number: QTBUG-43077 Change-Id: Ife611f418583dbff542210bc8c5cd65201212a6e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | QPolygon: add a smoke-test for boundingRect()Marc Mutz2016-08-041-0/+77
| | | | | | | | | | | | | | | | | | | | | Nothing fancy, just a safety-net for a following refactoring. Change-Id: I5be87c86cd61e24bf96881d2485dd7560ea6184a Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | | Fix grayscale painting regression in 64-bit raster engineAllan Sandfeld Jensen2016-08-032-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new define for better vectorized compositioning had a mistake that caused some sources to be converted to grayscale when composited. Added two 10 bit per channel formats to the lancelot test to catch regressions in the future. Change-Id: I1c468e6b93d68185e517fc0d44c6c927f9f7135f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Add std::nullptr_t as builtin type in QMetaTypeJędrzej Nowacki2016-08-031-0/+4
| | | | | | | | | | | | | | | | | | Change-Id: If6c484bc89a2610c6a9e3e7bd54ef85ef40a783f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | Save QFont's style name if presentKonstantin Shegunov2016-08-031-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Font style names are quite irregular and the simplistic matching implemented in QFontDatabase::styleString(const QFont &) is unable to properly resolve the style name when font is recreated from a string. This causes the fonts before and after serialization to be considered different, even though they are not. The from/toString methods were made to write and respect the exact font style. [ChangeLog][QtGui][Important Behavior Changes] QFont::toString() and QFont::key() were modified to save the font's style name if one is set, invalidating any stored font identifiers. QFont::fromString() was also adjusted to accommodate the change. Task-number: QTBUG-54936 Change-Id: Ibc7c54119acdd8f0950d6049cc89f859bf981504 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | | Fix some syntax issues in SCTP implementationAlex Trotsenko2016-08-031-13/+12
| | | | | | | | | | | | | | | | | | Change-Id: I718fd060e313d544a5470fa20183db04ef89b1ca Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | QObject::connect: allow to disable narrowing of the connection argumentsGiuseppe D'Angelo2016-08-021-0/+510
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the good features of the new connection style is that implicit conversion is performed for the connection arguments. However, this is also a bad feature when it comes to the old C remnants in the C++ language: for instance, doubles implicitly convert to ints, possibly losing precision (and GCC/Clang do not even warn about those under -Wall, only MSVC does) or even triggering undefined behavior. For this reason, when using braced initialization, C++11 disables narrowing conversions or floating/integral conversions. Use this feature when checking the arguments of a PMF-style signal/slot connection. Technically this makes the program ill-formed, however GCC still accepts it (but at least warns under -Wall). Hence, add a way to disable these implicit conversions. This is a opt-in and guarded by a macro, as it's a source incompatible change. [ChangeLog][QtCore][QObject] The QT_NO_NARROWING_CONVERSIONS_IN_CONNECT macro has been added. When using the new connection syntax (PMF-based) this macro makes it illegal to narrow the arguments carried by the signal, and/or to perform floating point to integral implicit conversions on them. When the macro is defined, depending on your compiler a QObject::connect() statement triggering such conversions will now fail to compile. Change-Id: Ie17eb3e66ce0cd780138e60d8bb7da815a4ada83 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-0116-57/+1036
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure 5.7 now supports clang on android; but dev re-worked configure src/gui/kernel/qevent.h One side renamed a parameter of a constructor; the other added an alternate constructor on the next line. Applied the rename to both for consistency. tests/auto/tools/moc/tst_moc.cpp Each side added a new test at the end. .qmake.conf Ignored 5.7's change to MODULE_VERSION. configure.json No conflict noticed by git; but changes in 5.7 were needed for the re-worked configure to accommodate 5.7's stricter handling of C++11. Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-015-3/+296
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/itemviews/qabstractitemview.cpp src/widgets/itemviews/qabstractitemview_p.h Change-Id: I54589b1365103cb1749186af92aab03a49c94b64
| | * Fix for race condition in signal activationDenis Kormalev2016-07-291-0/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a race condition between QObject::disconnect() and QMetaObject::activate() which can occur if there are multiple BlockingQueued connections to one signal from different threads and they connect/disconnect their connections often. What can happen in this case is: T1 is in activate() method and T2 is in disconnect() method T1 T2 locks sender mutex selects next connection unlocks sender mutex locks sender mutex sets isSlotObject to false creates QMetaCallEvent derefs connection posts event Two things can happen here: 1. Connection can still be valid, but it will have isSlotObject==false and callFunction will be used instead of slotObj 2. Connection can already be invalid To fix it mutex unlock should be moved after QMetaCallEvent creation. Also there is another case, when we don't disconnect but delete the receiver object. In this case it can already be invalid during postEvent, so we need to move mutex unlock after postEvent. Change-Id: I8103798324140ee11de5b4e10906562ba878ff8b Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>