mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 22:31:14 +00:00
Remove the solve_layout from the component vtable
no longer required
This commit is contained in:
parent
f6b71b36a7
commit
720001a223
27 changed files with 5 additions and 103 deletions
|
@ -587,15 +587,6 @@ public:
|
||||||
return { &C::static_vtable, const_cast<C *>(&(**x.ptr)) };
|
return { &C::static_vtable, const_cast<C *>(&(**x.ptr)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
void compute_layout(cbindgen_private::Rect parent_rect) const
|
|
||||||
{
|
|
||||||
if (!inner)
|
|
||||||
return;
|
|
||||||
for (auto &x : inner->data) {
|
|
||||||
(*x.ptr)->apply_layout({ &C::static_vtable, const_cast<C *>(&(**x.ptr)) }, parent_rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float compute_layout_listview(const Property<float> *viewport_width, float listview_width) const
|
float compute_layout_listview(const Property<float> *viewport_width, float listview_width) const
|
||||||
{
|
{
|
||||||
float offset = 0;
|
float offset = 0;
|
||||||
|
|
|
@ -372,18 +372,6 @@ pub mod testing {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Applies the specified rectangular constraints to the component's layout.
|
|
||||||
pub fn apply_layout<
|
|
||||||
X: vtable::HasStaticVTable<sixtyfps_corelib::component::ComponentVTable>,
|
|
||||||
Component: Into<vtable::VRc<sixtyfps_corelib::component::ComponentVTable, X>> + ComponentHandle,
|
|
||||||
>(
|
|
||||||
component: &Component,
|
|
||||||
rect: sixtyfps_corelib::graphics::Rect,
|
|
||||||
) {
|
|
||||||
let rc = component.clone_strong().into();
|
|
||||||
vtable::VRc::borrow_pin(&rc).as_ref().apply_layout(rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Applies the specified scale factor to the window that's associated with the given component.
|
/// Applies the specified scale factor to the window that's associated with the given component.
|
||||||
/// This overrides the value provided by the windowing system.
|
/// This overrides the value provided by the windowing system.
|
||||||
pub fn set_window_scale_factor<
|
pub fn set_window_scale_factor<
|
||||||
|
|
|
@ -11,7 +11,6 @@ LICENSE END */
|
||||||
|
|
||||||
//! This module contains the basic datastructures that are exposed to the C API
|
//! This module contains the basic datastructures that are exposed to the C API
|
||||||
|
|
||||||
use crate::graphics::Rect;
|
|
||||||
use crate::item_tree::{ItemVisitorVTable, TraversalOrder, VisitChildrenResult};
|
use crate::item_tree::{ItemVisitorVTable, TraversalOrder, VisitChildrenResult};
|
||||||
use crate::items::{ItemVTable, ItemWeak};
|
use crate::items::{ItemVTable, ItemWeak};
|
||||||
use crate::layout::LayoutInfo;
|
use crate::layout::LayoutInfo;
|
||||||
|
@ -47,9 +46,6 @@ pub struct ComponentVTable {
|
||||||
/// Returns the layout info for this component
|
/// Returns the layout info for this component
|
||||||
pub layout_info: extern "C" fn(core::pin::Pin<VRef<ComponentVTable>>) -> LayoutInfo,
|
pub layout_info: extern "C" fn(core::pin::Pin<VRef<ComponentVTable>>) -> LayoutInfo,
|
||||||
|
|
||||||
/// Apply the layout to all the items in the component, and set the geometry of the root to the given rect
|
|
||||||
pub apply_layout: extern "C" fn(core::pin::Pin<VRef<ComponentVTable>>, Rect),
|
|
||||||
|
|
||||||
/// in-place destructor (for VRc)
|
/// in-place destructor (for VRc)
|
||||||
pub drop_in_place: unsafe fn(VRefMut<ComponentVTable>) -> vtable::Layout,
|
pub drop_in_place: unsafe fn(VRefMut<ComponentVTable>) -> vtable::Layout,
|
||||||
/// dealloc function (for VRc)
|
/// dealloc function (for VRc)
|
||||||
|
|
|
@ -503,7 +503,6 @@ impl<C: RepeatedComponent + 'static> Repeater<C> {
|
||||||
};
|
};
|
||||||
for c in self.inner.borrow().borrow().components.iter() {
|
for c in self.inner.borrow().borrow().components.iter() {
|
||||||
c.1.as_ref().map(|x| {
|
c.1.as_ref().map(|x| {
|
||||||
x.as_pin_ref().apply_layout(Default::default());
|
|
||||||
get_height_visitor(x.as_pin_ref().get_item_ref(0));
|
get_height_visitor(x.as_pin_ref().get_item_ref(0));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -522,7 +521,6 @@ impl<C: RepeatedComponent + 'static> Repeater<C> {
|
||||||
self.ensure_updated_impl(&init, &model, 1);
|
self.ensure_updated_impl(&init, &model, 1);
|
||||||
if let Some(c) = self.inner.borrow().borrow().components.get(0) {
|
if let Some(c) = self.inner.borrow().borrow().components.get(0) {
|
||||||
c.1.as_ref().map(|x| {
|
c.1.as_ref().map(|x| {
|
||||||
x.as_pin_ref().apply_layout(Default::default());
|
|
||||||
get_height_visitor(x.as_pin_ref().get_item_ref(0));
|
get_height_visitor(x.as_pin_ref().get_item_ref(0));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -632,13 +630,6 @@ impl<C: RepeatedComponent> Repeater<C> {
|
||||||
self.inner.borrow().borrow().components.iter().flat_map(|x| x.1.clone()).collect()
|
self.inner.borrow().borrow().components.iter().flat_map(|x| x.1.clone()).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recompute the layout of each child elements
|
|
||||||
pub fn compute_layout(&self) {
|
|
||||||
for c in self.inner.borrow().borrow().components.iter() {
|
|
||||||
c.1.as_ref().map(|x| x.as_pin_ref().apply_layout(Default::default()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Same as compule_layout, but only for the ListView
|
/// Same as compule_layout, but only for the ListView
|
||||||
pub fn compute_layout_listview(
|
pub fn compute_layout_listview(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
@ -37,8 +37,6 @@ pub extern "C" fn sixtyfps_send_mouse_click(
|
||||||
window: &ComponentWindow,
|
window: &ComponentWindow,
|
||||||
) {
|
) {
|
||||||
let mut state = crate::input::MouseInputState::default();
|
let mut state = crate::input::MouseInputState::default();
|
||||||
vtable::VRc::borrow_pin(component).as_ref().apply_layout(Default::default());
|
|
||||||
|
|
||||||
let pos = euclid::point2(x, y);
|
let pos = euclid::point2(x, y);
|
||||||
|
|
||||||
state = crate::input::process_mouse_input(
|
state = crate::input::process_mouse_input(
|
||||||
|
|
|
@ -19,7 +19,7 @@ use sixtyfps_compilerlib::*;
|
||||||
use sixtyfps_compilerlib::{diagnostics::BuildDiagnostics, object_tree::PropertyDeclaration};
|
use sixtyfps_compilerlib::{diagnostics::BuildDiagnostics, object_tree::PropertyDeclaration};
|
||||||
use sixtyfps_compilerlib::{expression_tree::Expression, langtype::PropertyLookupResult};
|
use sixtyfps_compilerlib::{expression_tree::Expression, langtype::PropertyLookupResult};
|
||||||
use sixtyfps_corelib::component::{Component, ComponentRef, ComponentRefPin, ComponentVTable};
|
use sixtyfps_corelib::component::{Component, ComponentRef, ComponentRefPin, ComponentVTable};
|
||||||
use sixtyfps_corelib::graphics::{ImageReference, Rect};
|
use sixtyfps_corelib::graphics::ImageReference;
|
||||||
use sixtyfps_corelib::item_tree::{
|
use sixtyfps_corelib::item_tree::{
|
||||||
ItemTreeNode, ItemVisitorRefMut, ItemVisitorVTable, TraversalOrder, VisitChildrenResult,
|
ItemTreeNode, ItemVisitorRefMut, ItemVisitorVTable, TraversalOrder, VisitChildrenResult,
|
||||||
};
|
};
|
||||||
|
@ -139,7 +139,6 @@ impl RepeatedComponent for ErasedComponentBox {
|
||||||
generativity::make_guard!(guard);
|
generativity::make_guard!(guard);
|
||||||
let s = self.unerase(guard);
|
let s = self.unerase(guard);
|
||||||
|
|
||||||
self.borrow().as_ref().apply_layout(Default::default());
|
|
||||||
s.component_type
|
s.component_type
|
||||||
.set_property(s.borrow(), "y", Value::Number(*offset_y as f64))
|
.set_property(s.borrow(), "y", Value::Number(*offset_y as f64))
|
||||||
.expect("cannot set y");
|
.expect("cannot set y");
|
||||||
|
@ -180,9 +179,6 @@ impl Component for ErasedComponentBox {
|
||||||
fn layout_info(self: Pin<&Self>) -> sixtyfps_corelib::layout::LayoutInfo {
|
fn layout_info(self: Pin<&Self>) -> sixtyfps_corelib::layout::LayoutInfo {
|
||||||
self.borrow().as_ref().layout_info()
|
self.borrow().as_ref().layout_info()
|
||||||
}
|
}
|
||||||
fn apply_layout(self: Pin<&Self>, r: sixtyfps_corelib::graphics::Rect) {
|
|
||||||
self.borrow().as_ref().apply_layout(r)
|
|
||||||
}
|
|
||||||
fn get_item_ref<'a>(self: Pin<&'a Self>, index: usize) -> Pin<ItemRef<'a>> {
|
fn get_item_ref<'a>(self: Pin<&'a Self>, index: usize) -> Pin<ItemRef<'a>> {
|
||||||
// We're having difficulties transferring the lifetime to a pinned reference
|
// We're having difficulties transferring the lifetime to a pinned reference
|
||||||
// to the other ComponentVTable with the same life time. So skip the vtable
|
// to the other ComponentVTable with the same life time. So skip the vtable
|
||||||
|
@ -789,7 +785,6 @@ fn generate_component<'id>(
|
||||||
let t = ComponentVTable {
|
let t = ComponentVTable {
|
||||||
visit_children_item,
|
visit_children_item,
|
||||||
layout_info,
|
layout_info,
|
||||||
apply_layout,
|
|
||||||
get_item_ref,
|
get_item_ref,
|
||||||
parent_item,
|
parent_item,
|
||||||
drop_in_place,
|
drop_in_place,
|
||||||
|
@ -1225,19 +1220,6 @@ extern "C" fn layout_info(component: ComponentRefPin) -> LayoutInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" fn apply_layout(component: ComponentRefPin, _r: sixtyfps_corelib::graphics::Rect) {
|
|
||||||
generativity::make_guard!(guard);
|
|
||||||
// This is fine since we can only be called with a component that with our vtable which is a ComponentDescription
|
|
||||||
let instance_ref = unsafe { InstanceRef::from_pin_ref(component, guard) };
|
|
||||||
|
|
||||||
for rep_in_comp in &instance_ref.component_type.repeater {
|
|
||||||
generativity::make_guard!(g);
|
|
||||||
let rep_in_comp = rep_in_comp.unerase(g);
|
|
||||||
ensure_repeater_updated(instance_ref, rep_in_comp);
|
|
||||||
rep_in_comp.offset.apply_pin(instance_ref.instance).compute_layout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe extern "C" fn get_item_ref(component: ComponentRefPin, index: usize) -> Pin<ItemRef> {
|
unsafe extern "C" fn get_item_ref(component: ComponentRefPin, index: usize) -> Pin<ItemRef> {
|
||||||
generativity::make_guard!(guard);
|
generativity::make_guard!(guard);
|
||||||
let instance_ref = InstanceRef::from_pin_ref(component, guard);
|
let instance_ref = InstanceRef::from_pin_ref(component, guard);
|
||||||
|
|
|
@ -233,12 +233,11 @@ impl GraphicsWindow {
|
||||||
|
|
||||||
runtime_window.meta_properties_tracker.as_ref().evaluate_if_dirty(|| {
|
runtime_window.meta_properties_tracker.as_ref().evaluate_if_dirty(|| {
|
||||||
self.apply_geometry_constraint(component.as_ref().layout_info());
|
self.apply_geometry_constraint(component.as_ref().layout_info());
|
||||||
component.as_ref().apply_layout(Default::default());
|
|
||||||
|
|
||||||
if let Some((popup, pos)) = &*self.active_popup.borrow() {
|
if let Some((popup, _)) = &*self.active_popup.borrow() {
|
||||||
let popup = ComponentRc::borrow_pin(popup);
|
let popup = ComponentRc::borrow_pin(popup);
|
||||||
let popup_root = popup.as_ref().get_item_ref(0);
|
let popup_root = popup.as_ref().get_item_ref(0);
|
||||||
let size = if let Some(window_item) = ItemRef::downcast_pin(popup_root) {
|
if let Some(window_item) = ItemRef::downcast_pin(popup_root) {
|
||||||
let layout_info = popup.as_ref().layout_info();
|
let layout_info = popup.as_ref().layout_info();
|
||||||
|
|
||||||
let width =
|
let width =
|
||||||
|
@ -256,11 +255,7 @@ impl GraphicsWindow {
|
||||||
h = layout_info.min_height;
|
h = layout_info.min_height;
|
||||||
height.set(h);
|
height.set(h);
|
||||||
}
|
}
|
||||||
Size::new(h, w) * self.scale_factor()
|
|
||||||
} else {
|
|
||||||
Size::default()
|
|
||||||
};
|
};
|
||||||
popup.as_ref().apply_layout(Rect::new(pos.clone(), size));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -845,7 +845,6 @@ impl QtWindow {
|
||||||
if runtime_window.meta_properties_tracker.as_ref().is_dirty() {
|
if runtime_window.meta_properties_tracker.as_ref().is_dirty() {
|
||||||
runtime_window.meta_properties_tracker.as_ref().evaluate(|| {
|
runtime_window.meta_properties_tracker.as_ref().evaluate(|| {
|
||||||
self.apply_geometry_constraint(component.as_ref().layout_info());
|
self.apply_geometry_constraint(component.as_ref().layout_info());
|
||||||
component.as_ref().apply_layout(Default::default());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,7 +952,6 @@ impl PlatformWindow for QtWindow {
|
||||||
fn show(self: Rc<Self>) {
|
fn show(self: Rc<Self>) {
|
||||||
let component_rc = self.self_weak.upgrade().unwrap().component();
|
let component_rc = self.self_weak.upgrade().unwrap().component();
|
||||||
let component = ComponentRc::borrow_pin(&component_rc);
|
let component = ComponentRc::borrow_pin(&component_rc);
|
||||||
component.as_ref().apply_layout(Default::default());
|
|
||||||
let root_item = component.as_ref().get_item_ref(0);
|
let root_item = component.as_ref().get_item_ref(0);
|
||||||
if let Some(window_item) = ItemRef::downcast_pin(root_item) {
|
if let Some(window_item) = ItemRef::downcast_pin(root_item) {
|
||||||
self.apply_window_properties(window_item);
|
self.apply_window_properties(window_item);
|
||||||
|
|
|
@ -36,14 +36,12 @@ TestCase := Container {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 200});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 200.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -44,14 +44,12 @@ TestCase := MegaContainer {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 200});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 200.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -54,7 +54,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_fixed_image_default_image_fit_ok());
|
assert(instance.get_fixed_image_default_image_fit_ok());
|
||||||
assert(instance.get_fixed_image_image_fit_override_ok());
|
assert(instance.get_fixed_image_image_fit_override_ok());
|
||||||
assert(instance.get_image_in_layout_fit_ok());
|
assert(instance.get_image_in_layout_fit_ok());
|
||||||
|
@ -66,7 +65,6 @@ assert(instance.get_image_with_missing_width_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_fixed_image_default_image_fit_ok());
|
assert!(instance.get_fixed_image_default_image_fit_ok());
|
||||||
assert!(instance.get_fixed_image_image_fit_override_ok());
|
assert!(instance.get_fixed_image_image_fit_override_ok());
|
||||||
assert!(instance.get_image_in_layout_fit_ok());
|
assert!(instance.get_image_in_layout_fit_ok());
|
||||||
|
@ -77,7 +75,6 @@ assert!(instance.get_image_with_missing_width_ok());
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var instance = new sixtyfps.TestCase();
|
var instance = new sixtyfps.TestCase();
|
||||||
instance.send_mouse_click(5., 5.);
|
|
||||||
assert(instance.fixed_image_default_image_fit_ok);
|
assert(instance.fixed_image_default_image_fit_ok);
|
||||||
assert(instance.fixed_image_image_fit_override_ok);
|
assert(instance.fixed_image_image_fit_override_ok);
|
||||||
assert(instance.image_in_layout_fit_ok);
|
assert(instance.image_in_layout_fit_ok);
|
||||||
|
|
|
@ -77,7 +77,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_v1());
|
assert(instance.get_v1());
|
||||||
assert(instance.get_v2());
|
assert(instance.get_v2());
|
||||||
assert(instance.get_v3());
|
assert(instance.get_v3());
|
||||||
|
@ -90,7 +89,6 @@ assert(instance.get_c1());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_v1());
|
assert!(instance.get_v1());
|
||||||
assert!(instance.get_v2());
|
assert!(instance.get_v2());
|
||||||
assert!(instance.get_v3());
|
assert!(instance.get_v3());
|
||||||
|
|
|
@ -37,7 +37,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_fake_image_width_ok());
|
assert(instance.get_fake_image_width_ok());
|
||||||
assert(instance.get_fake_image_height_ok());
|
assert(instance.get_fake_image_height_ok());
|
||||||
```
|
```
|
||||||
|
@ -45,7 +44,6 @@ assert(instance.get_fake_image_height_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_fake_image_width_ok());
|
assert!(instance.get_fake_image_width_ok());
|
||||||
assert!(instance.get_fake_image_height_ok());
|
assert!(instance.get_fake_image_height_ok());
|
||||||
```
|
```
|
||||||
|
|
|
@ -28,7 +28,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_elem1_ok());
|
assert(instance.get_elem1_ok());
|
||||||
assert(instance.get_elem2_ok());
|
assert(instance.get_elem2_ok());
|
||||||
assert(instance.get_elem3_ok());
|
assert(instance.get_elem3_ok());
|
||||||
|
@ -37,7 +36,6 @@ assert(instance.get_elem3_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_elem1_ok());
|
assert!(instance.get_elem1_ok());
|
||||||
assert!(instance.get_elem2_ok());
|
assert!(instance.get_elem2_ok());
|
||||||
assert!(instance.get_elem3_ok());
|
assert!(instance.get_elem3_ok());
|
||||||
|
|
|
@ -42,7 +42,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
assert(instance.get_rect2_pos_ok());
|
assert(instance.get_rect2_pos_ok());
|
||||||
assert(instance.get_rect3_pos_ok());
|
assert(instance.get_rect3_pos_ok());
|
||||||
|
@ -52,7 +51,6 @@ assert_eq(instance.get_layout_width(), 300);
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
assert!(instance.get_rect2_pos_ok());
|
assert!(instance.get_rect2_pos_ok());
|
||||||
assert!(instance.get_rect3_pos_ok());
|
assert!(instance.get_rect3_pos_ok());
|
||||||
|
|
|
@ -65,7 +65,6 @@ TestCase := Window {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_size_ok());
|
assert(instance.get_size_ok());
|
||||||
assert(instance.get_x_ok());
|
assert(instance.get_x_ok());
|
||||||
assert(instance.get_y_ok());
|
assert(instance.get_y_ok());
|
||||||
|
@ -74,7 +73,6 @@ assert(instance.get_y_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_size_ok());
|
assert!(instance.get_size_ok());
|
||||||
assert!(instance.get_x_ok());
|
assert!(instance.get_x_ok());
|
||||||
assert!(instance.get_y_ok());
|
assert!(instance.get_y_ok());
|
||||||
|
|
|
@ -54,7 +54,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
assert(instance.get_rect2_pos_ok());
|
assert(instance.get_rect2_pos_ok());
|
||||||
assert(instance.get_rect3_pos_ok());
|
assert(instance.get_rect3_pos_ok());
|
||||||
|
@ -63,7 +62,6 @@ assert(instance.get_rect3_pos_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
assert!(instance.get_rect2_pos_ok());
|
assert!(instance.get_rect2_pos_ok());
|
||||||
assert!(instance.get_rect3_pos_ok());
|
assert!(instance.get_rect3_pos_ok());
|
||||||
|
|
|
@ -58,7 +58,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 600, 300});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
assert(instance.get_rect2_pos_ok());
|
assert(instance.get_rect2_pos_ok());
|
||||||
```
|
```
|
||||||
|
@ -66,7 +65,6 @@ assert(instance.get_rect2_pos_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
assert!(instance.get_rect2_pos_ok());
|
assert!(instance.get_rect2_pos_ok());
|
||||||
```
|
```
|
||||||
|
|
|
@ -42,7 +42,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_fake_image_width_ok());
|
assert(instance.get_fake_image_width_ok());
|
||||||
assert(instance.get_fake_image_height_ok());
|
assert(instance.get_fake_image_height_ok());
|
||||||
```
|
```
|
||||||
|
@ -50,7 +49,6 @@ assert(instance.get_fake_image_height_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_fake_image_width_ok());
|
assert!(instance.get_fake_image_width_ok());
|
||||||
assert!(instance.get_fake_image_height_ok());
|
assert!(instance.get_fake_image_height_ok());
|
||||||
```
|
```
|
||||||
|
|
|
@ -41,7 +41,6 @@ TestCase := Rectangle {
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
sixtyfps::testing::send_mouse_click(&instance, -1., -1.); // FIXME: Force creation of repeater components before computing the layout
|
sixtyfps::testing::send_mouse_click(&instance, -1., -1.); // FIXME: Force creation of repeater components before computing the layout
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
|
|
||||||
sixtyfps::testing::send_mouse_click(&instance, 190., 190.);
|
sixtyfps::testing::send_mouse_click(&instance, 190., 190.);
|
||||||
assert_eq(instance.get_value(), 1+1);
|
assert_eq(instance.get_value(), 1+1);
|
||||||
|
@ -55,7 +54,6 @@ assert_eq(instance.get_value(), 1+1+2);
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::send_mouse_click(&instance, -1., -1.); // FIXME: Force creation of repeater components before computing the layout
|
sixtyfps::testing::send_mouse_click(&instance, -1., -1.); // FIXME: Force creation of repeater components before computing the layout
|
||||||
|
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
|
|
||||||
sixtyfps::testing::send_mouse_click(&instance, 190., 190.);
|
sixtyfps::testing::send_mouse_click(&instance, 190., 190.);
|
||||||
assert_eq!(instance.get_value(), 1+1);
|
assert_eq!(instance.get_value(), 1+1);
|
||||||
|
|
|
@ -69,7 +69,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_blue_rect_ok());
|
assert(instance.get_blue_rect_ok());
|
||||||
assert(instance.get_red_rect_ok());
|
assert(instance.get_red_rect_ok());
|
||||||
assert(instance.get_green_rect_ok());
|
assert(instance.get_green_rect_ok());
|
||||||
|
@ -81,7 +80,6 @@ assert(instance.get_pink_rect_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_blue_rect_ok());
|
assert!(instance.get_blue_rect_ok());
|
||||||
assert!(instance.get_red_rect_ok());
|
assert!(instance.get_red_rect_ok());
|
||||||
assert!(instance.get_green_rect_ok());
|
assert!(instance.get_green_rect_ok());
|
||||||
|
|
|
@ -24,13 +24,13 @@ HelloWorld := Window {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = HelloWorld::create();
|
auto handle = HelloWorld::create();
|
||||||
const HelloWorld &instance = *handle;
|
const HelloWorld &instance = *handle;
|
||||||
HelloWorld::apply_layout({&HelloWorld::static_vtable, const_cast<HelloWorld*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
sixtyfps::testing::send_mouse_click(&instance, 5., 5.);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = HelloWorld::new();
|
let instance = HelloWorld::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
sixtyfps::testing::send_mouse_click(&instance, 5., 5.);
|
||||||
```
|
```
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -132,7 +132,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_rect_blue_ok());
|
assert(instance.get_rect_blue_ok());
|
||||||
assert(instance.get_rect_orange_ok());
|
assert(instance.get_rect_orange_ok());
|
||||||
assert(instance.get_rect_red_ok());
|
assert(instance.get_rect_red_ok());
|
||||||
|
@ -145,7 +144,6 @@ assert(instance.get_rect_black2_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_rect_blue_ok());
|
assert!(instance.get_rect_blue_ok());
|
||||||
assert!(instance.get_rect_orange_ok());
|
assert!(instance.get_rect_orange_ok());
|
||||||
assert!(instance.get_rect_red_ok());
|
assert!(instance.get_rect_red_ok());
|
||||||
|
|
|
@ -45,7 +45,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
assert(instance.get_rect2_pos_ok());
|
assert(instance.get_rect2_pos_ok());
|
||||||
assert(instance.get_rect3_pos_ok());
|
assert(instance.get_rect3_pos_ok());
|
||||||
|
@ -57,7 +56,6 @@ assert(instance.get_rect6_pos_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
assert!(instance.get_rect2_pos_ok());
|
assert!(instance.get_rect2_pos_ok());
|
||||||
assert!(instance.get_rect3_pos_ok());
|
assert!(instance.get_rect3_pos_ok());
|
||||||
|
|
|
@ -55,7 +55,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
assert(instance.get_rect2_pos_ok());
|
assert(instance.get_rect2_pos_ok());
|
||||||
assert(instance.get_rect3_pos_ok());
|
assert(instance.get_rect3_pos_ok());
|
||||||
|
@ -65,7 +64,6 @@ assert(instance.get_rect4_pos_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
assert!(instance.get_rect2_pos_ok());
|
assert!(instance.get_rect2_pos_ok());
|
||||||
assert!(instance.get_rect3_pos_ok());
|
assert!(instance.get_rect3_pos_ok());
|
||||||
|
|
|
@ -44,7 +44,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_rect1_pos_ok());
|
assert(instance.get_rect1_pos_ok());
|
||||||
assert(instance.get_rect2_pos_ok());
|
assert(instance.get_rect2_pos_ok());
|
||||||
```
|
```
|
||||||
|
@ -52,7 +51,6 @@ assert(instance.get_rect2_pos_ok());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_rect1_pos_ok());
|
assert!(instance.get_rect1_pos_ok());
|
||||||
assert!(instance.get_rect2_pos_ok());
|
assert!(instance.get_rect2_pos_ok());
|
||||||
```
|
```
|
||||||
|
|
|
@ -85,7 +85,6 @@ TestCase := Rectangle {
|
||||||
```cpp
|
```cpp
|
||||||
auto handle = TestCase::create();
|
auto handle = TestCase::create();
|
||||||
const TestCase &instance = *handle;
|
const TestCase &instance = *handle;
|
||||||
TestCase::apply_layout({&TestCase::static_vtable, const_cast<TestCase*>(&instance) }, sixtyfps::Rect{0, 0, 300, 300});
|
|
||||||
assert(instance.get_test1());
|
assert(instance.get_test1());
|
||||||
assert(instance.get_test2());
|
assert(instance.get_test2());
|
||||||
assert(instance.get_test3());
|
assert(instance.get_test3());
|
||||||
|
@ -96,7 +95,6 @@ assert(instance.get_test5());
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
let instance = TestCase::new();
|
let instance = TestCase::new();
|
||||||
sixtyfps::testing::apply_layout(&instance, sixtyfps::re_exports::Rect::new(Default::default(), sixtyfps::re_exports::Size::new(300., 300.)));
|
|
||||||
assert!(instance.get_test1());
|
assert!(instance.get_test1());
|
||||||
assert!(instance.get_test2());
|
assert!(instance.get_test2());
|
||||||
assert!(instance.get_test3());
|
assert!(instance.get_test3());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue