mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix(devtools-ios): Ensure UI modifications run on main thread
Modifications to the UI can only be made from the main thread. Since {N} 5.3.0 all debugger protocol messages are processed by the worker thread that receives them in iOS. refs #7219, https://github.com/NativeScript/ios-runtime/pull/1101
This commit is contained in:
@ -18,6 +18,38 @@ export function test_releaseNativeObject_canBeCalledWithNativeObject() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export function test_executeOnMainThread_Works(done: Function) {
|
||||
utils.executeOnMainThread(() => {
|
||||
try {
|
||||
TKUnit.assertTrue(utils.isMainThread());
|
||||
done();
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function test_mainThreadify_PassesArgs(done: Function) {
|
||||
const expectedN = 434;
|
||||
const expectedB = true;
|
||||
const expectedS = "string";
|
||||
const f = utils.mainThreadify(function (n: number, b: boolean, s: string) {
|
||||
try {
|
||||
TKUnit.assertTrue(utils.isMainThread());
|
||||
TKUnit.assertEqual(n, expectedN);
|
||||
TKUnit.assertEqual(b, expectedB);
|
||||
TKUnit.assertEqual(s, expectedS);
|
||||
done();
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
});
|
||||
|
||||
f(expectedN, expectedB, expectedS);
|
||||
}
|
||||
|
||||
|
||||
function test_releaseNativeObject_canBeCalledWithNativeObject_iOS() {
|
||||
let deallocated = false;
|
||||
const obj = new ((<any>NSObject).extend({
|
||||
|
Reference in New Issue
Block a user