mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00
Revert "Add a nodejs testing function for apply_layout"
This reverts commit beb5d63d1b
.
Oops, the more modern style *is* to use send_mouse_click.
This commit is contained in:
parent
beb5d63d1b
commit
794d3ec6ec
4 changed files with 2 additions and 36 deletions
|
@ -26,16 +26,6 @@ function load_native_lib() {
|
|||
*/
|
||||
let native = !process.env.SIXTYFPS_NODE_NATIVE_LIB ? require('../native/index.node') : load_native_lib();
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
interface Rect {
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
|
@ -65,10 +55,6 @@ class Component {
|
|||
send_keyboard_string_sequence(s: String) {
|
||||
this.comp.send_keyboard_string_sequence(s)
|
||||
}
|
||||
|
||||
apply_layout(rect: Rect) {
|
||||
this.comp.apply_layout(rect)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@ use core::cell::RefCell;
|
|||
use neon::prelude::*;
|
||||
use rand::RngCore;
|
||||
use sixtyfps_compilerlib::langtype::Type;
|
||||
use sixtyfps_corelib::{graphics::Rect, ImageReference, SharedVector};
|
||||
use sixtyfps_corelib::{ImageReference, SharedVector};
|
||||
|
||||
mod js_model;
|
||||
mod persistent_context;
|
||||
|
@ -478,22 +478,6 @@ declare_types! {
|
|||
})?;
|
||||
Ok(JsUndefined::new().as_value(&mut cx))
|
||||
}
|
||||
|
||||
method apply_layout(mut cx) {
|
||||
let rect = cx.argument::<JsObject>(0)?;
|
||||
let x = rect.get(&mut cx, "x")?.downcast::<JsNumber>().unwrap().value();
|
||||
let y = rect.get(&mut cx, "y")?.downcast::<JsNumber>().unwrap().value();
|
||||
let width = rect.get(&mut cx, "width")?.downcast::<JsNumber>().unwrap().value();
|
||||
let height = rect.get(&mut cx, "height")?.downcast::<JsNumber>().unwrap().value();
|
||||
let this = cx.this();
|
||||
let component = cx.borrow(&this, |x| x.0.as_ref().map(|c| c.clone_strong()));
|
||||
let component = component.ok_or(()).or_else(|()| cx.throw_error("Invalid type"))?;
|
||||
run_scoped(&mut cx,this.downcast().unwrap(), || {
|
||||
sixtyfps_interpreter::testing::apply_layout(&component, Rect::new((x as f32, y as f32).into(), (width as f32, height as f32).into()));
|
||||
Ok(())
|
||||
})?;
|
||||
Ok(JsUndefined::new().as_value(&mut cx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -868,10 +868,6 @@ pub mod testing {
|
|||
&comp.inner.window(),
|
||||
);
|
||||
}
|
||||
/// Applies the specified rectangular constraints to the component's layout.
|
||||
pub fn apply_layout(comp: &super::ComponentInstance, rect: sixtyfps_corelib::graphics::Rect) {
|
||||
comp.inner.borrow().as_ref().apply_layout(rect);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -44,7 +44,7 @@ assert!(instance.get_fake_image_ok());
|
|||
|
||||
```js
|
||||
var instance = new sixtyfps.TestCase();
|
||||
instance.apply_layout({x: 0, y: 0, width: 300, height: 300});
|
||||
instance.send_mouse_click(5., 5.);
|
||||
assert(instance.fake_image_ok);
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue