summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
Commit message (Collapse)AuthorAgeFilesLines
* tst_QDateTimeEdit::displayFormat() remove setActiveWindow()Frédéric Lefebvre11 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I5770bebfa4e2219d511ef8e1396ad550b1ba7b41 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit::backspaceKey() remove setActiveWindow()Frédéric Lefebvre11 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Ia2524280d57286ac53c684b53f9bee6c6c85b8c1 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit::deleteKey() remove setActiveWindow()Frédéric Lefebvre11 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I49a6202e22246f9bf724636badbd87d9fb40d49d Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit::tabKeyNavigation() remove setActiveWindow()Frédéric Lefebvre11 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: Ic3425eecedffe0def3aa851157aedc4231dca1e9 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit::enterKey remove QApplicationPrivate::setActiveWindowFrédéric Lefebvre11 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I948165217193a6616828475682c7d75f057b3f39 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit::tabKeyNavigationWithSuffix remove setActiveWindow()Frédéric Lefebvre11 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I719af713c2f41fb722ef55a772f9ea22e3e83ae0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit::tabKeyNavigationWithPrefix remove setActiveWindow()Frédéric Lefebvre11 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I1bda28255f1c8939ef1796aaf80821009c01cee0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit::editingRanged() remove setActiveWindow()Frédéric Lefebvre12 days1-1/+0
| | | | | | | | | | | 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22 has made calls to QApplicationPrivate::setActiveWindow() redundant. Remove redundant calls. Task-number: QTBUG-121488 Change-Id: I812ca8a9615ffa0fae6228b0a09f4df6b1a91c09 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Suppress deprecation warnings in test of QDTE::timeSpec propertyEdward Welbourne2023-10-261-0/+3
| | | | | | | | The tests are suitably #if-ed to be omitted once the property is gone, but the compiler can still warn. Change-Id: I20efcf9bb40fe6d7ad7e21b64e5400f71c0a0b15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a QDateTimeEdit::timeZone propertyEdward Welbourne2023-10-231-22/+22
| | | | | | | | | | | | | | This shall ultimately replace its timeSpec property, which had already been turned into a derived property of an internal timezone. [ChangeLog][QWidget][QDateTimeEdit] Added timeZone property to enable a datetime edit widget to control the timezone used. This makes the timeSpec property redundant; this old property shall be deprecated from 6.10. Fixes: QTBUG-80417 Change-Id: I3cdb686bd2dada0e5067f5b4c1828b73892e424a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* tst_QDateTimeEdit: skip parameters on EditorDateEdit declarationEdward Welbourne2023-07-101-4/+4
| | | | | | | | Its single parameter is a pointer that defaults null, so don't bother passing nullptr, much less 0, as it. Change-Id: Iec68bf388d848c020359001699c971e12266a335 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Explain the cases where we must exclude some QDTE test casesEdward Welbourne2023-04-141-21/+24
| | | | | | | | | | The stepIntoDSTGap() hour cases were already conditioned on hour > 0, explain why. The month and year tests need similar checks for kindred reasons; add and document those checks. Pick-to: 6.5 Change-Id: Ibcb69449fcd572ee94306a805fd680e9b5155322 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Correct time zone in tst_QDateTimeEdit::stepIntoDSTGap()Edward Welbourne2023-04-141-1/+1
| | | | | | | | | | Given that QDTE only supports local time and UTC, using Europe/Oslo as zone was disconnected from reality, especially as various QDateTime()s were constructed using local time. Use the system zone. Pick-to: 6.5 6.2 Change-Id: I95b3a6a6acf9ffc2b8c7f05d3dd9440ff173abfe Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Correct the start of a QDTE::stepIntoDSTGap() testEdward Welbourne2023-04-141-1/+1
| | | | | | | | | | | | | | The test wants to start shortly after the transition, then step an hour backwards, into it, to check we land safely on the other side. However, it assumed the gap witdh was an hour, which is not reliable. Use the gapWidth already used in computing springGap instead. The -3590 seconds in the result time is correct, as it's the ten extra seconds we started beyond the gap, minus the hour we step backwards. Pick-to: 6.5 Change-Id: I4399af7e54a60bd55ea51d054d3cd2ecfcb0e354 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QDateTimeEdit::springForward(): use u'0' instead of QLatin1Char('0')Edward Welbourne2023-04-141-4/+4
| | | | | | Pick-to: 6.5 Change-Id: I0c13c6b658cac3472d21b8d92b1e5eb73c094a7c Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Correct row names in tst_QDateTimeEdit::springForward_data()Edward Welbourne2023-04-141-7/+8
| | | | | | | | | | | | The "{forward,back} to %s, correct to nearest" tests were reporting the time of the transition as %s but, like the jump test, were using the middle of the gap as the time to set. So compute that mid-time's string once and use it in all three test names. Also renamed some local variables to accommodate the new one for this text. Pick-to: 6.5 Change-Id: Ic6c40c470fc74ae8bcfc0dc9d1596af06318a883 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QDateTimeEdit: correct computation of width of gapEdward Welbourne2023-04-141-2/+15
| | | | | | | | | | | | Although the zone's daylight time offset is usually the width of the gap, it's possible the transition is (or includes) a change to standard time; so determine the actual gap width by comparing the difference between time a day earlier and later to the usual duration of two days. Also skip the test if the transition isn't really a gap. Pick-to: 6.5 Change-Id: I56e381c9f74cfa1806d43b3ed5e4637436ebdf57 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QDateTimeEdit: Use correct zone for findSpring()'s transitionEdward Welbourne2023-04-141-1/+1
| | | | | | | | | | The function is passed a zone to work in, so setting the transition to local time made no sense; set to the given zone's time, instead. Pick-to: 6.5 Change-Id: Icaa0955fe5fcd5bc257322afcb7e25e932dedd1b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mate Barany <mate.barany@qt.io>
* tst_QDateTimeEdit::stepModifierPressAndHold(): tweak start dateEdward Welbourne2023-03-281-1/+5
| | | | | | | | | The test can collide with a 1960-01-01 transition in some zones, so move it to Jan 2nd to avoid that. Pick-to: 6.5 Change-Id: I5286cadc0de0b66283253b0ac736f23a2add0c8f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Port QDateTimeEdit internals to QTimeZoneEdward Welbourne2022-12-091-30/+10
| | | | | | | | | | | | | | | | | | | | | In the process, centralize the creation of date-time values, where doing so requires catching invalid results caused by spring-forward gaps; this saves some repetition and extends the treatment to more places that did need it. Also, de-inline two overrides of virtuals; being inline does them no good. Replace the Qt::TimeSpec member of QDTEPrivate with a QTimeZone so that creation of values can be streamlined and to make it easier to add support for (currently unsupported) OffsetFromUTC and TimeZone timespecs in the public QDTE API. This greatly simplifies a lot of the code, while preparing it for a long-needed extension to its functionality. Task-number: QTBUG-80417 Task-number: QTBUG-108199 Change-Id: I0ac2c78025013bf89899e3ef1a56e89392f67ce5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Port from container::count() and length() to size() - V5Marc Mutz2022-11-031-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); except that the on() matcher has been replaced by one that doesn't ignoreParens(). a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'. Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache, to avoid porting calls that explicitly test count(). Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix use of 0 as null pointer in tst_QDateTimeEditEdward Welbourne2022-09-201-2/+2
| | | | | Change-Id: Ie529150801e3bbfc7c3203e49f712239cb3e82bd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate QApplication::setActiveWindow() and mark as internalTor Arne Vestbø2022-08-271-8/+10
| | | | | | | | | | | | | | The function is used the internal window activation machinery and should not be called by user code. Many tests still use this function, and should be ported over to QWidget::activateWindow(). For now they are using the private helper in QApplicationPrivate, so that we can progress with the public API deprecation. Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix initialization of QDateEdit and QTimeEditEdward Welbourne2022-08-041-2/+0
| | | | | | | | | | | | Since 6.3 these use Qt::UTC as time-spec but I neglected to take that into account in QDateTimeEditPrivate::init()'s construction of a QDateTime from the QDate or QTime. This amends commit c00ee2f31013e99c79b820a0db57003c110a5510. Fixes: QTBUG-105322 Pick-to: 6.3 6.4 Change-Id: I11dec9808a54cf7da401b1734a9a2812f5fd2e63 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix handling of invalid input to Q(Date|Time)Edit constructorsEdward Welbourne2022-08-041-2/+1
| | | | | | | | | | | Change to match how QDateTimeEdit()'s overloads taking a QDate or QTime work, substituting a default value in place of an invalid one. This fixes one surprising anomaly in a recently-extended test, so that it now only fails the way I expected. Task-number: QTBUG-105322 Change-Id: Ied4da6160b7efe70990f956798fb826b5b36d8bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Expand QDateTime edit constructor tests to cover Q(Date|Time)EditEdward Welbourne2022-08-041-20/+51
| | | | | | | | | | | | | | The constructor_qdate() and constructor_qtime() tests only tested QDateTimeEdit with a QDate or QTime. Extend them to also test QDateEdit and QTimeEdit constructors, respectively. This revealed one surprise; the QDateEdit constructor doesn't replace an invalid QDate with the usual start-date, as the QDateTimeEdit does. It also serves to reproduce a bug reported in Qt 6.3, see Task-number. These are all marked XFail for now. Task-number: QTBUG-105322 Change-Id: Ifafb40a9b78d9314b74ca9a1710d362b9a3cb18d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify the data tables for some QDateTimeEdit constructor testsEdward Welbourne2022-08-041-75/+30
| | | | | | | | | | | | | | | | | | It makes no sense to pass, as parameters, values that can't vary between test data rows, so eliminate m{in,ax}imum{Dat,Tim}e columns. There were no parameters used to control how those would be set, so they were always going to be the type's defaults. The displayDateTime was only needed for the invalid test, in which its value is known and fixed; for the normal test it was necessarily implied by the parameter used to initialize the QDateTimeEdit. While the QDate and QTime tests do have to supplement that construction information, the other part is again known and fixed. We can check the data-tag against "invalid" to determine which known and fixed data to use, saving the need for a data table column. Change-Id: I3754ba1a6a127a4a872a7f4a3e7edad9a5ff0ec0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtBase: replace windows.h with qt_windows.hYuhang Zhao2021-11-231-3/+1
| | | | | | | | | | We have some special handling in qt_windows.h, use it instead of the original windows.h Change-Id: I12fa45b09d3f2aad355573dce45861d7d28e1d77 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use UTC when parsing only a date or only a time, not a date-timeEdward Welbourne2021-06-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This should reduce the amount of fall-out from DST complications. Also document the assumptions of QDateTimeParser's two fromString() methods (and fix the punctuation on the QDateTime parameter). Adjusted some tests to match. Since only QDateTime-returning methods will show the difference, and it's at least somewhat odd to be using those on QDateEdit or QTimeEdit, this should have little impact on API users. [ChangeLog][QtCore][Behavior Change] QDateEdit and QTimeEdit now operate in UTC, to avoid spurious complications arising from time-zone transitions (e.g. DST) causing the implicit other half to combine with the part being edited to make an invalid result. Returns from their dateTime() and other methods returning QDateTime (max/min) shall thus be in UTC where previously they were in local time. QDateTimeEdit continues using local time. The default can be over-ridden by setTimeSpec(), as ever. Change-Id: I44fece004c12342fe536bbe3048217d236fd97b2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix handling of day-of-week in QDateTimeParser and QDateTimeEditEdward Welbourne2021-06-231-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDTP's absoluteMax(), setDigit() and getDigit() simply treated day-of-week as synonym for day-of-month. Consequently, QDTE::stepBy() did the same. This meant that wrapping happened at the month boundary, so would jump within the week if it wrapped around, otherwise the up/down arrow would "jam" at a particular day of the week when further steps would leave the month. Instead, when wrapping, wrap round the week while still moving the day-of-month to match, jumping back or forward a week to stay within the month on hitting a month boundary; otherwise, stop backwards stepping on hitting the locale-specific day of the week, or forward stepping when the step would be to or past this first day. Fixed various bugs found in the course of testing this. [ChangeLog][QtWidgets][QDateTimeEdit] Corrected handling of weekdays. Previously, changes to the week-day were simply changes to the day of the month. Weekday fields are now handled as such: changes to them do change the day of the month, but a change that would step past the end (or start) of the month is adjusted to the relevant day of the nearest week within the month. When wrapping is disabled, the locale-specific first and last days of the week are the bounds. Formats which specify day of week but not day of month will now preserve day of week when changing month or year, selecting the nearest day of month that matches. Change-Id: I7868b000fea7a4bc17a1b5687c44bcd56d42ae90 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QDateTimeEdit::editingRanged(): use QScopedPointerEdward Welbourne2021-06-031-16/+12
| | | | | | | | | | Test would previously have leaked on failure. While checking for other uses of delete-after-checks, simplify one place that tested deleting a calendar widget lead to recreation. Pick-to: 5.15 6.1 Change-Id: I9524902a02dd42793bcf71113c6799dc925ac4a0 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add the "Territory" enumerated type for QLocaleJiDe Zhang2021-04-151-2/+2
| | | | | | | | | | | | | | | | | | | The use of "Country" is misleading as some entries in the enumeration are not countries (eg, HongKong), for all that most are. The Unicode Consortium's Common Locale Data Repository (CLDR, from which QLocale's data is taken) calls these territories, so introduce territory-based names and prepare to deprecate the country-based ones in due course. [ChangeLog][QtCore][QLocale] QLocale now has Territory as an alias for its Country enumeration, and associated territory-based names to match its country-named methods, to better match the usage in relevant standards. The country-based names shall in due course be deprecated in favor of the territory-based names. Fixes: QTBUG-91686 Change-Id: Ia1ae1ad7323867016186fb775c9600cd5113aa42 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-6/+4
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Restore previous QDateTime behavior in DST gapAndreas Buhr2020-12-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Historic QDateTime behavior when being asked to create a QDateTime in the DST gap was to interpret the given date as if it was in the time before that gap, mapping it to a point in time after the gap. This has changed with a04411119ead3d4473e4f0ac4bceedc585977b2f . Since then, the given date is interpreted as if it was in the time after the gap, thus being mapped to a point in time before the gap. This patch restores the historic behavior. This was not caught by Coin because machines ran in timezone "Atlantic/Reykjavik" which does not have DST since 1967. This patch changes tests to always run in "Europe/Oslo". Driveby: Test function "findSpring" did some operations in local time, even though being asked to work in a specific time zone. Fixed that. Fixes: QTBUG-86960 Fixes: QTBUG-89208 Pick-to: 6.0 5.15 Change-Id: Iecce5898bf9711a10e7dfc0a25e4bbeaed1c8ade Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate QVariant::TypeLars Knoll2020-10-231-1/+1
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Avoid repeated date-time formatting in test data namingEdward Welbourne2020-10-091-14/+16
| | | | | | | | Also correct two comments which lied about the year being tested. Change-Id: I5be491a2b2c1e0c3b49d6ff9a8de852e17321cff Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-071-1/+1
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Test end-date, not just its string representation, in QDTE testEdward Welbourne2020-10-061-170/+264
| | | | | | | | | | | | | In tst_QDateTimeEdit::dateEditCorrectSectionSize(), only the final displayed date was tested; many of the tests checked day of week (by name), which might well match despite actually selecting a different date than the one intended. So test the date is as expected, too. In the process, tidy up the code, give values more informative names, turn a trivial static function into a lambda. Change-Id: I0491159e9ee2f3cfdcf8a194c723be92c190c2a8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Re-enable a QDateTimeEdit right-to-left test of its sectionText()Edward Welbourne2020-09-301-8/+11
| | | | | | | | | Use a QScopeGuard to fix its restoration of left-to-right mode after completion. Change-Id: I5ac1e44629e72d993f2d5ba6586b86508d57cdaf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andreas Buhr <andreas.buhr@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Remove winrtOliver Wolff2020-06-061-1/+1
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make qtbase compile without QT_CONFIG(timezone)Andrei Golubev2020-05-111-0/+14
| | | | | | | | Fixes: QTBUG-83795 Pick-to: 5.15 Change-Id: I05eaaf57d87a9111d3609ebab81bc707f8af98f0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-04-081-0/+116
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/doc/src/cube.qdoc src/corelib/global/qlibraryinfo.cpp src/corelib/text/qbytearray_p.h src/corelib/text/qlocale_data_p.h src/corelib/time/qhijricalendar_data_p.h src/corelib/time/qjalalicalendar_data_p.h src/corelib/time/qromancalendar_data_p.h src/network/ssl/qsslcertificate.h src/widgets/doc/src/graphicsview.qdoc src/widgets/widgets/qcombobox.cpp src/widgets/widgets/qcombobox.h tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp tests/benchmarks/corelib/io/qdiriterator/qdiriterator.pro tests/manual/diaglib/debugproxystyle.cpp tests/manual/diaglib/qwidgetdump.cpp tests/manual/diaglib/qwindowdump.cpp tests/manual/diaglib/textdump.cpp util/locale_database/cldr2qlocalexml.py util/locale_database/qlocalexml.py util/locale_database/qlocalexml2cpp.py Resolution of util/locale_database/ are based on: https://codereview.qt-project.org/c/qt/qtbase/+/294250 and src/corelib/{text,time}/*_data_p.h were then regenerated by running those scripts. Updated CMakeLists.txt in each of tests/auto/corelib/serialization/qcborstreamreader/ tests/auto/corelib/serialization/qcborvalue/ tests/auto/gui/kernel/ and generated new ones in each of tests/auto/gui/kernel/qaddpostroutine/ tests/auto/gui/kernel/qhighdpiscaling/ tests/libfuzzer/corelib/text/qregularexpression/optimize/ tests/libfuzzer/gui/painting/qcolorspace/fromiccprofile/ tests/libfuzzer/gui/text/qtextdocument/sethtml/ tests/libfuzzer/gui/text/qtextdocument/setmarkdown/ tests/libfuzzer/gui/text/qtextlayout/beginlayout/ by running util/cmake/pro2cmake.py on their changed .pro files. Changed target name in tests/auto/gui/kernel/qaction/qaction.pro tests/auto/gui/kernel/qaction/qactiongroup.pro tests/auto/gui/kernel/qshortcut/qshortcut.pro to ensure unique target names for CMake Changed tst_QComboBox::currentIndex to not test the currentIndexChanged(QString), as that one does not exist in Qt 6 anymore. Change-Id: I9a85705484855ae1dc874a81f49d27a50b0dcff7
| * QDateTimeEdit: with keyboardTracking off, allow values outside the rangeVolker Hilsheimer2020-03-201-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QDateTimeEdit very aggressively prevents user input that would result in values that are outside the dateTimeRange. While keyboardTracking is on this makes sense, as otherwise the dateTimeChanged signal would be emitted after each section, with a value that is outside the range. However, this prevented users from entering a date that is allowed, but where sections of the date are above or below the respective section in the maximum or minimum value. If keyboardTracking is off, QDateTimeEdit only emits the dateTimeChanged signal at the end of editing, when focus is lost or the return key is pressed, and then it enforces that the value is within the range anyway. This change makes the parser ignore the range during editing if keyboardTracking is off, thus allowing the user to enter a date where temporary values are outside the range. The test makes sure that we don't get signals emitted with out-of-range values, testing both with and without keyboard tracking. Change-Id: I00fb9f1b328a3477163f890c4618b40878657816 Fixes: QTBUG-65 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-02-281-0/+231
|\| | | | | | | Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
| * Fix QDateTimeEdit's handling of invalid time in dst gapVolker Hilsheimer2020-02-271-0/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During a spring forward, a time-zone omits an hour. A QDateTime with such an hour is invalid, but QDateTimeEdit's handling of this invalid time was not done correctly. With this fix, up/down changes of any field that would result in an invalid date-time corrects the time to be valid, while leaving as much as possible of the user-entered data unchanged. To do that, we rely on QDateTime::toMSecsSinceEpoch to return a value even for such an invalid time, which then can be used to construct a valid QDateTime. Edits that would result in an invalid hour are reverted to the previous when pressing return, if correctionMode is CorrectToPreviousValue. This change also implements support for CorrectToNearestValue, which uses the same mechanism as when stepping over an invalid time. Include a test that verifies that the various interactions result in a reasonable value. Since QDateTimeEdit does not respect the timezone or timespec of the QDateTime it is initialized with, we have to find the first hour of daylight saving time for a year that we know works for most time zones. Failing that, we have to skip the tests. Verified in a wide range of time zones. Change-Id: I05b906ae3b5f6681891d23704f00f9c10cd479ae Fixes: QTBUG-79803 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Convert date-time faithfully in QDateTimeEdit::setDateTime()Edward Welbourne2019-12-121-0/+50
|/ | | | | | | | | | | | | | | | | | | Previously, setDateTime() was documented to ignore the new date-time's time-spec. It used the date and time (determined using that timespec) with the QDateTimeEdit's configured spec. It is debatable whether that really counts as ignoring its time-spec. All the same, that's what it did. Fixing it is a behavior change. Added tests. [ChangeLog][QtWidgets][QDateTimeEdit] QDateTimeEdit::setDateTime() now converts the new datetime to the QDateTimeEdit's time-spec, rather than combining its date and time (determined using the time spec it came with) with the QDateTimeEdit's date and time. Fixes: QTBUG-71181 Change-Id: Ibf0bd87723c3957ca00a2199d51d992032ef57ee Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
* Avoid initializing QFlags with 0 or nullptr in testsFriedemann Kleint2019-11-261-4/+7
| | | | | | | Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99. Change-Id: Ib5d17611e43e7ab2c63c7f0587f549377f262e32 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>