Rename new QTZ::aliasMatches to hasAlternativeName
Raised in 6.8 API change review. The use of "matches" in a name suggests pattern-matching, which isn't what happens here. Task-number: QTBUG-125859 Change-Id: I8aa05b117807b9d1b9b737cd63d44fb4a30f6fa5 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6b36e5de7656e1d9e23364c596cc82f8068d4452) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
ac74885507
commit
690cc978ea
@ -843,7 +843,7 @@ QByteArray QTimeZone::id() const
|
|||||||
|
|
||||||
This method is only available when feature \c timezone is enabled.
|
This method is only available when feature \c timezone is enabled.
|
||||||
*/
|
*/
|
||||||
bool QTimeZone::aliasMatches(QByteArrayView alias) const
|
bool QTimeZone::hasAlternativeName(QByteArrayView alias) const
|
||||||
{
|
{
|
||||||
if (alias == id())
|
if (alias == id())
|
||||||
return true;
|
return true;
|
||||||
|
@ -166,7 +166,7 @@ public:
|
|||||||
};
|
};
|
||||||
typedef QList<OffsetData> OffsetDataList;
|
typedef QList<OffsetData> OffsetDataList;
|
||||||
|
|
||||||
bool aliasMatches(QByteArrayView alias) const;
|
bool hasAlternativeName(QByteArrayView alias) const;
|
||||||
QByteArray id() const;
|
QByteArray id() const;
|
||||||
QLocale::Territory territory() const;
|
QLocale::Territory territory() const;
|
||||||
# if QT_DEPRECATED_SINCE(6, 6)
|
# if QT_DEPRECATED_SINCE(6, 6)
|
||||||
|
@ -41,8 +41,8 @@ private Q_SLOTS:
|
|||||||
void availableTimeZoneIds();
|
void availableTimeZoneIds();
|
||||||
void utcOffsetId_data();
|
void utcOffsetId_data();
|
||||||
void utcOffsetId();
|
void utcOffsetId();
|
||||||
void aliasMatches_data();
|
void hasAlternativeName_data();
|
||||||
void aliasMatches();
|
void hasAlternativeName();
|
||||||
void specificTransition_data();
|
void specificTransition_data();
|
||||||
void specificTransition();
|
void specificTransition();
|
||||||
void transitionEachZone_data();
|
void transitionEachZone_data();
|
||||||
@ -565,7 +565,7 @@ void tst_QTimeZone::isTimeZoneIdAvailable()
|
|||||||
QVERIFY2(QTimeZone::isTimeZoneIdAvailable(id), id);
|
QVERIFY2(QTimeZone::isTimeZoneIdAvailable(id), id);
|
||||||
const QTimeZone zone(id);
|
const QTimeZone zone(id);
|
||||||
QVERIFY2(zone.isValid(), id);
|
QVERIFY2(zone.isValid(), id);
|
||||||
QVERIFY2(zone.aliasMatches(id), zone.id() + " != " + id);
|
QVERIFY2(zone.hasAlternativeName(id), zone.id() + " != " + id);
|
||||||
}
|
}
|
||||||
// availableTimeZoneIds() doesn't list all possible offset IDs, but
|
// availableTimeZoneIds() doesn't list all possible offset IDs, but
|
||||||
// isTimeZoneIdAvailable() should accept them.
|
// isTimeZoneIdAvailable() should accept them.
|
||||||
@ -708,7 +708,7 @@ void tst_QTimeZone::utcOffsetId()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QTimeZone::aliasMatches_data()
|
void tst_QTimeZone::hasAlternativeName_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QByteArray>("iana");
|
QTest::addColumn<QByteArray>("iana");
|
||||||
QTest::addColumn<QByteArray>("alias");
|
QTest::addColumn<QByteArray>("alias");
|
||||||
@ -735,7 +735,7 @@ void tst_QTimeZone::aliasMatches_data()
|
|||||||
QTest::newRow("Enderbury=Enderbury") << "Pacific/Enderbury"_ba << "Pacific/Enderbury"_ba;
|
QTest::newRow("Enderbury=Enderbury") << "Pacific/Enderbury"_ba << "Pacific/Enderbury"_ba;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QTimeZone::aliasMatches()
|
void tst_QTimeZone::hasAlternativeName()
|
||||||
{
|
{
|
||||||
QFETCH(const QByteArray, iana);
|
QFETCH(const QByteArray, iana);
|
||||||
QFETCH(const QByteArray, alias);
|
QFETCH(const QByteArray, alias);
|
||||||
@ -749,14 +749,14 @@ void tst_QTimeZone::aliasMatches()
|
|||||||
qDebug("Using %s and %s", zid.constData(), pid.constData());
|
qDebug("Using %s and %s", zid.constData(), pid.constData());
|
||||||
});
|
});
|
||||||
QVERIFY2(peer.isValid(), "Construction should have fallen back on IANA ID");
|
QVERIFY2(peer.isValid(), "Construction should have fallen back on IANA ID");
|
||||||
QVERIFY(zone.aliasMatches(zone.id()));
|
QVERIFY(zone.hasAlternativeName(zone.id()));
|
||||||
QVERIFY(zone.aliasMatches(iana));
|
QVERIFY(zone.hasAlternativeName(iana));
|
||||||
QVERIFY(peer.aliasMatches(peer.id()));
|
QVERIFY(peer.hasAlternativeName(peer.id()));
|
||||||
QVERIFY(peer.aliasMatches(alias));
|
QVERIFY(peer.hasAlternativeName(alias));
|
||||||
QVERIFY(zone.aliasMatches(peer.id()));
|
QVERIFY(zone.hasAlternativeName(peer.id()));
|
||||||
QVERIFY(zone.aliasMatches(alias));
|
QVERIFY(zone.hasAlternativeName(alias));
|
||||||
QVERIFY(peer.aliasMatches(zone.id()));
|
QVERIFY(peer.hasAlternativeName(zone.id()));
|
||||||
QVERIFY(peer.aliasMatches(iana));
|
QVERIFY(peer.hasAlternativeName(iana));
|
||||||
report.dismiss();
|
report.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -984,7 +984,7 @@ void tst_QTimeZone::stressTest()
|
|||||||
for (const QByteArray &id : idList) {
|
for (const QByteArray &id : idList) {
|
||||||
QTimeZone testZone = QTimeZone(id);
|
QTimeZone testZone = QTimeZone(id);
|
||||||
QCOMPARE(testZone.isValid(), true);
|
QCOMPARE(testZone.isValid(), true);
|
||||||
QVERIFY2(testZone.aliasMatches(id), testZone.id() + " != " + id);
|
QVERIFY2(testZone.hasAlternativeName(id), testZone.id() + " != " + id);
|
||||||
QDateTime testDate = QDateTime(QDate(2015, 1, 1), QTime(0, 0), UTC);
|
QDateTime testDate = QDateTime(QDate(2015, 1, 1), QTime(0, 0), UTC);
|
||||||
testZone.territory();
|
testZone.territory();
|
||||||
testZone.comment();
|
testZone.comment();
|
||||||
@ -1920,7 +1920,7 @@ void tst_QTimeZone::stdCompatibility()
|
|||||||
QByteArrayView zoneName = QByteArrayView(timeZone->name());
|
QByteArrayView zoneName = QByteArrayView(timeZone->name());
|
||||||
QTimeZone tz = QTimeZone::fromStdTimeZonePtr(timeZone);
|
QTimeZone tz = QTimeZone::fromStdTimeZonePtr(timeZone);
|
||||||
if (tz.isValid())
|
if (tz.isValid())
|
||||||
QVERIFY2(tz.aliasMatches(zoneName), tz.id().constData());
|
QVERIFY2(tz.hasAlternativeName(zoneName), tz.id().constData());
|
||||||
else
|
else
|
||||||
QVERIFY(!QTimeZone::isTimeZoneIdAvailable(zoneName.toByteArray()));
|
QVERIFY(!QTimeZone::isTimeZoneIdAvailable(zoneName.toByteArray()));
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user