summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
| | | | * | Merge remote-tracking branch 'origin/5.14' into 5.15Liang Qi2019-12-1019-126/+452
| | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/network/kernel/qnetworkinterface/BLACKLIST Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
| | | | | * tst_QSqlQuery: fix some testsChristian Ehrlicher2019-12-101-39/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix some tests in tst_QSqlQuery: - make sure to use QSql::HighPrecision in tst_QSqlQuery::precision() (needed for psql) - remove outdated stuff for mysql 3.x - psql_bindWithDoubleColonCastOperator: the placeholder are stored as named placeholders in psql - avoid some useless old-style casts Change-Id: I54d29a7e24f17d853cce6baa09a67d9278098810 Reviewed-by: Robert Szefner <robertsz27@interia.pl> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| | | | | * Don't wrap feature detection macros with QT_HAS_FOO() variantsTor Arne Vestbø2019-12-108-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | | | * QWidget: React to platform surface being created or destroyedTor Arne Vestbø2019-12-091-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The platform window may create or destroy its surface from other entry points than the QWidget API, in which case QWidget needs to sync up its own state to match. In particular WA_WState_Created and the winId needs to be recomputed. Fixes: QTBUG-69289 Fixes: QTBUG-77350 Change-Id: I769e58ead3c2efcf8c451c363108848feade9388 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| | | | | * tst_QNetworkInterface: don't force an IPv4 link-local addressThiago Macieira2019-12-072-21/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows apparently has special code to deal with those addresses. If all your network interfaces are up and have acquired addresses, then the link-local network at 169.254.0.0/16 is unreachable. I had never caught this because both my Windows VM and my bare metal Windows have inactive interfaces (like the Bluetooth PAN one) and, when inactive, Windows assigns a link-local address. But in the CI, the interface(s) were all up and running, causing this issue. Unix systems don't treat IPv4 link-local any differently, so they always worked, so long as any interface was up and there had to be one to reach the network test server. This commit reworks the test to add test addresses based on the addresses found on up & running interfaces (see tst_qudpsocket.cpp). For IPv4, we flip the bits in the local portion of the address. For IPv6, we add a node with an address I generated randomly (non-universal), with the same scope. Fixes: QTBUG-65667 Change-Id: I568dea4813b448fe9ba6fffd15dd9f482db34991 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
| | | | | * Fix updating the text cursor position after editingSona Kurazyan2019-12-061-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases when editing the text (for example when removing the selected text, or pasting a text block) the text cursor position is updated, but its visual x position is not updated. This causes the next cursor movements to start from a wrong position. Force the update for those cases. Fixes: QTBUG-78479 Change-Id: Ia496be62beec58660f5e1695e5aafae09c79684e Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
| | | | | * Allow lower-case for the T and Z in ISO 8601 date formatEdward Welbourne2019-12-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cite RFC 3339 as basis for allowing a space in place of the T, too. The RFC mentions that ISO 8601 accepts t and z for T and Z, so test for them case-insensitively. Add a test for this. Change-Id: Iba700c8d74d485df154d27300aab7b1958e1ccef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | | | * Fix handling of trailing space at the end of an ISO date-timeEdward Welbourne2019-12-061-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If milliseconds were followed by a space, the space was included in the count of "digits" read as the fractional part; since we read (up to) four digits (so that we round correctly if extras are given), a harmless apce could cause scaling down by too large a power of ten. Since QString::toInt() ignores leading space, we were also allowing interior space at the start of the milliseconds, which we should not, so catch that at the same time. Added tests, including one for the rounding that's the reason for reading the extra digit, when present. Fixes: QTBUG-80445 Change-Id: I606b29a94818a101f45c8b59a0f5d1f78893d78f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | | | | * Fix crash when a date-time has an invalid time-zoneEdward Welbourne2019-12-061-14/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDateTime is a friend of QTimeZone, so can access its internals; but it must check the zone is valid before doing so. Expanded tst_QDateTime::invalid() and made it data-driven to catch the failure cases. Commented on a test-case that caught a mistake in my first attempt at this, and on QDateTimeParser's surprising reliance on a quirk of QDateTime::toMSecsSinceEpoch()'s behavior. Fixes: QTBUG-80146 Change-Id: I24856e19ff9bf402152d17d71f83be84e366faad Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
| | | | | * Manual High DPI test: Add a page logging all screen change signals to MetricsFriedemann Kleint2019-12-051-7/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turn the Metrics widget into a QTabWidget and add a tab logging all changed signals of QScreen. This is useful when for example debugging issues with lock screens and laptop hibernation. Task-number: QTBUG-79248 Task-number: QTBUG-76902 Change-Id: Ie86789fe1514cb3333a5f3def7f613f217fa6802 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| | | | | * Copy formatting attributes when cloning an empty QTextDocumentSona Kurazyan2019-12-051-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When cloning a QTextDocument, the text fragment of the original document is copied into the new one, which results into copying also the formatting attributes. However, when the text document is empty, the corresponding text fragment is also empty, so nothing is copied. If we want to transfer the formatting attributes for an empty document, we need to set them explicitly. Fixes: QTBUG-80399 Change-Id: I382cd0821723436120af47c06ec7bfa849636307 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
| | | | | * QCborValue: fix replacing of elements with byte data with ones withoutThiago Macieira2019-12-051-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We forgot to reset the flags when replacing the element, so we ended up with an integer with HasByteData after: testMap[0] = QStringLiteral("value"); testMap[0] = 42; Fixes: QTBUG-80342 Change-Id: Ia2aa807ffa8a4c798425fffd15dabfa066ea84b0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | | | | * docker-compose now brings up the docker images tagged as "latest"Dimitrios Apostolou2019-12-052-28/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is so that we can do simple changes to the docker images in provisioning, without needing to update the tag here. If a backwards-incompatible change in the docker images needs to be committed in provisioning and here, it is possible because the images retain their old unique SHA1 tag, in addition to being tagged as latest. See comment for more details. Requires the change in qt5 repository, with commit sha: e4f9ac5607a329bae045567a339d36469bc4fff6 Task-number: QTBUG-79867 Change-Id: I1bc72edec62487530575d7e113a25afe16d09129 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| | | | | * Fix flaky test tst_QFiledialog::clearLineEdit()Dimitrios Apostolou2019-12-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-76989 Change-Id: I3ec7f65500476346e1a8f1017c6452517a660860 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| | | * | | QCocoaEventDispatcher: make 'interrupt' workTimur Pocheptsov2019-12-101-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | even if we are currently inside processEvents (apparently called manually and not from QEventLoop::exec()). A carefully crafted application (see, for example, the linked QTBUG or even updated auto-test) can trigger itself into failing to exit the current (potentially nested) event loop. We can harden our Cocoa event dispatcher to detect such condition and properly propagate 'interrupt' to where it'll do its job, indeed, interrupting the real event loop (aka [NSApp run]). This mainly means we have to undo what bool blocker would erroneously do. Also, long live (as people love to say these days) to another tricky (somewhat) auto-test (surely, it's not flaky!). Fixes: QTBUG-79477 Change-Id: I794f0cda23e24d36be67f2bb63d52b74be057c31 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| | | * | | Make inputmask 'X' mask character require non-blank inputEirik Aavitsland2019-12-101-3/+0
| | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation for the X mask would accept any printable character. Since that includes the blank character, there was no difference in behavior between the requiring X and optional x: both would allow the input to be unset, i.e. blank. This change should be seen in conjunction with the doc improvement da0af1e. [ChangeLog][QtWidgets][QLineEdit] Inputmask X character now requires non-blank input. Fixes: QTBUG-76320 Change-Id: I3e0363e9be5c13373a157cce69c99379615b5829 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * | / / Remove deprecated QGL* classesJohan Klokkhammer Helsing2019-12-1117-3853/+8
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes QGL paths in sub-attaq and chip examples. The boxes example depended on QGL and has been removed. The corresponding module and test directories for the opengl module are now empty, but has been left there so we can move the QOpenGL* classes there. [ChangeLog][QtOpenGL] The deprecated QGL* classes have been removed. Fixes: QTBUG-74408 Change-Id: I52f56409af8f6901359462a7ba162103d051fe3d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
| * | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-096-38/+312
| |\| | | | | | | | | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| | * | QMetaType: add more static-less APIOlivier Goffart2019-12-071-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In prevision to Qt6 which is going to discourrage the use of the integer id, add some missing API to the staticless QMetaType API: - Add a way to construct a QMetaType from a type without calling qMetaTypeId: QMetaType::fromType<T>() - Add equality operators - Add a QMetaType::name() function - Add a default constructor (by adding a default parameter to the existing ctor) Change-Id: I95487c1c31bdf0d773717daa9d5452cbced30673 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| | * | QByteArray: add a strict mode to fromBase64Giuseppe D'Angelo2019-12-051-34/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QByteArray::fromBase64 was liberal in its input, simply skipping over invalid characters. As a side-effect of this, it had no error reporting, meaning it could not be used to convert fromBase64 _and_ validate the input in one go. Add more option flags to make fromBase64 strictly validate its input. Since we want to know whether it has succeeded or not, and the existing fromBase64 overloads do not allow for that, introduce a new function that returns an optional-like datatype. While at it: base64 decoding can be done in-place; add an rvalue overload to enable this use case. [ChangeLog][QtCore][QByteArray] Added the new fromBase64Encoding function. [ChangeLog][QtCore][QByteArray] Added new flags to make fromBase64 / fromBase64Encoding strictly validate their input, instead of skipping over invalid characters. Change-Id: I99cd5f2230f3d62970b28b4cb102913301da6ccd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| | * | Add QHash::insert(const QHash &other)Lars Knoll2019-12-051-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As opposed to unite(), this inserts one hash into the other without duplicating elements. Change-Id: Ifc786c48f5dc3ab18c29782e73eac3c1a3ef8981 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| | * | QDoubleValidator: Fix thousand separator handlingFabian Kosmale2019-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDoubleValidator would accept "1,23" as valid in a locale which has ',' as a thousand separator. However, it should have been Intermediate instead, as there is still one digit missing. Fixes: QTBUG-75110 Change-Id: I6de90f0b6f1eae95dc8dfc8e5f9658e482e46db3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| | * | RHI: new native texture APIPaul Olav Tvete2019-12-052-4/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new version takes/returns a value that can be unpacked and passed to other functions without knowing which backend is in use. The old API will be removed in a later change when dependent modules have been updated Task-number: QTBUG-78570 Change-Id: I18d928ceef3cb617c0c509ecccb345551a7990af Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
| * | | Use QString::DataPointer instead of QStringPrivateLars Knoll2019-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Preparations to move QString over to use QArrayDataPointer instead of it's own private struct. Change-Id: I7796a595393394083f6a85863e3c710ebbdea149 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | Use QArrayDataPointer to implement QByteArrayLars Knoll2019-12-081-3/+3
| | | | | | | | | | | | | | | | | | | | Change-Id: I2ee28023c2dea9fc3160400112c59a47566a4868 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Use the QByteArray::DataPointer typedef instead of QByteArrayDataLars Knoll2019-12-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal here is to move things over to QArrayDataPointer. This prepares for it. Change-Id: I32f54a47594274799600c618f7341c200ceaa306 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Fix out of bounds read in tst_qsqlqueryLars Knoll2019-12-081-2/+3
| | | | | | | | | | | | | | | | | | | | Change-Id: I87962a17b13d212fa7fcc30bcd40174f2a7cded0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
| * | | Get rid of QCharRef and QByteRefLars Knoll2019-12-083-26/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already detach immediately since change c2d2757bccc68e1b981df059786c2e76f2969530. That basically removes the main purpose of having QChar/ByteRef, and we can just as well get rid of those classes for Qt 6. Change-Id: I8dc566a1948ddc29c0cb8a77ec7310654a7219a4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Use <type_traits> to properly have QVector<T>::parameter_typeThiago Macieira2019-12-081-23/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That allows us to pass by value for all fundamental and pointer types. This requires some magic to remove methods taking a T&& to avoid ambiguous overloads for QVector<int/qsizetype>. Remove them for all cases where parameter_type is T, as copying or moving will do exactly the same thing for those types. Change-Id: I8133fecd3ac29bb8f6ae57376e680bc3d616afbf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Enlarge QVariant's private to fit the new QString and QByteArrayThiago Macieira2019-12-081-2/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: I8baecd0a4db13200b34cdd7c8aebc2a1cc0a0c75 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Final removal of the size and offset members from QArrayDataThiago Macieira2019-12-081-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Those members are not required anymore and now part of the object itself. Change-Id: If9eb5355ca8f2cf9528f6f63ca4e172acc9f9aed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Inline the size and data pointers in QByteArrayThiago Macieira2019-12-081-45/+14
| | | | | | | | | | | | | | | | | | | | Change-Id: I82feeb2c9bd2900f421fc0c8d78698b1e83db043 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Change representation of string data in the meta objectLars Knoll2019-12-081-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't store our string data as QByteArrayLiterals anymore, but revert back to simply storing them as an array of char* and offsets into that array. This is required to be able to inline size and begin into QByteArray itself. Once that change is done, we can then avoid creating copies of the string data again. Change-Id: I362a54581caefdb1b3da4a7ab922d37e2e63dc02 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Inline the size and data pointer members in QStringThiago Macieira2019-12-082-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'd have preferred to use QArrayDataPointer<ushort> for QString, but that option wasn't the best one. QArrayDataPointer try to do some operations using QArrayDataOps and that would expand to unnecessary code. What's more, the existing code expected to be able to modify and access the d pointer. Instead, this commit introduces QStringPrivate (named differently from QStringData to catch potential users), which contains the three members. This POD class is also used in QJsonValue to store the "inlined" QString. QHashedString in qtdeclarative will need a similar solution. Change-Id: I33f072158e6e2cd031d4d2ffc81f4a8dbaf4e616 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Inline the size and begin pointer in QVectorThiago Macieira2019-12-082-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add QGenericArray to simplify operations. This class can be shared by other tool classes. If there is nothing else to share it, we can move the code onto qvector.h. The one candidate is QList. All tests pass and valgrind is good. Change-Id: Ieaa80709caf5f50520aa97312ab726396f5475eb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Remove bad test in QVectorThiago Macieira2019-12-081-83/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test hardcodes the allocation behaviour instead of testing what it should be testing. Unfortunately, it can't test the actual problem directly since the problem was "it crashed when using vectors with 1 billion elements". Change-Id: Iec6a26ae490b8fdd4a7db1269e3bae85fc77ee52 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Start moving QArrayData's size and data pointer to the main classThiago Macieira2019-12-082-126/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This requires that the allocation functions return two pointers: the d pointer and the pointer to the actual data. Ported QArrayDataPointer & SimpleVector to the inlined size & data. For now, the size and offset members are not yet removed from QArrayData, to let QVector, QByteArray and QString compile unmodified. Change-Id: I8489300976723d75b8fd5831427b1e2bba486196 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Stop using the reference counter to store data stateThiago Macieira2019-12-081-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using the reference count to store whether the data is sharable and whether the header is immutable, move the settings to the flags member. This allows us to save one comparison per deref() or needsDetach(). It also allows for the possibility of mutable data pointed to by a static header. Change-Id: Ie678a2ff2bb9bce73497cb6138b431c465b0f3bb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Add reference-count manipulation functions to QArrayData and hide refThiago Macieira2019-12-084-44/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The next change will stop using some values in the reference counter as settings from the data. Change-Id: I94df1fe643896373fac2f000fff55bc7708fc807 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Introduce the Mutable flag and move QArrayDataPointer::needsDetachThiago Macieira2019-12-082-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Mutable flag now contains the information on whether the data this QArrayData points to is mutable. This decouples the mutability / immutability setting from the allocation and from the type of data, opening the way for mutable raw or foreign data. There are still plenty of places in the source code that check the size of the allocation when it actually wants d->isMutable(). Fixing this will require reviewing all the code, so is left for later. The needsDetach() function is moved to QArrayData and de-constified. It returns true when a reallocation is necessary if the data is to be modified. Change-Id: I17e2bc5a3f6ef1f3eba8a205acd9852b95524f57 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Introduce flags to indicate the QArrayData typeThiago Macieira2019-12-071-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These flags allow us to determine what type of data QArrayData is carrying. There are currently only two supported types: - raw data type: constructed via fromRawData or static data - allocated data type: regular data done via heap allocation The QArrayData object is usually allocated on the heap, unless its own reference count is -1 (indicating static const QArrayData). Such object should have a type of RawDataType, since we can't call free(). Add GrowsBackward for completeness as well as the StaticDataFlags default for static data. Change-Id: Icc915a468a2acf2eae91a94e82451f852d382c92 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Introduce QArrayData::allocatedCapacity() and use it instead of d->allocThiago Macieira2019-12-072-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In almost all cases, use d->allocatedCapacity() or d->constAllocatedCapacity() instead of d->alloc, since they do the same thing (right now). In the future, the functions will be changed. There is a separate const version because most const code should not need to know the allocation size -- only mutating code should need to know that There are a few cases where d->alloc was replaced with a better alternative, like d->size. The one case that remains in the code will be replaced by a different test when it's available. Change-Id: I48135469db4caf150f82df93fff42d2309b23719 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Replace QArrayData::capacityReserved with a full flags fieldThiago Macieira2019-12-072-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of stealing one bit from the alloc field, let's use a full 32-bit for the flags. The first flag to be in the field is the CapacityReserved (even though the allocate() function will store some others there, not relevant for now). This is done in preparation for the need for more flags necessary anyway. Change-Id: I4c997d14743495e0d4558a6fb0a6042eb3d4975d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Rename QArrayData::AllocateOptions enum and update some flagsThiago Macieira2019-12-072-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename to QArrayData::ArrayOptions in preparation for these flags being in the array itself, instead of used just for allocating new ones. For that reason, rename QArrayData::Default to DefaultAllocationFlags. And introduce QArray::DefaultRawFlags to mean the flags needed for creating a raw (static) QArrayData. Also rename QArrayData::Grow to GrowsForward, so we may add GrowsBackward in the future. Change-Id: I536d9b34124f775d53cf810f62d6b0eaada8daef Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | | Fix qChecksum testLars Knoll2019-12-071-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test passed mostly by accident so far, as the created QByteArray was shorter than what the test assumed. Change-Id: I06858801d83a504eadc73ec2be281c88f8ffad5d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | Use Q_NAMESPACE for the Qt namespace, and remove the old moc hack to support itOlivier Goffart2019-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since I can't #include qobjectdefs from qnamespace because of circular dependency, move the Qt macro in the qtmetamacros.h header. Deprecate QObject::staticQtMetaObject since now one can just use Qt::staticMetaObject Change-Id: I11982aa17c2afa2067486b113f8052672f3695eb Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
| * | | Fix tst_moc for C++17Olivier Goffart2019-12-064-118/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The throw() specification is no longer accepted in C++17 mode, so remove that. Also pass the -std=c++1z to the compiler as Qt is going to require C++17 soon Change-Id: I6d249e574d90cd1cf5c0ea595830d2db07681050 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-053-0/+79
| |\| | | | | | | | | | | | | | Change-Id: I9d63a4c4b229a831b5369f6ec74ac97ba6d6556a
| | * | Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2019-12-043-0/+79
| | |\| | | | | | | | | | | | | Change-Id: Ia70e81943ef097941339f9ef9ace28592a2eb740
| | | * Fix assert in QTextDocument CSS parser on "border-width: 1pt"David Faure2019-12-031-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code was assuming that if the parsing of the value worked, then it must be a list of 4 variants. But in this case it's just a single length. This came from <td> using 4 values for border-width while other elements use a single value. But the storage is shared. So the fix is to use 4 values everywhere. When reading 4 and there's only one, it gets duplicated, so the caller can just use the first one in that case. Task-number: QTBUG-80496 Change-Id: I682244b6e3781c4d673a62d5e6511dac263c58e8 Reviewed-by: Nils Jeisecke <nils.jeisecke@saltation.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>