More consistent handling of feature timezone

Follow-up to commit ae6186c7e8cfdb9420b9119f5affbba7d069598d
* require the feature in headers that should only be seen when it's
  enabled,
* expose the auto-test to being run even when the feature is disabled
  (the parts of that depend on the feature have needed #if-ery) and
* fix the Darwin-specific test's misguided #if-ery.

Pick-to: 6.5
Task-number: QTBUG-108199
Change-Id: I398cf44c33ffdcb4bb04f54a9d8ccfef68741e4e
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 98581c54fe729f8d30341ebbc0576ad5430df268)
This commit is contained in:
Edward Welbourne 2024-04-09 14:33:03 +02:00
parent e08da35502
commit ed98ffb75c
4 changed files with 5 additions and 5 deletions

View File

@ -20,6 +20,7 @@
#include "qbytearrayview.h"
#include "qstring.h"
QT_REQUIRE_CONFIG(timezone);
QT_BEGIN_NAMESPACE
/*

View File

@ -38,6 +38,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(NSTimeZone);
#include <QJniObject>
#endif
QT_REQUIRE_CONFIG(timezone);
QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QTimeZonePrivate : public QSharedData

View File

@ -6,6 +6,4 @@ add_subdirectory(qdate)
add_subdirectory(qdatetime)
add_subdirectory(qdatetimeparser)
add_subdirectory(qtime)
if(QT_FEATURE_timezone)
add_subdirectory(qtimezone)
endif()
add_subdirectory(qtimezone)

View File

@ -9,7 +9,7 @@
void tst_QTimeZone_darwinTypes()
{
#if !defined(QT_NO_SYSTEMLOCALE)
#if QT_CONFIG(timezone)
// QTimeZone <-> CFTimeZone
{
QTimeZone qtTimeZone("America/Los_Angeles");
@ -39,5 +39,5 @@ void tst_QTimeZone_darwinTypes()
QVERIFY([qtTimeZone.toNSTimeZone() isEqual:nsTimeZone]);
[autoreleasepool release];
}
#endif
#endif // feature timezone
}