qmltc: Unskip important tests
They were QSKIP-ed before due to issues with importing and own module qmltypes handling. At this point this should all be fixed with proper QML modules so no reason to leave them as skipped In the process of doing this, also figure that attached property code generation is borked and fix accordingly: the compiler used an attached type where an attaching type should've been used. Given the obvious naming ambiguity, this was likely a typo of sorts Also as a drive by, actually write a test for private properties which were before only covered through QQuick-based tests on anchors and such Pick-to: 6.3 Change-Id: I1e4fd4d916ad3bd1bacf2aee1ce2346f9283c70d Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
690b7cb6a2
commit
a099030009
|
@ -82,6 +82,8 @@
|
|||
#include "calqlatrbits.h"
|
||||
#include "propertychangeandsignalhandlers.h"
|
||||
|
||||
#include "testprivateproperty.h"
|
||||
|
||||
// Qt:
|
||||
#include <QtCore/qstring.h>
|
||||
#include <QtCore/qbytearray.h>
|
||||
|
@ -94,6 +96,7 @@
|
|||
|
||||
#include <QtTest/qsignalspy.h>
|
||||
|
||||
#include <QtCore/private/qobject_p.h>
|
||||
#include <QtTest/private/qemulationdetector_p.h>
|
||||
|
||||
#ifndef QMLTC_TESTS_DISABLE_CACHE
|
||||
|
@ -1102,11 +1105,9 @@ void tst_qmltc::defaultAlias()
|
|||
QSKIP("Not implemented - not supported");
|
||||
}
|
||||
|
||||
// TODO: this just doesn't work currently
|
||||
void tst_qmltc::attachedProperty()
|
||||
{
|
||||
QQmlEngine e;
|
||||
QSKIP("Broken in many ways.");
|
||||
PREPEND_NAMESPACE(attachedProperty) created(&e);
|
||||
|
||||
TestTypeAttached *attached = qobject_cast<TestTypeAttached *>(
|
||||
|
@ -1145,8 +1146,6 @@ void tst_qmltc::attachedProperty()
|
|||
void tst_qmltc::groupedProperty()
|
||||
{
|
||||
QQmlEngine e;
|
||||
QSKIP("Property index is wrong due to not picking QtQml dependency when creating group "
|
||||
"property scope");
|
||||
PREPEND_NAMESPACE(groupedProperty) created(&e);
|
||||
|
||||
TestTypeGrouped *grouped = created.getGroup();
|
||||
|
@ -1708,9 +1707,22 @@ void tst_qmltc::keyEvents()
|
|||
|
||||
void tst_qmltc::privateProperties()
|
||||
{
|
||||
QSKIP("The same problem with poor QObject qmltypes is encountered here.");
|
||||
QQmlEngine e;
|
||||
PREPEND_NAMESPACE(privatePropertySubclass) created(&e);
|
||||
QCOMPARE(created.dummy(), u"bar"_qs);
|
||||
QCOMPARE(created.strAlias(), u"foobar"_qs);
|
||||
QCOMPARE(created.smthAlias(), 42);
|
||||
|
||||
auto privateCreated = static_cast<PrivatePropertyTypePrivate *>(QObjectPrivate::get(&created));
|
||||
QVERIFY(privateCreated);
|
||||
QCOMPARE(privateCreated->foo(), u"Smth is: 42"_qs);
|
||||
|
||||
ValueTypeGroup vt = privateCreated->vt();
|
||||
QCOMPARE(vt.count(), 11);
|
||||
|
||||
TestTypeGrouped *group = privateCreated->getGroup();
|
||||
QCOMPARE(group->getCount(), 43);
|
||||
QCOMPARE(group->getStr(), created.strAlias());
|
||||
}
|
||||
|
||||
void tst_qmltc::calqlatrBits()
|
||||
|
|
|
@ -1389,6 +1389,9 @@ void CodeGenerator::compileBinding(QQmlJSAotObject ¤t, const QmlIR::Bindin
|
|||
std::for_each(irObject->bindingsBegin(), irObject->bindingsEnd(), compileComponent);
|
||||
} else {
|
||||
const QString attachingTypeName = propertyName; // acts as an identifier
|
||||
auto attachingType = m_localTypeResolver->typeForName(attachingTypeName);
|
||||
Q_ASSERT(attachingType); // an error somewhere else
|
||||
|
||||
QString attachedTypeName = type->attachedTypeName(); // TODO: check if == internalName?
|
||||
if (attachedTypeName.isEmpty()) // TODO: shouldn't happen ideally
|
||||
attachedTypeName = type->baseTypeName();
|
||||
|
@ -1401,7 +1404,7 @@ void CodeGenerator::compileBinding(QQmlJSAotObject ¤t, const QmlIR::Bindin
|
|||
u"nullptr"_qs);
|
||||
// Note: getting attached property is fairly expensive
|
||||
const QString getAttachedPropertyLine = u"qobject_cast<" + attachedTypeName
|
||||
+ u" *>(qmlAttachedPropertiesObject<" + attachedTypeName
|
||||
+ u" *>(qmlAttachedPropertiesObject<" + attachingType->internalName()
|
||||
+ u">(this, /* create = */ true))";
|
||||
current.endInit.body
|
||||
<< attachedMemberName + u" = " + getAttachedPropertyLine + u";";
|
||||
|
|
Loading…
Reference in New Issue