Move to separate headers

Hopefully this can speed up compilation times.
https://doc.qt.io/qt-6/qtglobal.html#details

PR #19430.
This commit is contained in:
Chocobo1 2023-08-11 13:47:55 +08:00 committed by GitHub
commit 31fe327763
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 71 additions and 51 deletions

View file

@ -26,7 +26,10 @@
* exception statement from your version.
*/
#include <QtGlobal>
#include <type_traits>
#include <QList>
#include <QObject>
#include <QTest>
#include "base/global.h"
@ -40,13 +43,27 @@ public:
TestGlobal() = default;
private slots:
#if (QT_VERSION < QT_VERSION_CHECK(6, 4, 0))
void testStringLiteral() const
void testAsConst() const
{
QCOMPARE(u""_s, QStringLiteral(""));
QCOMPARE(u"abc"_s, QStringLiteral("abc"));
{
QList<int> list = {0, 1, 2};
static_assert(std::is_const_v<std::remove_reference_t<decltype(asConst(list))>>);
QCOMPARE(list, asConst(list));
QCOMPARE(list, asConst(QList<int>(list)));
}
{
const QList<int> list = {0, 1, 2};
static_assert(std::is_const_v<std::remove_reference_t<decltype(asConst(list))>>);
QCOMPARE(list, asConst(list));
QCOMPARE(list, asConst(QList<int>(list)));
// should not compile:
//asConst(std::move(list));
}
}
#endif
};
QTEST_APPLESS_MAIN(TestGlobal)