Fixed tests.

This commit is contained in:
Samuel Guerra 2023-12-30 22:56:22 -03:00
parent 3ed50bfdf2
commit 7af0065a9b
7 changed files with 43 additions and 22 deletions

View File

@ -10,13 +10,8 @@
- In bidi text this can panic also.
- Use the caret spot to position.
- Right now it only looks right because the default caret origin is at y=0.
- Laidout context does not update in capture.
- This is a limitation of resolved too.
- We first tough it was ok to modify the value before loading in in context.
- The current method is not the allocation free way to load a context either, an Arc is allocated for each text every call.
* Refactor TEXT context to use `Arc<RwLock<T>>` backing stores.
- Only expose read lock.
- Test all.
- Merge.
@ -24,6 +19,10 @@
- Touch carets vanish when the toolbar opens.
- Because of focus, needs to still show if focus is in toolbar.
* Opening a text file in the editor example causes an accesskit panic.
* Editor example Save command operates like Save As for opened file.
# Publish
* Publish if there is no missing component that could cause a core API refactor.

View File

@ -2,13 +2,13 @@ use zero_ui::wgt_prelude::{property, IntoVar, UiNode};
#[property(CONTEXT)]
pub fn get_state(child: impl UiNode, state: impl IntoVar<u32>) -> impl UiNode {
let _ = state;
let _ = (child, state);
zero_ui::wgt_prelude::NilUiNode
}
#[property(CONTEXT)]
pub fn get_state_invalid(child: impl UiNode, state: impl IntoVar<NotDefault>) -> impl UiNode {
let _ = state;
let _ = (child, state);
zero_ui::wgt_prelude::NilUiNode
}

View File

@ -16,3 +16,22 @@ help: consider annotating `NotDefault` with `#[derive(PartialEq)]`
16 + #[derive(PartialEq)]
17 | pub struct NotDefault {}
|
error[E0277]: can't compare `NotDefault` with `NotDefault`
--> cases/property/prefix_get_default.rs:10:66
|
10 | pub fn get_state_invalid(child: impl UiNode, state: impl IntoVar<NotDefault>) -> impl UiNode {
| ^^^^^^^^^^ no implementation for `NotDefault == NotDefault`
|
= help: the trait `PartialEq` is not implemented for `NotDefault`
= note: required for `NotDefault` to implement `VarValue`
note: required by a bound in `WhenInputVar::new`
--> $WORKSPACE/zero-ui-app/src/widget/builder.rs
|
| pub fn new<T: VarValue>() -> (Self, impl Var<T>) {
| ^^^^^^^^ required by this bound in `WhenInputVar::new`
help: consider annotating `NotDefault` with `#[derive(PartialEq)]`
|
16 + #[derive(PartialEq)]
17 | pub struct NotDefault {}
|

View File

@ -6,7 +6,8 @@ error[E0277]: the trait bound `ArcVar<bool>: IntoVar<u32>` is not satisfied
10 | pub fn has_state_invalid(child: impl UiNode, state: impl IntoVar<u32>) -> impl UiNode {
| ^^^^ the trait `IntoVar<u32>` is not implemented for `ArcVar<bool>`
|
= help: the trait `IntoVar<T>` is implemented for `ArcVar<T>`
= help: the trait `IntoVar<bool>` is implemented for `ArcVar<bool>`
= help: for that trait implementation, expected `bool`, found `u32`
note: required by a bound in `has_state_invalid_::args`
--> cases/property/prefix_has_default.rs:10:58
|

View File

@ -6,7 +6,8 @@ error[E0277]: the trait bound `ArcVar<bool>: IntoVar<u32>` is not satisfied
10 | pub fn is_state_invalid(child: impl UiNode, state: impl IntoVar<u32>) -> impl UiNode {
| ^^^^ the trait `IntoVar<u32>` is not implemented for `ArcVar<bool>`
|
= help: the trait `IntoVar<T>` is implemented for `ArcVar<T>`
= help: the trait `IntoVar<bool>` is implemented for `ArcVar<bool>`
= help: for that trait implementation, expected `bool`, found `u32`
note: required by a bound in `is_state_invalid_::args`
--> cases/property/prefix_is_default.rs:10:57
|

View File

@ -4,6 +4,7 @@ use zero_ui::wgt_prelude::{widget, WidgetBase};
macro_rules! TestWidget {
() => {};
}
#[allow(unused_imports)]
pub use crate::TestWidget;
#[widget($crate::TestWidget)]

View File

@ -1,15 +1,15 @@
error[E0255]: the name `TestWidget` is defined multiple times
--> cases/widget/name_conflict1.rs:9:1
|
7 | pub use crate::TestWidget;
| ----------------- previous import of the type `TestWidget` here
8 |
9 | #[widget($crate::TestWidget)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `TestWidget` redefined here
|
= note: `TestWidget` must be defined only once in the type namespace of this module
= note: this error originates in the attribute macro `widget` (in Nightly builds, run with -Z macro-backtrace for more info)
--> cases/widget/name_conflict1.rs:10:1
|
8 | pub use crate::TestWidget;
| ----------------- previous import of the type `TestWidget` here
9 |
10 | #[widget($crate::TestWidget)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `TestWidget` redefined here
|
= note: `TestWidget` must be defined only once in the type namespace of this module
= note: this error originates in the attribute macro `widget` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can use `as` to change the binding name of the import
|
7 | pub use crate::TestWidget as OtherTestWidget;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
8 | pub use crate::TestWidget as OtherTestWidget;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~