aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml')
-rw-r--r--tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml
new file mode 100644
index 0000000000..5ae1bcecf5
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/signalParameterTypes.2.qml
@@ -0,0 +1,48 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+
+ property bool success: false
+ property bool gotInvalid: false
+ property bool expectNull: false
+ property SignalEmitter e: SignalEmitter { testObject: root; handleSignal: false } // false so it doesn't use bound handler.
+
+ function determineSuccess(param) {
+ if (root.expectNull == true) {
+ if (param != null) {
+ // the parameter shouldn't have been passed through, but was.
+ root.success = false;
+ root.gotInvalid = true;
+ } else {
+ root.success = true;
+ root.gotInvalid = false;
+ }
+ return;
+ } else if (param == null) {
+ // the parameter should have been passed through, but wasn't.
+ root.success = false;
+ return;
+ }
+
+ if (param.testProperty == 42) {
+ // got the expected value. if we didn't previously
+ // get an unexpected value, set success to true.
+ root.success = (!root.gotInvalid);
+ } else {
+ // the value passed through was not what we expected.
+ root.gotInvalid = true;
+ root.success = false;
+ }
+ }
+
+ function handleTestSignal(spp) {
+ root.determineSuccess(spp);
+ }
+
+ Component.onCompleted: {
+ success = false;
+ e.testSignal.connect(handleTestSignal)
+ e.emitTestSignal();
+ }
+}