Commit graph

661 commits

Author SHA1 Message Date
Simon Hausmann
9a06a29314 Implement dynamic image-fit and aspect ratio behavior for Image elements
This is part of #168 where `image-fit` has dynamic defaults and missing
width or height property bindings are installed with an aspect ratio
preserving behavior.
2021-04-09 15:17:52 +02:00
Simon Hausmann
81dcd02dd5 Improve preferred size test
Test not only the regression that 843f52b3c5 introduced but also test that
the application of the preferred size on the layout axis works.
2021-04-08 20:04:50 +02:00
Simon Hausmann
794d3ec6ec Revert "Add a nodejs testing function for apply_layout"
This reverts commit beb5d63d1b.

Oops, the more modern style *is* to use send_mouse_click.
2021-04-08 16:58:37 +02:00
Simon Hausmann
beb5d63d1b Add a nodejs testing function for apply_layout
This will allow making the JS test code more similar to the C++/Rust code,
allowing replacing synthetic mouse clicks.
2021-04-08 16:51:51 +02:00
Simon Hausmann
8fb0c060d6 Add JS test for cross axis box preferred size test
Amends commit 1cfbbb090a
2021-04-08 16:36:29 +02:00
Simon Hausmann
1cfbbb090a Fix standalone build of test-driver-interpreter
Calling `sixtyfps_interpreter::print_diagnostics` requires the diagnostics feature in the interpreter.
2021-04-08 16:13:53 +02:00
Simon Hausmann
c448003e2f Add test case for preferred size in boxes bug
Amends commit 7c1738eeea

This also adds the preferred-width/height fake properties to allow overriding.
2021-04-08 16:13:53 +02:00
Olivier Goffart
3cad21c23f Test for my previous commit 2021-04-08 15:45:30 +02:00
Olivier Goffart
96ee9ea7a0 GridLayout: Element outside of a Row should go in a new row 2021-04-08 11:46:24 +02:00
Olivier Goffart
9416b0a3d9 Upgrade version of cbindgen 2021-04-07 13:39:58 +02:00
Olivier Goffart
21da822123 Fix compilation of the C++ tests
Last commit added a dependency to proc-macro2 for cbindgen, but we also need
it in the C++ test driver
2021-04-07 13:31:29 +02:00
Simon Hausmann
05a8bbad8f Work around css-color-parser2 bug 2021-04-01 10:03:39 +02:00
Simon Hausmann
477729da52 Improve brush property test coverage
Test that assigning colors works:

* Test the implicit `Brush(const Color &)` C++ constructor
* Add derive_more::From to allow convenient conversion in Rust
* When assigning to brush properties in JavaScript, try at least to see if it's a color string (could be extended in the future)
2021-04-01 08:27:10 +02:00
Simon Hausmann
cf22548586 Add a test case for instantiating brush properties
Amends commit e6d165dfbb
2021-04-01 08:16:32 +02:00
Olivier Goffart
f4ed0e333b Remove useless message in an assert
The goal was probably to do an assert_eq, because passing 1 as a message don't make sense
2021-03-25 18:54:00 +01:00
Simon Hausmann
4a9cd954b8 Rework the Rust entry point API for the interpreter
Switch to the stateful `ComponentCompiler` concept that we discussed for the C++ API.
2021-03-18 18:20:50 +01:00
Olivier Goffart
0e351de1a6 Create a new crate to expose the C++ 2021-03-16 16:34:02 +01:00
Simon Hausmann
79aefcb303 Fix compilation of tests 2021-03-15 20:02:31 +01:00
Olivier Goffart
4ab3802eee Fix the documentation tests 2021-03-15 19:51:04 +01:00
Olivier Goffart
fef4a10ebd Use the new API for the interpreter in wasm
Improve the ComponenetDefinition::from_source
2021-03-15 17:57:46 +01:00
Olivier Goffart
48333370a6 Use the new interpreter API in things that depends on it 2021-03-15 17:29:27 +01:00
Simon Hausmann
8372d3f6d8 Rename call_* to invoke_* for callbacks
Fixes #187
2021-03-15 17:01:05 +01:00
Simon Hausmann
70ff7baa85 Fix compilation after diagnostics API changes 2021-03-15 10:43:26 +01:00
Olivier Goffart
c840b046ae Rename the "resource" type to "image" 2021-03-10 17:24:31 +01:00
Simon Hausmann
b591f7de2c Add Window.default-font-size
This allows getting rid of the `DemoText` element in the printer demo
2021-03-02 13:33:43 +01:00
Simon Hausmann
27bdb4d481 Added Window.default-font-family
One step towards getting rid of `DemoText` in the printer demo
2021-03-02 13:25:21 +01:00
Simon Hausmann
3d7eb6ac70 Fix brightening function name in .60
An earlier revision of the patch called it `lighter` and it was renamed
to `brighter`, as bright is the opposite of dark. But the function name
in .60 wasn't changed yet.

