1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-02-05 08:08:23 +08:00
pyotherside/tests/test_errors/test_errors.qml
Thomas Perl 53273dad50 Check JS callback errors. Fixes #9
Thanks to Osmo Salomaa for the original report and test case.
2014-01-20 19:09:57 +01:00

41 lines
860 B
QML

import QtQuick 2.0
import io.thp.pyotherside 1.0
Rectangle {
id: page
width: 300
height: 300
Component.onCompleted: {
py.addImportPath(Qt.resolvedUrl('.').substr('file://'.length));
py.setHandler("test-errors", page.testErrors);
py.importModule("test_errors", null);
}
Python {
id: py
onError: {
console.log("PYTHON ERROR: " + traceback);
msg.text += '\n' + traceback;
}
}
Text {
id: msg
anchors {
top: parent.top
left: parent.left
right: parent.right
}
text: "Testing (you should see errors appearing here)..."
wrapMode: Text.Wrap
}
function testErrors() {
console.log("starting");
page.nonexistentMethod();
console.log("finished");
}
}