-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thanks to Osmo Salomaa for the original report and test case.
- Loading branch information
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Test if JS errors from pyotherside.send() are propagated to the PyOtherSide | ||
error handler. Thanks to Osmo Salomaa for the original report and test case. | ||
|
||
---- | ||
https://github.com/thp/pyotherside/issues/9 | ||
https://gist.github.com/otsaloma/8258322 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import pyotherside | ||
import threading | ||
import time | ||
|
||
def run(): | ||
while True: | ||
pyotherside.send("test-errors") | ||
time.sleep(3) | ||
|
||
thread = threading.Thread(target=run) | ||
thread.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
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"); | ||
} | ||
} |