aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/nodes
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/nodes')
-rw-r--r--tests/auto/quick/nodes/tst_nodestest.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp
index b49ce34951..c49f01d5a7 100644
--- a/tests/auto/quick/nodes/tst_nodestest.cpp
+++ b/tests/auto/quick/nodes/tst_nodestest.cpp
@@ -283,7 +283,7 @@ void NodesTest::textureNodeTextureOwnership()
QVERIFY(!texture.isNull());
}
- { // Check that it is deleted when we so desire
+ { // Check that it is deleted on destruction when we so desire
QPointer<QSGTexture> texture(new QSGPlainTexture());
QSGSimpleTextureNode *tn = new QSGSimpleTextureNode();
@@ -294,6 +294,25 @@ void NodesTest::textureNodeTextureOwnership()
delete tn;
QVERIFY(texture.isNull());
}
+
+ { // Check that it is deleted on update when we so desire
+ QPointer<QSGTexture> oldTexture(new QSGPlainTexture());
+ QPointer<QSGTexture> newTexture(new QSGPlainTexture());
+
+ QSGSimpleTextureNode *tn = new QSGSimpleTextureNode();
+ tn->setOwnsTexture(true);
+ QVERIFY(tn->ownsTexture());
+
+ tn->setTexture(oldTexture);
+ QVERIFY(!oldTexture.isNull());
+ QVERIFY(!newTexture.isNull());
+
+ tn->setTexture(newTexture);
+ QVERIFY(oldTexture.isNull());
+ QVERIFY(!newTexture.isNull());
+
+ delete tn;
+ }
}
void NodesTest::textureNodeRect()