summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/time/qcalendar
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Add QCalendar::matchCenturyToWeekday()Edward Welbourne2023-12-081-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This takes a YearMonthDay and a day-of-the-week, returning a QDate that (if possible, else invalid) has the given day of the week and differs from the YearMonthDay only in the century. This is useful when resolving dates with only two-digit year information, which can be disambiguated by the day of the week. Added tests of the new API. This adds a new virtual method to QCalendarBackend, for which that base class does provide a brute force implementation, so derived classes do not need to add implementations. It is, however, a binary-incompatible change for any backend plugins that may be in use to implement custom calendars. Worked out the details for the Gregorian calendar to make it possible to compute the right century (and whether any century works) without trial-and-error searching. Coded that up as its implementation of the new method. [ChangeLog][QtCore][QCalendar] Added a matchCenturyToWeekday() method for use when resolving dates given day, month and last two digits of the year, along with day of the week. Any custom calendar backend plugins shall need a recompile and may, optionally, implement the new virtual method behind this. Change-Id: I6003c8d9423d6bfb833957bb5120f2d423219c7a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* CMake: Make corelib tests standalone projectsAlexandru Croitor2023-07-051-0/+6
| | | | | | | | | | | | | | | | | | Add the boilerplate standalone test prelude to each test, so that they can be opened with an IDE without the qt-cmake-standalone-test script, but directly with qt-cmake or cmake. Boilerplate was added using the following scripts: https://git.qt.io/alcroito/cmake_refactor Manual adjustments were made where the code was inserted in the wrong location. Task-number: QTBUG-93020 Change-Id: I28b6d3815c5f43d2c33ea65764f6f3f8f129eaf3 Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor QGregorianCalendar::julianFromParts to return std::optionalEdward Welbourne2023-05-041-13/+13
| | | | | | | | | It's a private static used to optimize internal use, so we can freely get rid of its out parameter this way. Change-Id: Id62612987f10ecbbd9702610fd172286adbfd442 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tests: Remove remains of qmake conversion from CMakeLists.txt filesFriedemann Kleint2023-02-171-2/+0
| | | | | | | Pick-to: 6.5 Change-Id: I8d106554bb86ac1ec9bb7a4083de4c376bcbab1d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-231-1/+1
| | | | | | | Task-number: QTBUG-105718 Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-08-031-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* 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>
* Revise (recently-added) yearSharingWeekDays() to take a QDateEdward Welbourne2021-11-152-0/+50
| | | | | | | | | | This lets it avoid a two-digit year that would clash with month or day. That shall make fixing up system locale date formatting run cleaner. Add a test for QGregorianCalendar's two extensions. Change-Id: I77083ff9d5e4035763250904a59fcf416286545b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove the qmake project filesJoerg Bornemann2021-01-071-5/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-1/+1
| | | | | | | | | | | 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>
* 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>
* 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>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-1/+1
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Regenerate tests with new qt_ prefixed APIsAlexandru Croitor2020-07-091-1/+1
| | | | | | | | Use pro2cmake with '--api-version 2' to force regenerate projects to use the new prefixed qt_foo APIs. Change-Id: I055c4837860319e93aaa6b09d646dda4fc2a4069 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-02-131-1/+24
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/boxes/scene.h src/corelib/Qt5CoreMacros.cmake src/corelib/Qt6CoreMacros.cmake src/network/ssl/qsslsocket.cpp src/network/ssl/qsslsocket.h src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp src/testlib/CMakeLists.txt src/testlib/.prev_CMakeLists.txt tests/auto/corelib/tools/qscopeguard/tst_qscopeguard.cpp Disabled building manual tests with CMake for now, because qmake doesn't do it, and it confuses people. Done-With: Alexandru Croitor <alexandru.croitor@qt.io> Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io> Change-Id: I865ae347bd01f4e59f16d007b66d175a52f1f152
| * Clarify handling of unspecified year in two QCalendar methodsEdward Welbourne2020-01-311-1/+24
| | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore] QCalendar::monthsInYear(QCalendar::Unspecified) now returns maximumMonthsInYear(). QCalendar::daysInYear() now makes clear that its handling of unspecified year is undefined. Change-Id: Ifef8723193868c666f6afeb7f190af4929d30dea Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-141-2/+2
|\| | | | | | | Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
| * Rename calendar methods from m{in,ax} to m{in,ax}imumEdward Welbourne2019-09-041-2/+2
| | | | | | | | | | | | | | | | | | Words should not be abbreviated. Split a long line and reflowed some comments in the process. Fixes: QTBUG-78008 Change-Id: I52d75409f02e2cecbed3e94d424617ad594c275b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Regenerate qtbase after wip/qt6 -> wip/cmake mergeAlexandru Croitor2019-10-141-0/+10
|/ | | | | | | | | | | | | | | Note that android builds will be broken after this merge and regeneration, because we don't currently handle the minimum required changes that were brought in with the Android multi ABI support that comes from 5.14. This will have to be addressed in a separate change. For now the build on Android will fail while compiling due to incorrect generation of LIB_SUFFIX with QT_ARCH. Change-Id: Ia4a871f4b7ddd0da11caf5f34e10a599a97bb55d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* Add support for the Islamic Civil calendarSoroush Rabiei2019-08-221-0/+4
| | | | | | | | | | | | | | | | This has its own locale data, extracted from CLDR. This data may potentially be shared with other variants on the Islamic calendar, so is handled by a separate base-class, QHijriCalendar, on which such variants may base their implementations. [ChangeLog][QtCore][QCalendar] Added support for the Islamic Civil calendar, controlled by feature islamiccivilcalendar, with locale data that can be shared with other implementations, controlled by feature hijricalendar. Fixes: QTBUG-56675 Change-Id: Idf32d3da7034baa8ec5e66ef847e59a8a2f31cbd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for the Jalali (Solar Hijri or Persian) calendarSoroush Rabiei2019-08-211-0/+5
| | | | | | | | | | | | This has its own locale data, extracted from CLDR. [ChangeLog][QtCore][QCalendar] Added support for the Jalali (Persian or Solar Hijri) calendar, controlled by feature jalalicalendar. Fixes: QTBUG-58404 Change-Id: Id5c56a10db05a4fd612aafc01615273db81ec743 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for Julian and Milankovic calendarsSoroush Rabiei2019-08-211-0/+8
| | | | | | | | | | | | | These share their locale data with the Gregorian calendar, making them virtually free to add. Still leave them out of the boot-strap build, though. [ChangeLog][QtCore][QCalendar] Added support for Julian and Milankovic calendars. These are enabled by default, except in bootstrap builds. Change-Id: I585045ed9e78c1e959957f6772b3e144093b701c Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add support for calendars beside GregorianSoroush Rabiei2019-08-202-0/+224
Add QCalendarBackend as a base class for calendar implementations and QCalendar as a facade via which to access it. QDate's implicit implementation of the Gregorian calendar becomes QGregorianCalendar and QDate methods now support choice of calendar. Convert QLocale's CLDR data for month names to a locale-data component of each supported calendar and relevant QLocale methods now support choice of calendar. Adapt Python scripts for locale data generation to extract month name data from CLDR (keeping on version v35.1) into the new calendar-locale files. The locale data for the Gregorian calendar is held in a Roman calendar base, for sharing with other calendars. Add tests for basic uses of the new API. [ChangeLog][QtCore][QCalendar] Added QCalendar to support diverse calendars, supported by implementing QCalendarBackend. [ChangeLog][QtCore][QDate] Allow choice of calendar in various operations, with Gregorian remaining the default. Done-with: Lars Knoll <lars.knoll@qt.io> Done-with: Edward Welbourne <edward.welbourne@qt.io> Fixes: QTBUG-17110 Fixes: QTBUG-950 Change-Id: I9d6278f394269a183aee8156e990cec4d5198ab8 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>