aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testrefcounttag.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testrefcounttag.cpp')
-rw-r--r--tests/testrefcounttag.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/testrefcounttag.cpp b/tests/testrefcounttag.cpp
index 5d3a45c77..6f6f87367 100644
--- a/tests/testrefcounttag.cpp
+++ b/tests/testrefcounttag.cpp
@@ -53,6 +53,41 @@ void TestRefCountTag::testReferenceCountTag()
QCOMPARE(refCount.action, ReferenceCount::Add);
}
+void TestRefCountTag::testWithApiVersion()
+{
+ const char* cppCode ="\
+ struct A {};\
+ struct B {\
+ void keepObject(B*, B*);\
+ };\
+ ";
+ const char* xmlCode = "\
+ <typesystem package=\"Foo\"> \
+ <object-type name='A' /> \
+ <object-type name='B'> \
+ <modify-function signature='keepObject(B*, B*)'>\
+ <modify-argument index='1' since='0.1'>\
+ <reference-count action='add' /> \
+ </modify-argument>\
+ <modify-argument index='2' since='0.2'>\
+ <reference-count action='add' /> \
+ </modify-argument>\
+ </modify-function>\
+ </object-type>\
+ </typesystem>";
+
+ TestUtil t(cppCode, xmlCode, false, 0.1);
+ AbstractMetaClassList classes = t.builder()->classes();
+ AbstractMetaClass* classB = classes.findClass("B");
+ const AbstractMetaFunction* func = classB->findFunction("keepObject");
+
+ ReferenceCount refCount = func->modifications().first().argument_mods.first().referenceCounts.first();
+ QCOMPARE(refCount.action, ReferenceCount::Add);
+
+ QCOMPARE(func->modifications().size(), 1);
+}
+
+
QTEST_APPLESS_MAIN(TestRefCountTag)
#include "testrefcounttag.moc"