mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-07 01:35:25 +08:00
qt 6.6.0 clean
This commit is contained in:
@ -77,6 +77,28 @@ void checkItWorksWithFreeSpaceAtBegin(const String &chunk, const Separator &sepa
|
||||
QCOMPARE(str, expected);
|
||||
}
|
||||
|
||||
template <typename String>
|
||||
void checkNullVsEmpty(const String &empty, const char *failureReason = nullptr)
|
||||
{
|
||||
String a;
|
||||
String b;
|
||||
QVERIFY(a.isNull());
|
||||
QVERIFY(b.isNull());
|
||||
String result = a P b;
|
||||
QVERIFY(result.isNull());
|
||||
|
||||
String d = empty;
|
||||
QVERIFY(d.isEmpty());
|
||||
QVERIFY(!d.isNull());
|
||||
result = a P d;
|
||||
QVERIFY(result.isEmpty());
|
||||
if (failureReason)
|
||||
QEXPECT_FAIL("", failureReason, Continue);
|
||||
QVERIFY(!result.isNull());
|
||||
|
||||
result = a P a P a;
|
||||
QVERIFY(!result.isNull());
|
||||
}
|
||||
|
||||
void runScenario()
|
||||
{
|
||||
@ -357,6 +379,10 @@ void runScenario()
|
||||
QCOMPARE(ba2, QByteArray(withZero + withZero + withZero));
|
||||
}
|
||||
|
||||
// null vs. empty
|
||||
checkNullVsEmpty(QStringLiteral(""));
|
||||
checkNullVsEmpty(QByteArrayLiteral(""), "QTBUG-114238: inconsistent isEmpty/isNull between QString and QByteArray concatenation");
|
||||
|
||||
checkItWorksWithFreeSpaceAtBegin(QByteArray(UTF8_LITERAL), "1234");
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
|
@ -17,7 +17,11 @@
|
||||
|
||||
#define LITERAL "some literal"
|
||||
|
||||
void runScenario(); // Defined in stringbuilder.cpp #included below.
|
||||
namespace {
|
||||
#define P %
|
||||
#include "stringbuilder.cpp"
|
||||
#undef P
|
||||
} // namespace
|
||||
|
||||
class tst_QStringBuilder1 : public QObject
|
||||
{
|
||||
@ -27,10 +31,6 @@ private slots:
|
||||
void scenario() { runScenario(); }
|
||||
};
|
||||
|
||||
#define P %
|
||||
#include "stringbuilder.cpp"
|
||||
#undef P
|
||||
|
||||
#include "tst_qstringbuilder1.moc"
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QStringBuilder1)
|
||||
|
Reference in New Issue
Block a user