summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix invalid QSortFilterProxyModel::dataChanged parametersWang ChunLin2020-11-302-0/+168
| | | | | | | | | QSortFilterModel shouldn't forward dataChanged() when the source model changes data in columns that the filter model refuses Fixes: QTBUG-86850 Pick-to: 5.15 Change-Id: I26565d119d2aa36ea07b3de0c15f1b137bc002f8 Reviewed-by: David Faure <david.faure@kdab.com>
* Fix compiler warning - remove dead codeVolker Hilsheimer2020-11-271-24/+0
| | | | | | | | The function is unused. Change-Id: Ib2154398981c0db20a2096c83b371d12920e34ea Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: David Skoland <david.skoland@qt.io>
* Use QCOMPARE(,) in preference to QVERIFY(qFuzzyCompare(,))Edward Welbourne2020-11-271-24/+24
| | | | | | | | | The former also does fuzzy comparison, but it reports what the values were, if the test ever fails. Change-Id: I36ecda1f69bf3f430c904b37cd8c3a23201ab7e2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* QCalendar: increase coverage by testsEdward Welbourne2020-11-271-7/+101
| | | | | | | | | | | | Added tests for aliases and various calendar properties, ensured dateToJulianDay()'s invalid date branch is exercised. Corrected assertion when constructing from system and asserted calendarSystem() is as expected. Pick-to: 5.15 Task-number: QTBUG-88183 Change-Id: I510afcb5d9d115f68148d1f679f3224d712f92f4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix compiler warning from comparing signed to unsignedVolker Hilsheimer2020-11-271-1/+1
| | | | | | std::vector::size returns size_t, which is unsigned. Change-Id: I81ba3d58a1bd3a3c3d90c911263a5c0df0441b16 Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Fix compiler warnings from deprecated methodVolker Hilsheimer2020-11-271-7/+6
| | | | | | | | | QTextCharFormat::fontFamily is deprecated in favor of fontFamilies, which returns a QStringList wrapped in a QVariant, whereas the setter expects a QStringList. Change-Id: I3333eaae4fc5ec3e3bdbec58047d6b3554b4a171 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix compiler warning from deprecated functionVolker Hilsheimer2020-11-271-2/+3
| | | | | Change-Id: I34d6788fd5b9ab004b0e337933bea90c8f63717a Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Android: fix tst_android testAssam Boudjelthia2020-11-252-3/+2
| | | | | | | Fixes: QTBUG-88506 Pick-to: 6.0 Change-Id: I938de388fce8ec393b03b2f0f42ddfe9094e6a5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: exclude faulty qfilesystemwatcher testAssam Boudjelthia2020-11-253-2/+7
| | | | | | | Task-number: QTBUG-88508 Pick-to: 6.0 Change-Id: I11b845e74e599d3bdae4f9490a591893531bc77b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: exclude faulty tst_selftestsAssam Boudjelthia2020-11-253-2/+11
| | | | | | | | | | | This test was failing but was returning a pass because of a bug in androidtestrunner. Task-number: QTBUG-88507 Task-number: QTBUG-88508 Pick-to: 6.0 Change-Id: I4fda7c2ddf8cd1e6858617e7bb447078c5768a75 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QSet: add missing insert-with-hintMarc Mutz2020-11-251-2/+2
| | | | | | | | | | | | | Since QHash is missing the overload, too, just ignore the hint for now, but provide the STL-compatible signature so generic code can use QSet as a normal sequential container. [ChangeLog][QtCore][QSet] Added insert() overload taking an insertion hint, for STL compatibility. Change-Id: I9fe41877343ebff721b650fb7b9cd4e06b6608d8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix compiler warning from deprecated functionVolker Hilsheimer2020-11-251-1/+1
| | | | | | | | Make the string into a list and call setFontFamilies. Pick-to: 6.0 Change-Id: I1b70db784fd6e495b48917141d07bacd1e883882 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* QVLA: do not include QtTestGiuseppe D'Angelo2020-11-251-1/+1
| | | | | | | | The right include is QTest, QtTest drags in all of QtCore. Change-Id: Icc2964ccdb85fe1bfc9fe8f43351a4605a34329b Pick-to: 6.0 5.15 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Change generated resources namingAlexey Edelev2020-11-241-3/+3
| | | | | | | | | | Align generated resources .qrc file naming to qmake naming. Update tests. Fixes: QTBUG-88581 Pick-to: 6.0 Change-Id: Id8a2f91f23c257e5b8bd371748c2151ec54a6418 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix tst_qfiledialog2 in case directory ~/foo existsAndreas Buhr2020-11-241-2/+2
| | | | | | | | | | | One test in tst_qfiledialog2 only succeeded if the directory "~/foo" did not exist. This patch changes the path used to "~/Vugiu1co" which has hopefully a much lower probability of existing. The string "Vugiu1co" is taken from a call to "pwgen". Pick-to: 6.0 Change-Id: Ia82b07902a91eb908a74aa90cdbdf4761d432d9a Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Fix tst_qlibrary after rebuildAndreas Buhr2020-11-242-2/+30
| | | | | | | | | | | | | | | | tst_qlibrary depends on a library (targets mylib and mylib2) to be built. They create a library with the same name, in two versions. This is done in order to test versioned library loading. However, those two libraries were fighting over the creation of "libmylib.so". In a fresh build, mylib2 wins, as intended. But after a rebuild, mylib won, which led to failing unit tests. This patch changes the situation. With this change, mylib no longer tries to create "libmylib.so". Thus no fighting and no problem. Pick-to: 6.0 Change-Id: Id89baa5503c9f078a8737ff0b8616edf09044f72 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Blacklist authenticationCacheAfterCancel on Ubuntu 20.04Alexandru Croitor2020-11-241-0/+4
| | | | | | | | | | | | | | It flaky fails integrations. Amends 2b49b01aa3467173f0be9252cfa50b41a311dd57 Task-number: QTBUG-88417 Change-Id: I6aad6ee7a70e580da64e75f69e8c9cab1cb78cd7 Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 143d619ba33c693fbbf9fbc3587921a44ae87435) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Return a QString() if the families list is emptyAndy Shaw2020-11-241-2/+6
| | | | | | Fixes: QTBUG-88781 Change-Id: Iafed2be29e2e0c3029e832986ba58d19446214eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Skip QSystemTrayIcon unit test for offscreen platformAndreas Buhr2020-11-241-0/+3
| | | | | | | | | When we are using the offscreen plugin, there might or might not be a working system tray icon. This patch disables the unit test in that case as we do not know what to expect. Change-Id: I34fded516300cc9aab1eb67644dcef8631ecfdf1 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* QMessageAuthenticationCode: extend testsIvan Solovev2020-11-241-0/+61
| | | | | | | | | | - Add test for static hash() method - Add tests for addData() overloads - Add input data for sha384 and sha512 Task-number: QTBUG-88183 Change-Id: I7e16419b3a582468fd1de15613e1157af428bc4c Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Fix tst_qlibrary by telling CMake about required librariesAndreas Buhr2020-11-231-0/+1
| | | | | | | | | | | | | tst_qlibraries needs to test libraries to be built in order to run successfully. However, these libraries were not mentioned as dependencies in CMake. This patch fixes that. Fixes: QTBUG-88445 Pick-to: 6.0 Change-Id: Ic335e46664edd98217bd55a9bca5a58a39cffe66 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QPasswordDigestor - improve code coverageTimur Pocheptsov2020-11-231-0/+59
| | | | | | | | | | By extending (a bit) an auto-test to cover paths found by LCOV. All of them is just to trigger the code that checks input parameters. Pick-to: 5.15 Pick-to: 6.0 Change-Id: I62f9a9045038ff8d123fd1396f4bfd85e75c6d8f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSslConfiguration - improve code coverageTimur Pocheptsov2020-11-232-4/+43
| | | | | | | | | | By adding auto-tests that were missing/not triggering the paths found by LCOV. Pick-to: 5.15 Pick-to: 6.0 Change-Id: I472f59e8e7292786c80d7c8dcebde53a2982e1ec Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix compiler warning about discarded return valueVolker Hilsheimer2020-11-231-1/+1
| | | | | | | | | Not testing the result of the copying, just verifying that it doesn't assert. Pick-to: 6.0 Change-Id: Ib51129134b74c17eada7e3819ccfff10bb9affbf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QMetaType: Track whether type is QML list typeFabian Kosmale2020-11-231-19/+23
| | | | | | | | | This information is required in the QML engine to handle list properties (instances of QQmlListproperty<T> and list<T> types from QML). Pick-to: 6.0.0 6.0 Change-Id: I1e30572f1c91f58b290cb9b4b07433af99a1db6f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Add convenience functions for QFuture creationIvan Solovev2020-11-231-0/+69
| | | | | | | | | | [ChangeLog][QtCore][QFuture] Add convenience functions to create a ready QFuture and a QFuture with an exception Task-number: QTBUG-86713 Change-Id: Ic7f9ca590a8ea8a9696b84f35bad074780794461 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Replace qt_make_unique with std::make_uniqueAllan Sandfeld Jensen2020-11-231-3/+2
| | | | | | | We can depend on C++14 now. Change-Id: Iee9796cd22dbfbb70d4bdb25f0eee1662a026d6d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* tst_QProcess: fix compilation on WindowsAlex Trotsenko2020-11-221-0/+2
| | | | | | | | | | Suppress warning: ..\tst_qprocess.cpp:272:13: warning: 'void childProcessModifier(int)' defined but not used ... Change-Id: Idf601df78be256cfbee0ca80252d1c364c712c8e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QMargins(F): add support for structured bindingGiuseppe D'Angelo2020-11-221-0/+56
| | | | | | | | | | | [ChangeLog][QtCore][QMargins] QMargins is usable in a structured binding. [ChangeLog][QtCore][QMarginsF] QMarginsF is usable in a structured binding. Change-Id: I0c501847b9377c47bd0e63da3735792075bd0079 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add unit test for QAnyStringView::compareAndreas Buhr2020-11-211-1/+8
| | | | | | | | | | | Coverage tests revealed that QAnyStringView::compare(QAnyStringView, QAnyStringView, CaseSensitivity) was not tested in our unit tests. This patch adds a test for this. Pick-to: 6.0 Change-Id: Id8e0d8af87e7e7ab192fb7554a278ddbb890fb14 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fit tst_qprinterinfo in case there are printers in local networkAndreas Buhr2020-11-211-4/+2
| | | | | | | | | | | | tst_qprinterinfo compared the output of "lpstat -p" with the result of a call to "cupsGetDests". "lpstat -p" only returns local printers, "cupsGetDests" also returns printers on the local network. This patch fixes the test by using "lpstat -e", which also shows printers on the local network. Pick-to: 6.0 Change-Id: Ia70adad8b8467f4c738f769d34757786fc9645b2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix weight when reading old serialized QFontsEskil Abrahamsen Blomfeldt2020-11-202-4/+4
| | | | | | | | | | | | | | | | | | The QFont::fromString() needs to differ between strings produced before and after Qt 6.0 when interpreting the weight value, since in older strings this will be the legacy scale. Luckily the number of tokens in the string can be used for this purpose, since many tokens were added in Qt 6.0. This broke KDE, where font settings are stored in QSettings and serialized using QFont::toString() from Qt 5. Fixes: QTBUG-88589 Pick-to: 6.0.0 6.0 Change-Id: I199737fed61917f8b9d8f86176ead29a89eb8e0c Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Android: exclude qarraydata::dataPointerAllocate() from CI testsAssam Boudjelthia2020-11-201-0/+3
| | | | | | | | Task-number: QTBUG-88705 Task-number: QTBUG-87025 Pick-to: 6.0 Change-Id: If2dc0e650e5104d00a097e6195dd117d6cfd64e6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Extend tests for QMarginsIvan Solovev2020-11-201-0/+38
| | | | | | | | | - Add check for QT_NO_DATASTREAM macro - Add tests for QDebug operator<< Task-number: QTBUG-88183 Change-Id: I346777a3237986f7f950f157e50cae846b077e11 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QPoint(F): add support for structured bindingGiuseppe D'Angelo2020-11-202-0/+119
| | | | | | | | | | | | | | | QPoint(F) are "naturally" destructurable in their x/y counterparts (hello Mac/Carbon users, we don't live in 1999 any more, it's x and then y, and not vice versa...). [ChangeLog][QtCore][QPoint] QPoint is usable in a structured binding. [ChangeLog][QtCore][QPointF] QPointF is usable in a structured binding. Change-Id: I8718a4e80be4ce03f37f012034f1fba009304b32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qocsp: improve code coverageTimur Pocheptsov2020-11-201-3/+16
| | | | | | | | | | By simply extending the basic test to trigger qHash, isEqual and a bunch of getters. Pick-to: 6.0 Pick-to: 5.15 Change-Id: Ib1d88fc6d2ad623743cea77ac286ae6ac819dfd1 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Add unit test for YearMonthDateAndreas Buhr2020-11-201-0/+31
| | | | | | | | | Coverage analysis showed that QCalendar::YearMonthDate was not rigorously tested. This patch adds a unit test. Pick-to: 6.0 Change-Id: I0af485d13c4883764b61ea1e35455905cc77b966 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Add unit test for QString::insert(negativeint, QChar)Andreas Buhr2020-11-201-0/+1
| | | | | | | | | | QString::insert(qsizetype, QChar) can insert at negative positions, then counting from the end of the string. Coverage analysis revealed we do not have a unit test for this. This patch adds a unit test. Pick-to: 6.0 Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Add unit test reproducing integer overflow in QDateTime::fromStringAndreas Buhr2020-11-201-0/+5
| | | | | | Task-number: QTBUG-88656 Change-Id: I05b9ad1dfa9b3f02480d8e99a523371342bdba9b Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* QSslCipher - improve its code coverage and auto-testsTimur Pocheptsov2020-11-202-23/+25
| | | | | | | | | | | | | tst_qsslcipher was quite useless - now we test that default constructed QSslCipher reports expected values. Test the non-default from the different auto-test, where we are sure we have really useful ciphersuites (with different parameters obtained from a TLS backend, where it's possible). Pick-to: 6.0 Pick-to: 5.15 Change-Id: Iff14a0580fed889cf9e0873bee01d968773626db Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove QScopedSharedPointerGiuseppe D'Angelo2020-11-201-2/+0
| | | | | | | It's private and unused since ~2012. Change-Id: Iea11af27f7eebf3eae2467b22b68cd4c26885edd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QTcpSocket::connectToHostError - handle possible timeoutsTimur Pocheptsov2020-11-202-9/+31
| | | | | | | | | | | | ... instead of failing the test. On Ubuntu 20.04 when calling 'connect' with 0.0.0.1 we get EINPROGRESS and nothing else, since our own internal timer has 30 s. timeout, the event loop in the test stops before this and no socket error detected yet. Handle such situation without failing a test. Fixes: QTBUG-88042 Change-Id: Id6add27fcf9bbbe5fbf83a193652edf08fbad8d6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Test conversion of ulonglong variant to JSONSona Kurazyan2020-11-201-0/+12
| | | | | | | | Make sure ulonglong variant converts to a double JSON value when the value is greater than 2^63. Change-Id: I4d4392b05de29c220624056d5d0d4664fb2c08b7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFont: Prefer setFamilies() over setFamily()Andy Shaw2020-11-207-33/+56
| | | | | | | | | | | | | | | | By depending on setFamilies() then we can be sure that font names with spaces, commas, quotes and so on are correctly handled without being misinterpreted. For now it will split on the comma when a string containing one is passed to setFamily. But from Qt 6.2 this will be removed to preserve the family string as a convenience function. [ChangeLog][QtGui][QFont] Indicated that setFamilies/families is preferred over setFamily/family to ensure that font family names are preserved when spaces, commas and so on are used in the name. Change-Id: Id3c1a4e827756a4c928fed461a4aafa5a0f06633 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Revert "Allow QWindowsPipe{Reader,Writer} to work with foreign event loops"Kai Koehne2020-11-207-294/+2
| | | | | | | | | | | | | | This reverts commit ee122077b09430da54ca09750589b37326a22d85. Reason for revert: This causes QProcess::readAll() to sometimes return nothing after the process has ended. Fixes: QTBUG-88624 Change-Id: I34fa27ae7fb38cc7c3a1e8eb2fdae2a5775584c2 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 23100ee61e33680d20f934dcbc96b57e8da29bf9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add tst_QHighDpi::mouseVelocity()Shawn Rutledge2020-11-201-0/+102
| | | | | | | | | | Ensure the values are reasonable regardless of screen DPI. Velocity is supposed to be in logical pixels / second. Task-number: QTBUG-88252 Task-number: QTBUG-88346 Change-Id: Ic209887f8ed0381c033a9ff04ae48b072c444df4 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Add unit test for QString::replace with out-of-bounds positionAndreas Buhr2020-11-191-0/+10
| | | | | | | | | | | QString::replace(pos, len, *unicode, size) can handle positions which are outside of the this-string. In that case, it is a no-op. Coverage analysis revealed we do not have a unit test for this. This patch adds one. Change-Id: Id4a407e860fff0d5c7c0a200c379e5e3961c86d2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Fix logic error in QString::replace(ch, after, cs)Andreas Buhr2020-11-191-0/+11
| | | | | | | | | | Coverage analysis showed that an if-branch marked "Q_LIKELY" was never taken. It turns out the code was incorrect, but behaved correctly. This patch fixes the logic and adds a unit test. Pick-to: 5.15 Change-Id: I9b4ba76392b52f07b8e21188496e23f98dba95a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fuzzing: Add a test for QDateTime::fromStringEdward Welbourne2020-11-192-0/+110
| | | | | | | | | | This patch adds a basic fuzzing test for QDateTime::fromString. Task-number: QTBUG-87104 Pick-to: 5.15 Change-Id: Icc51386f06f6d4d2a4495734f7fa45de80c6e065 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* Make QMetaTypeInterface constexpr on WindowsLars Knoll2020-11-191-12/+23
| | | | | | | | | | | | | | | | This was so far problematic as it gave various link errors. The solution to that seems to be to make the default constructor of QPairVariantInterfaceImpl constexpr to get around one set of problems. The other problem to solve where undefined references to metaobjects. The reason for that is apparently that QMetaTypeInterface contains a direct pointer to the meta object, something the linker doesn't like. Adding a level of indirection by using a function that returns the pointer seems to solve that problem. Fixes: QTBUG-88468 Change-Id: I5612ae807ea3b7e49bc40349d8d1fca1be9bd7ee Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>