Fix broken tests and comment out remaining tests
This commit is contained in:
@@ -81,6 +81,7 @@ impl<V: 'static> Element<V> for Text<V> {
|
||||
let text = self.text.clone();
|
||||
|
||||
let rem_size = cx.rem_size();
|
||||
|
||||
let layout_id = cx.request_measured_layout(Default::default(), rem_size, {
|
||||
let element_state = element_state.clone();
|
||||
move |known_dimensions, _| {
|
||||
@@ -93,6 +94,10 @@ impl<V: 'static> Element<V> for Text<V> {
|
||||
)
|
||||
.log_err()
|
||||
else {
|
||||
element_state.lock().replace(TextElementState {
|
||||
lines: Default::default(),
|
||||
line_height,
|
||||
});
|
||||
return Size::default();
|
||||
};
|
||||
|
||||
@@ -131,7 +136,8 @@ impl<V: 'static> Element<V> for Text<V> {
|
||||
let element_state = element_state.lock();
|
||||
let element_state = element_state
|
||||
.as_ref()
|
||||
.expect("measurement has not been performed");
|
||||
.ok_or_else(|| anyhow::anyhow!("measurement has not been performed on {}", &self.text))
|
||||
.unwrap();
|
||||
|
||||
let line_height = element_state.line_height;
|
||||
let mut line_origin = bounds.origin;
|
||||
|
||||
@@ -2138,7 +2138,7 @@ impl<'a, V: 'static> ViewContext<'a, V> {
|
||||
&mut self,
|
||||
handler: impl Fn(&mut V, &Event, DispatchPhase, &mut ViewContext<V>) + 'static,
|
||||
) {
|
||||
let handle = self.view();
|
||||
let handle = self.view().clone();
|
||||
self.window_cx.on_key_event(move |event, phase, cx| {
|
||||
handle.update(cx, |view, cx| {
|
||||
handler(view, event, phase, cx);
|
||||
@@ -2151,7 +2151,7 @@ impl<'a, V: 'static> ViewContext<'a, V> {
|
||||
action_type: TypeId,
|
||||
handler: impl Fn(&mut V, &dyn Any, DispatchPhase, &mut ViewContext<V>) + 'static,
|
||||
) {
|
||||
let handle = self.view();
|
||||
let handle = self.view().clone();
|
||||
self.window_cx
|
||||
.on_action(action_type, move |action, phase, cx| {
|
||||
handle.update(cx, |view, cx| {
|
||||
|
||||
Reference in New Issue
Block a user