summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-08 19:56:03 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-10 10:04:09 +0200
commitee53825bde734e410b3677e0346fd690156adfb0 (patch)
tree08aeacdebabd6337ce70d6d81a13177d95d46d4b /tests/auto
parentab666fae82f3c41fdc56220fea6b8bf8b389be9f (diff)
Port from container::count() and length() to size() - V4
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I99056808ec21efab3ae122a764e7b00289ed71d0 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp b/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp
index c013f979..21040df3 100644
--- a/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp
+++ b/tests/auto/cpptest/q3dcustom-volume/tst_custom.cpp
@@ -70,7 +70,7 @@ void tst_custom::construct()
QCOMPARE(custom->sliceIndexY(), -1);
QCOMPARE(custom->sliceIndexZ(), -1);
QCOMPARE(custom->useHighDefShader(), true);
- QCOMPARE(custom->textureData()->length(), 1000);
+ QCOMPARE(custom->textureData()->size(), 1000);
QCOMPARE(custom->textureDataWidth(), 40);
QCOMPARE(custom->textureFormat(), QImage::Format_ARGB32);
QCOMPARE(custom->textureHeight(), 10);