Amends commit 391d0152f0
2021-02-24 13:40:27 +01:00
Simon Hausmann
391d0152f0 Add Color::brighter/darker functions
These are exposed in .60 as well as in Rust and C++ and implemented by
converting to HSV color space and adjusting the brightness (value).
2021-02-24 10:49:27 +01:00
Olivier Goffart
5727a4cf02 implement square root 2021-02-20 08:53:08 +01:00
Olivier Goffart
b34a34cea0 C++ Make sure that the layout is properly updated when the model of a for or if changes
The problem is that the backend is using the `meta_property_listener` to know
if the layout must be updated, but the C++ code would not register a dependency

NOTE about the test: The test doesn't really test that it works because
the test backend don't have a meta_property_listener and apply the layout
inconditionally in sixtyfps_send_mouse_click
2021-02-18 09:40:12 +01:00
Simon Hausmann
8b28c4d792 Fix compilation with empty image urls when resource embedding is enabled
`@image-url("")` should translate to `Resource::None` instead of
`Resource::AbsolutePath` to avoid that the rust compiler tries to
include a directory when embedding images.
2021-02-17 16:01:54 +01:00
Olivier Goffart
09ea6572e4 Rust: Fix if in box layouts 2021-02-17 09:22:39 +01:00
Olivier Goffart
92f9402a39 Fix C++ compilation if using condition between 0 and a unit type 2021-02-16 18:40:32 +01:00
Olivier Goffart
26c04c3550 Add test for previous commit 2021-02-16 15:22:06 +01:00
Olivier Goffart
b580736caf Fix error in the generated rust code with laoyut in for 2021-02-15 15:00:52 +01:00
Olivier Goffart
1f318f2d10 Use the new mouse event API for the flickable
Issue #166
2021-02-13 16:58:04 +01:00
Olivier Goffart
7088d30038 Don't use rust assert in C++ 2021-02-12 21:59:33 +01:00
Olivier Goffart
edd1a321dc Add JS test for previous patch 2021-02-12 21:47:10 +01:00
Olivier Goffart
861e76b0ef Fix vinding when two native property are linked
Fixes #161 again
2021-02-12 21:40:34 +01:00
Simon Hausmann
500919745e Add an internal Rotate element
This is just a starting point, to be turned into a real Transform
element later, along with syntactic sugar to turn rotation, etc.  into a
transform matrix in the generated output.
2021-02-12 17:31:06 +01:00
Olivier Goffart
1af6d1e187 Fix test from previous patch 2021-02-12 10:36:23 +01:00
Olivier Goffart
68de483f30 Ensure that the repeater are updated when we compute the layouts
Fixes #167
2021-02-12 10:07:33 +01:00
Olivier Goffart
096f55e365 Change behavior of percent sice within the layout
So that size with percentages don't affect the maximum/minimum size

Fixes #117
2021-02-11 20:32:26 +01:00
Olivier Goffart
0174db3679 Delay the percentage size conversion to after the layouting phase
So we can see inthe layouting phase if the size was in percent
2021-02-11 15:08:24 +01:00
Simon Hausmann
2dd5ea61bb Add support for Path.fill-rule
For some reason it's not working with the Qt renderer though
2021-02-10 14:08:32 +01:00
Olivier Goffart
f7a76dc352 Add ImageFit::cover, and fix ImageFit::contain 2021-02-09 10:52:04 +01:00
Olivier Goffart
0f251a7b82 Fix merge of two way binding
collext the set of all binding mapping to the same property, and only keep
the binding with the highest priority

Fixes #161
2021-02-08 18:58:23 +01:00
Olivier Goffart
f1300a7f2d Fix propagation of mouse event.
Process the event in the post visit if the children did not intercept the event
2021-02-08 14:08:14 +01:00
Olivier Goffart
431ce88326 sin/cos/tan and asin/acos/atan 2021-02-08 12:23:31 +01:00
Olivier Goffart
d30f5138b8 Box layout: ensure max size is >= min
Fixes #160
2021-02-05 19:18:09 +01:00