tests: make smoke-tests Qt6-safe (use QStringLiteral/QLatin1)
This commit is contained in:
1 parent
3988248897
commit
8ea74a81ad
3 files changed
+10
-10
No files matched your search
@@ -9,8 +9,8 @@ private slots:
|
||||
QVERIFY(QCoreApplication::instance() == nullptr || true); // harmless check
|
||||
}
|
||||
void test_qstring_format() {
|
||||
QString fmt = QStringLiteral("%1-%2").arg(42).arg("abc");
|
||||
QCOMPARE(fmt, QString("42-abc"));
|
||||
QString fmt = QStringLiteral("%1-%2").arg(42).arg(QStringLiteral("abc"));
|
||||
QCOMPARE(fmt, QStringLiteral("42-abc"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@ class FunctionTopicSmokeTest : public QObject {
|
||||
private slots:
|
||||
void test_containers() {
|
||||
QStringList list;
|
||||
list << "a" << "b" << "c";
|
||||
list << QStringLiteral("a") << QStringLiteral("b") << QStringLiteral("c");
|
||||
QCOMPARE(list.size(), 3);
|
||||
QVERIFY(list.contains("b"));
|
||||
QVERIFY(list.contains(QStringLiteral("b")));
|
||||
}
|
||||
void test_qmap_basic() {
|
||||
QMap<QString,int> m;
|
||||
m["one"] = 1;
|
||||
m["two"] = 2;
|
||||
QCOMPARE(m.value("two"), 2);
|
||||
m[QStringLiteral("one")] = 1;
|
||||
m[QStringLiteral("two")] = 2;
|
||||
QCOMPARE(m.value(QStringLiteral("two")), 2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ class GenericSmokeTest : public QObject {
|
||||
private slots:
|
||||
void test_string_ops() {
|
||||
QString s = QString::fromUtf8("mIxEd");
|
||||
QCOMPARE(s.toLower(), QString("mixed"));
|
||||
QCOMPARE(s.toLower(), QStringLiteral("mixed"));
|
||||
}
|
||||
void test_basic_qvariant() {
|
||||
QVariant v = QString("value");
|
||||
QVariant v = QStringLiteral("value");
|
||||
QVERIFY(v.canConvert<QString>());
|
||||
QCOMPARE(v.toString(), QString("value"));
|
||||
QCOMPARE(v.toString(), QStringLiteral("value"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user