napi test driver setup (#3635)

* Export interpreter stuff on private_api namespace

* Update api/napi/src/interpreter/value.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update tests/driver/napi/build.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update tests/driver/napi/Cargo.toml

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>


* Avoid unwanted prompt on Windows when running npm run build twice

Don't generate "napi.js" as then Windows will try to open it when running just "napi",
if nodejs registered .js as extension.

* Remove windows path workaround

It doesn't look like that it is needed.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
This commit is contained in:
Florian Blasius 2023-10-11 12:48:27 +02:00 committed by GitHub
parent aece085213
commit 2324b35d12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 602 additions and 274 deletions

View file

@ -45,12 +45,8 @@ class Component {
return new WindowAPI(this.comp.window());
}
send_mouse_click(x: number, y: number) {
this.comp.send_mouse_click(x, y)
}
send_keyboard_string_sequence(s: String) {
this.comp.send_keyboard_string_sequence(s)
get component(): any {
return this.comp;
}
}
@ -297,8 +293,20 @@ class ArrayModel<T> implements Model<T> {
}
}
function send_mouse_click(component: Component, x: number, y: number) {
component.component.send_mouse_click(x, y)
}
function send_keyboard_string_sequence(component: Component, s: String) {
component.component.send_keyboard_string_sequence(s)
}
module.exports = {
private_api: native,
private_api: {
mock_elapsed_time: native.mock_elapsed_time,
send_mouse_click: send_mouse_click,
send_keyboard_string_sequence: send_keyboard_string_sequence,
},
ArrayModel: ArrayModel,
Timer: {
singleShot: native.singleshot_timer,

View file

@ -26,7 +26,7 @@ slint-interpreter = { workspace = true, features = ["default", "display-diagnost
vtable = { version = "0.1.6", path="../../../helper_crates/vtable" }
css-color-parser2 = "1.0.1"
css-color-parser2 = { workspace = true }
generativity = "1"
neon = "0.8.0"
once_cell = "1.5"