summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Increase the resolution for QDeadlineTimer unit testThiago Macieira2016-10-261-1/+1
| | | | | | | | | | Apparently, the CI can run something over 1000x slower than on my machine. We're getting over 100 ms delays in operations that shouldn't have taken more than half a millisecond. The last report was of 136% over budget, so I multiplied the resolution by 4. Change-Id: I9093948278414644a416fffd1474406967b2a6ee Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Add a resetClean() method to the undo stackJarek Kobus2016-10-241-0/+144
| | | | | | | | | | | | | | | | | | | | | | | With the current API it is not possible to reset the index into -1. We have setClean() method, but we are lacking setDirty(). This is needed in case when the document has changed outside of the editor and nothing has changed in the undo stack history. In this case we don't know the state of the file modified externally so we need to mark that editor's contents is different from the file contents and undoing or redoing commands can't bring the editor to the clean state. This may also be useful to call it when we created a new document and haven't saved it yet or when the document was restored from backup file. Task-number: QTCREATORBUG-17048 Change-Id: I64e2052b3559299e0b6939831557a07a59a851b6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Plug new leaks in tst_QFormLayoutMarc Mutz2016-10-211-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new takeRow() functions return a pair of pointers to QLayoutItems and, as the name particle 'take' suggests, releases ownership of these layout items. Which in turn means that the caller of the function is supposed to deal with them. This was not done here. To fix, write a RAII class that takes ownership of the returned layout items, deleting them when it goes out of scope or gets a new value assigned (only move special member functions are implemented, making the class move -only). Deleting the QLayoutItems is not so easy, though: QFormLayout has a special function for clearing the QLayoutItems out, so it appears that just calling their destructors is not going to fly (though I don't know off the top of the head why that should be a problem). Solve this, for now, by adding the layout items back into a temporary QFormLayout for destruction. Change-Id: If862989207b20f1e3f757c19ec9d498c4491184f Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* HTTP/2 - fix the handling of PUSH_PROMISETimur Pocheptsov2016-10-213-29/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | HTTP/2 allows a server to pre-emptively send (or "push") responses (along with corresponding "promised" requests) to a client in association with a previous client-initiated request. This can be useful when the server knows the client will need to have those responses available in order to fully process the response to the original request. Server push is semantically equivalent to a server responding to a request; however, in this case, that request is also sent by the server, as a PUSH_PROMISE frame. The PUSH_PROMISE frame includes a header block that contains a complete set of request header fields that the server attributes to the request. After sending the PUSH_PROMISE frame, the server can begin delivering the pushed response as a response on a server-initiated stream that uses the promised stream identifier. This patch: - fixes the HPACK decompression of PUSH_PROMISE frames; - allows a user to enable PUSH_PROMISE; - processes and caches pushed data for promised streams; - updates auto-test - emulates a simple PUSH_PROMISE scenario. Change-Id: Ic4850863a5e3895320baac3871a723fc091b4aca Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add Qt::ISODateWithMs date format, with support in QTime/Date/DateTimeTor Arne Vestbø2016-10-203-8/+22
| | | | | | | | | | The Qt::ISODate format strips milliseconds, so a new format is introduced that keeps the milliseconds. A new format was chosen over fixing the existing format due to the behavioral change of suddenly having ms as part of Qt::ISODate. Change-Id: If8b852daed068cce8eee9b61a7cd4576bc763443 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimer: don't circumvent <chrono> safety netMarc Mutz2016-10-181-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By templating on the <chrono> types and unconditionally using duration_cast to coerce the duration into a milliseconds, we violate a principal design rule of <chrono>, namely that non- narrowing conversions are implicit, but narrowing conversions need duration_cast. By accepting any duration, we allow non- sensical code such as QTimer::singleShot(10us, ...) to compile, which is misleading, since it's actually a zero- timeout timer. Overloading a non-template with a template also has adverse effects: it breaks qOverload(). Fix by replacing the function templates with functions that just take std::chrono::milliseconds. This way, benign code such as QTimer::singleShot(10s, ...) QTimer::singleShot(10min, ...) QTimer::singleShot(1h, ...) work as expected, but attempts to use sub-millisecond resolution fails to compile / needs an explicit user- provided duration_cast. To allow future extension to more precise timers, forcibly inline the functions, so they don't partake in the ABI of the class and we can later support sub-millisecond resolution by simply taking micro- or nano- instead of milliseconds. Change-Id: I12c9a98bdabefcd8ec18a9eb09f87ad908d889de Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMenu: don't force platform instance creation on constructionJ-P Nurmi2016-10-161-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a conflict between QGtk3Menu and QDbusPlatformMenuBar. The problem is that on Unity the type of the platform menu instance must be different depending on whether the menu is in the global menubar or a standalone context menu. Since QMenu creates a platform menu instance at construction time, it does not yet know whether it will be added into a menubar. QMenuBar checks that the QMenu already has a platform menu instance, and passes it to the platform menubar. As a result, a QGtk3Menu instance is passed to QDbusPlatformMenuBar. Currently, a standalone QMenu does not use the native platform menu instance. Only menus that are added to a QMenuBar do. Therefore we don't need to create the platform instance when QMenu is constructed, but only after it is added to QMenuBar. The platform menu instance creation is implemented in QMenuBarPrivate::getPlatformMenu(), and QMenu::setPlatformMenu() calls syncPlatformMenu() to take care of syncing the QMenu properties and actions to the new platform menu instance. The macOS-specific methods QMenu::toNSMenu() and QMenu::setAsDockMenu() rely on the platform menu instance, and must therefore create it on demand. This is a hot fix for the release blocker, not a long term solution. In the future, if standalone QMenus are made to use native platform menu instances, the instance must be created lazily when the menu is about to be made visible. Task-number: QTBUG-56526 Change-Id: I044933cabb1639406fe47908dfc4b1903af214d1 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Make self-contained test of condensed font matching and widthAllan Sandfeld Jensen2016-10-164-18/+57
| | | | | | | | | | | | Fixes the test for width of condensed fonts so it doesn't depend on the presence of the Liberation font on the system, and adds another test that condensed sub-families can be matched consistently. The latter will however not work on Windows until QTBUG-53458 is solved. Task-number: QTBUG-51335. Change-Id: Id6d046274fa21b2dce0ad6b32dce7f1c8a92a4f4 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* port to modularized platformsupport librariesOswald Buddenhagen2016-10-152-2/+2
| | | | | Change-Id: I20eb0e33abfd70b6a5240e7b6b0aa0425f2d2ee7 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* create modularized version of qtplatformsupport moduleOswald Buddenhagen2016-10-151-6/+1
| | | | | | | | | | lumping together all kinds of unrelated stuff has caused problems with spurious dependencies from the beginning. as the modularization infra is now in a state which supports many small private libraries just fine, take advantage of it. Change-Id: Ic40f47ce76a308bbfd32deae281f6f064fe1ef4c Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* Change confusing Q_DEAD_CODE_FROM_QT4_FOO defineTor Arne Vestbø2016-10-1415-23/+23
| | | | | | | | | | | | | | | | | | | Commit c5db8fc74 changed all instances of Q_WS_FOO to have the prefix Q_DEAD_CODE_FROM_QT4 instead, to make it clearer when reading the code that the code in question was a left-over from Qt4, when we used Q_WS_ defines instead of Q_OS_ defines. This worked well for cases of #ifdef Q_DEAD_CODE_FROM_QT4, but less so for cases of #ifndef Q_DEAD_CODE_FROM_QT4, where the code was actually unconditionally included. To make this even clearer, the defines have been replaced by checks for 1 or 0, with a comment describing how the code used to look in Qt4. The use of constants in the check also makes it easier for editors to parse the condition and show visually that the code is defined out. Change-Id: I152070d87334df7259b417cd5e17d7b7950379b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.7' into 5.8" into refs/staging/5.8Liang Qi2016-10-114-2/+83
|\
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-114-2/+83
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/image/qpixmap.cpp src/widgets/kernel/qformlayout.cpp Change-Id: I8a8391a202adf7f18464a22ddf0a6c4974eab692
| | * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-084-2/+83
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttpnetworkconnection.cpp src/network/access/qhttpnetworkconnection_p.h Change-Id: I11f8641ef482efa8cee1b79977d19cc3182814b4
| | | * QAbstractItemView: use only a 1x1 QRect for selecting on mouse pressFrank Reininghaus2016-10-071-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before commit f1e90768095be37419ba4bf3c69ec5c860bdbcb6, mousePressEvent called the virtual method setSelection(const QRect&, SelectionFlags) with the 1x1 rectangle which contains only the clicked QPoint, unless the SelectionFlag "Current" was set because Shift was pressed during the mouse press. Since that commit, the behavior has been changed such that the rectangle is the one that is spanned by the center of the clicked item and the clicked pixel. In theory, the result should be the same (i.e., only the clicked item should be selected), but * the code path in QListView::setSelection for 1x1 QRects is more efficient, and * using a larger QRect can cause problems with custom views, see the comments in QTBUG-18009 This commit ensures that the 1x1 QRect is used again, unless the SelectionFlag "Current" is used. Change-Id: I70dd70c083c20a3af6cd6095aa89a489756b505f Task-number: QTBUG-18009 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
| | | * QPixmap::load: ensure QBitmap stays a QBitmap even on failureMarc Mutz2016-10-061-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and avoid detach()ing potentially large data for just preserving the QPlatformPixmap::pixelType(). A QBitmap differs from a QPixmap (its base class, urgh) by always having a data != nullptr and a Bitmap pixel type, yet load() was unconditionally setting 'data' to nullptr on failure, turning a QBitmap into a non-QBitmap. Fix by move-assigning a null QBitmap instead of resetting 'data'. Add some tests. Change-Id: Ida58b3b24d96472a5f9d0f18f81cc763edcf3c16 Reviewed-by: Anton Kudryavtsev <a.kudryavtsev@netris.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | | * tst_QShortcut: Fix UB (invalid cast) in shortcutDestroyed()Marc Mutz2016-10-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The slot is invoked from QObject::destroyed(), which is emitted from ~QObject. By that time the object is no longer a QShortcut, so the static_cast it invalid. Found by UBSan: tst_qshortcut.cpp:1210:53: runtime error: downcast of address 0x6020000289d0 which does not point to an object of type 'QShortcut' 0x6020000289d0: note: object is of type 'QObject' 10 00 80 17 c0 ce 63 df 93 2b 00 00 b0 02 00 00 d0 60 00 00 02 00 00 00 ff ff ff 04 04 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QObject' #0 0x42b3bb in tst_QShortcut::shortcutDestroyed(QObject*) tst_qshortcut.cpp:1210 #1 0x446cc9 in tst_QShortcut::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) .moc/tst_qshortcut.moc:186 #2 0x2b93dba52c86 in QMetaObject::activate(QObject*, int, int, void**) qobject.cpp:3787 #3 0x2b93dba55400 in QObject::destroyed(QObject*) .moc/moc_qobject.cpp:213 #4 0x2b93dba8d80d in QObject::~QObject() qobject.cpp:967 #5 0x2b93c6b6e032 in QShortcut::~QShortcut() qshortcut.cpp:476 #6 0x2b93c6b6e370 in QShortcut::~QShortcut() qshortcut.cpp:481 #7 0x42a5de in void qDeleteAll<QList<QShortcut*>::const_iterator>(QList<QShortcut*>::const_iterator, QList<QShortcut*>::const_iterator) qalgorithms.h:317 #8 0x42a5de in void qDeleteAll<QList<QShortcut*> >(QList<QShortcut*> const&) qalgorithms.h:325 #9 0x42a5de in tst_QShortcut::clearAllShortcuts() tst_qshortcut.cpp:1136 Fix by replacing QVector::replaceAll() with the erase-remove idiom, which does not require the cast, because it can perform mixed-type lookups. Change-Id: I4251c1895fa4398023f489dbfd7108d90c1a6c94 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
| | | * Plug memleak in tst_QStackedWidgetMarc Mutz2016-10-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To keep the change minimal, keep 'sw' as a pointer variable, but back it by a stack-allocated QStackedWidget instead of a heap-allocated one that's never deleted. Change-Id: I9e2a8c07979b861eb7e7040c144d8e75c90d0bc9 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | | | Fix crash in QPainter benchmark testAllan Sandfeld Jensen2016-10-111-22/+67
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | Adds missing image-formats so it doesn't segfault. Also changes the exclusion of rare formats to lists of included ones Change-Id: I1d00562cf8e96baa03121a0b996764224911e06a Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | | tst_QSettings: Don't assume the presence of a key means isWritableTor Arne Vestbø2016-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous sync() of the specific scope and domain may have failed due to not having the necessary permissions, but the saved value may still be cached, so we need to check both. This was observed on macOS Sierra, where a failed sync() will result in marking the CFPrefsPlistSource as read-only, eg: 2016-10-04 13:14:11.713271 tst_qsettings[88537:767733] [User Defaults] attempt to set <private> for key in <private> in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x6180000e1780> (Domain: org.software.KillerAPP, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null)) Change-Id: I8976c1c4acfe2cb0d5510298d5c585faca9607f6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | tst_QSettings: Fix tests on sandboxed platforms such as iOSTor Arne Vestbø2016-10-101-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | WinRT is not the only sandboxed platform. Since it doesn't hurt to keep the test data in a well known location, we enable the code for all platforms. We also make sure to mkpath the location, since writableLocation doesn't guarantee that the location exists. Change-Id: Ie8d90c5fbdf3b7fbf85ba6be25372b0ef7c4da55 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-0630-69/+189173
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/mac/default_pre.prf mkspecs/features/qpa/genericunixfontdatabase.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf src/corelib/io/qiodevice.cpp Change-Id: I6f210f71f177a3c3278a4f380542195e14e4b491
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-054-41/+29
| |\| | | | | | | | | | Change-Id: I34b5e290233d0869fbafac094a939aec2bf83fd5
| | * Fix some typos and minor sentence structure issues in docsFrederik Schwarzer2016-10-051-1/+1
| | | | | | | | | | | | | | | Change-Id: Ibede1aeb046e2df6723e3041152bfae22a9fde32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * Plug remaining leaks in tests/auto/widgets/utilMarc Mutz2016-10-023-40/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In tst_QCompleter, two completers were leaked because they had no parent and setCompleter() calls don't reparent. Fixed by giving them parents. In tst_QUndo*, fix lots of leaked QActions by storing them in a QScopedPointer. There were some half-hearted attempts to clean them up with manual deletes, but I ported these to scoped pointers, too, to make the code more robust in the face of failures. This fixes the remaining errors in GCC 6.1 Linux ASan runs of tests/auto/widgets/util. Change-Id: Icc5248cc9cf4514540915924df1c4d9e09c071fa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * | BIC data files for QtBase for Qt 5.7Milla Pohjanheimo2016-10-0311-0/+96381
| | | | | | | | | | | | | | | | | | | | | Added the binary compatibility test data files for Qt 5.7 for QtBase Change-Id: I5b19571f5e266c52622027d820062afa5fd4fbf3 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-0114-28/+92762
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/mac/default_pre.prf mkspecs/macx-ios-clang/features/resolve_config.prf qtbase.pro Change-Id: I65b5ebca4942a4f295bdd4ac1568e5c347333aea
| | * Data files for binary compatibility tests updated for Qt 5.6Milla Pohjanheimo2016-09-3011-0/+92679
| | | | | | | | | | | | | | | | | | | | | | | | | | | The generated data files for the binary compatibility test updated for QtBase. Change-Id: Idae703c83f55ff17cada4419db742ea12b22bf86 Reviewed-by: Sergio Ahumada <sahumada@texla.cl> Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
| | * Plug remaining leaks in tests/auto/widgets/styleMarc Mutz2016-09-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usual: - delete styles Either by using QScopedPointer. This fixes the remaining errors in GCC 6.1 Linux ASan runs of tests/auto/widgets/styles. Change-Id: Ifba59085c057d474bf964cbb93010c408d773a61 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * tst_QAbstractSlider: fix strict-aliasing warningsMarc Mutz2016-09-301-25/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC warned: tst_qabstractslider.cpp:858:89: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Qt::Orientation orientation = *reinterpret_cast<Qt::Orientation*>(&sliderOrientation); ^ tst_qabstractslider.cpp:867:72: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] orientation = *reinterpret_cast<Qt::Orientation*>(&wheelOrientation); ^ The solution, of course, would be to use a static_cast here, but why go via int in the first place? Qt::Orientation can perfectly well be used in QFETCH, as proven by tst_qmainwindow, among other things. Change-Id: I97916a50405e16d114837bc52580ce6666d74b17 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * Fix crash when doing many text layouts with superscript/subscriptEskil Abrahamsen Blomfeldt2016-09-291-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After e109b8a0f3c89c595f0da689e7ee847130e2ee47, it is possible that the cache will be flushed as a result of inserting a new font rather than just when the timer event triggers. When doing superscript and subscript text layouts, we would first get a regular font engine, then a scaled one, and then reference the regular font engine *after* getting the scaled one. If the regular font engine was deleted as a result of inserting the scaled one, we would get a dangling pointer and crash. The situation was improved by 49926bb9ef983d4c19aed635a00b388252c065e4. You would now to switch between 256 different fonts in the layout in order to trigger it. The test in the commit will trigger the crash even with this change. [ChangeLog][Qt Gui][Text] Fixed a crash that could happen if you were doing many different text layouts with different fonts and superscript or subscript alignment. Task-number: QTBUG-53911 Change-Id: Ia33108252e030eff25924ef1b7c10b9d59b5bc8c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | Fix tst_QFiledialog::widgetlessNativeDialog()J-P Nurmi2016-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Restore Qt::AA_DontUseNativeDialogs that is disabled in the beginning of the test function. Change-Id: I4ff8eab4ecc458c478337824e66b5a59fbdd7c65 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Use extreme values in QMetaType/QSettings test dataTor Arne Vestbø2016-10-051-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | By using _MIN for signed values, and _MAX for unsigned values, we may detect conversion issues when serializing QVariants using QSettings. Change-Id: I3ce58ba4b93f791f75c7ae44d1fd5030f07b2f25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Implement QMacCocoaViewContainer in terms of foreign windowTor Arne Vestbø2016-10-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This leaves a clearer separation between the foreign-window and non-foreign window use-cases, where a single QCococaWindow can only be in one mode, which is determined in the constructor and doesn't change after that. There are no source or binary compatibility guarantees for the QPA classes, meaning the helper function in QPlatformNativeInterface can be removed. Change-Id: I3232aedca1d98c49a8f54e16750832187f9dc69a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | | Don't truncate QDateTime milliseconds when storing QSettings on Apple platformsTor Arne Vestbø2016-10-054-243/+383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix is trivial, but the patch adds a new QSettings tests that iterates most of the QMetaTypes and verifies that storing and retrieving them again gives the same value. This is a more complete test than the testVariantTypes tests, which is limited to a subset of the QVariant types. The new tests borrows logic from the QMetaType test machinery. QSettings has been Q_ENUM'ified in the process, for improved debug output. Note that on backends such as the INI backend, the metatype of the QVariant read from the settings will be a string, so it won't match the input QVariant type, but the result of converting that to the original value type should still work. Task-number: QTBUG-56124 Change-Id: Ib03a26abf77c9fb449b94160d28bc4baeb095f25 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Apple OS: Handle QSetting strings with embedded zero-bytesTor Arne Vestbø2016-10-051-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Saving strings with embedded zero-bytes (\0) as CFStrings would sometimes fail, and only write the part of the string leading up to the first zero-byte, instead of all the way to the final zero-terminator. This bug was revealed by the code-path that falls back to storing e.g. QTime as strings, via the helper method QSettingsPrivate::variantToString(). We now use the same approach as on platforms such as Windows and WinRT, where the string produced by variantToString() is checked for null-bytes, and if so, stored using a binary representation instead of as a string. For our case that means we fall back to CFData when detecting the null-byte. To separate strings from regular byte arrays, new logic has been added to variantToString() that wraps the null-byte strings in @String(). That way we can implement a fast-path when converting back from CFData, that doesn't go via the slow and lossy conversion via UTF8, and the resulting QVariant will be of type QVariant::ByteArray. The reason for using UTF-8 as the binary representation of the string is that in the case of storing a QByteArray("@foo") we need to still be able to convert it back to the same byte array, which doesn't work if the on-disk format is UTF-16. Task-number: QTBUG-56124 Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | tst_QSettings: Detect if Apple platforms support writing to SystemScopeTor Arne Vestbø2016-10-041-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | A fair amount of tests are skipped if we can't write to the system scope, eg on iOS. Without this detection they will fail. Change-Id: I8257f1f24e69dae88925c20d2bff851e81701405 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | remove unnecessary references to $$QMAKE_CFLAGS_DBUSOswald Buddenhagen2016-10-042-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | it does not appear that the tests actually use these flags in any way; they don't include any (actual) d-bus headers and have no ifdefs. and the qdbus module already pulls in the flags via QMAKE_USE (in the case where they are defined at all, i.e., dbus-linked). Change-Id: Ie6bc6da7d1dd96da7b73f2d0fe45576936715874 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Fix plain text QStaticText with line breaksEskil Abrahamsen Blomfeldt2016-10-041-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The layout isn't actually created until endLayout() or setLineWidth() is called. So in the case where this was not done, the height of the line would be 0, thus multiple lines would be placed on top of each other, at y == 0. [ChangeLog][QtGui][Text] Fixed QStaticText when manually breaking lines and no text width was set. Task-number: QTBUG-56346 Change-Id: I7f6ed6260545882f05fe39b21134315eca7401b9 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | | remove redundant conditionals regarding sslOswald Buddenhagen2016-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | this actually fixes the build when ssl is not enabled, as the openssl features are in the not included network-private module. Change-Id: Ibafae9867af493da184a45cf3981628d475d37a6 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Exclude tst_QSettings::rainersSyncBugOnMac() on all Apple OSesTor Arne Vestbø2016-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | | It fails on iOS as well, and likely also tvOS and watchOS. Change-Id: Idfce98a5aeccb5680f6b4c6e66b526dd7922156d Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Speed up compilation of tst_qgraphicsview_2.cppMarc Mutz2016-10-032-580/+1180
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turn the list of newRow() calls into a for loop over a constexpr data structure. Fixes the GCC note: tst_qgraphicsview_2.cpp:47:13: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without and speeds up compilation of the file from 13s to 2.5s on my machine. Task-number: QTBUG-38890 Change-Id: I4f0b3565c7df64b286d1d32eb3f3d6bf4df92609 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Round to nearest millisecond in QDateTime::fromCFDate()Tor Arne Vestbø2016-10-021-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CFAbsoluteTime is measured in seconds, represented by a double, so when converting milliseconds to CFAbsoluteTime we may get a slight error due to missing precision in double to represent the milliseconds exactly. By rounding to the closest millisecond when converting back, we avoid truncating and being one ms off. Change-Id: If1e99f97b000fb8cb893ddfc5d7ba81096c0ea88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* | | Add qtest_network.hMarc Mutz2016-09-294-121/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and move toString() implementations there which were repeated in network tests, or #ifdef'ed in qtest.h. Since the functions moved from network tests are now in a public header, had to massage them a bit to pass headersclean: - replace Q_FOREACH with C++11 range-for - avoid implicit conversion from QByteArray -> const char* (done by re-using toString(QByteArray) instead of calling strdup() manually) Also made the functions overloads instead of specializations. This allows to pass the enum by value instead of by const-&. Like the existing QHostAddress, the newly-added toString() overloads are marked as \internal. We can decide later whether to turn them into public API. Change-Id: I8c23db7a0a6575273567017d42d7b2a957acece8 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-09-2912-81/+241
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/uikit/xcodebuild.mk tests/auto/other/lancelot/tst_lancelot.cpp tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp Change-Id: Ia0ae2de86094120281abd445138877c2cc3e882c
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-09-288-30/+190
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qfiledialog.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: I34bc8a990f8f526889a95a5c7099ef557b9681ad
| | * Plug memleaks in tst_QWidgetMarc Mutz2016-09-281-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to delete the style returned from QStyleFactory::create() ourselves, so put them into a QScopedPointer. The alternative would have been to create this once, as a member of tst_QWidget, but this is the minimal approach that ensures behavior just as the old code, but without the leak. Change-Id: I527f1031c57be6f05942f4acc057e7dae1af2571 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * tst_QApplication: Fix UBs (invalid cast) in focusMouseClick()Marc Mutz2016-09-281-22/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found by UBSan: tst_qapplication.cpp:1754:48: runtime error: member access within address 0x7ffda11f2220 which does not point to an object of type 'SpontaneousEvent' 0x7ffda11f2220: note: object is of type 'QMouseEvent' The code attempted to model the layout of a QEvent with another class that allows public access to the memory location that (hopefully) corresponds to QEvent::spont, gaining access by casting a QEvent object to that specifically-crafted class. Fix by the using the existing QSpontaneKeyEvent::setSpontaneous() call, which, despite its name, works for all QEvent subclasses, and which has already been fixed to not invoke UB (in bc087db). Change-Id: I7db8b8a8a823f7d61ab17375142d19dc3874fea5 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| | * Extend tested formats in lancelotAllan Sandfeld Jensen2016-09-271-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds two formats that does not have optimized code-paths in qdrawhelper to ensure the generic path has coverage. This has already uncovered one bug fixed before this patch could go in. Change-Id: I0e0a1a873555b27f6438f69a76982b8e06263dcf Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
| | * QDateTimeEdit: synchronize time-spec before initializing displayEdward Welbourne2016-09-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDateTimeEdit ignores the time-spec of its date-time value, using its own time-spec instead; mostly, this works because it first conforms the value to its own time-spec. However, during construction, before doing this, it set up its display data, which could leave it with a different time (rather than a different representation of the given time) than it was asked to use. Moved the updateTimeSpec() calls to immediately after setting value in QDateTimeEditPrivate::init() to ensure correct handling. Added test. Task-number: QTBUG-54781 Change-Id: I3b07c10997abb858fc0b40558bff96e3fdabbd83 Reviewed-by: Jesus Fernandez <jesus.fernandez@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>