Skip to content

Commit c5d64d1

Browse files
Re-export from masonry_core, use in masonry_testing (linebender#1147)
We have things that are deps of `masonry_core`, `masonry`, and `masonry_testing` and if you use `masonry_core`, you need to know that and use the right versions. Instead, we should be exporting these things from `masonry_core` and using them from there. This updates `masonry_testing` to use things from `masonry_core` instead and subsequent commits can further improve upon this with the `masonry` crate and so on.
1 parent eb931ca commit c5d64d1

File tree

8 files changed

+26
-41
lines changed

8 files changed

+26
-41
lines changed

Cargo.lock

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

masonry_core/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
)]
3838
// TODO - Add logo
3939

40+
pub use vello::{kurbo, peniko, peniko::color::palette};
41+
pub use {accesskit, cursor_icon, dpi, parley, smallvec, ui_events, vello};
42+
4043
// TODO - re-add #[doc(hidden)]
4144
pub mod doc;
4245

@@ -50,6 +53,3 @@ pub mod core;
5053

5154
// TODO - Move to core?
5255
pub use util::{Handled, UnitPoint};
53-
54-
// TODO - Remove re-exports
55-
pub(crate) use {::dpi, ::vello, vello::peniko};

masonry_testing/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,13 @@ targets = []
1919
default = []
2020

2121
[dependencies]
22-
accesskit.workspace = true
2322
accesskit_consumer.workspace = true
24-
cursor-icon = "1.1.0"
25-
dpi.workspace = true
2623
futures-intrusive = "0.5.0"
2724
image = { workspace = true, features = ["png"] }
2825
masonry_core.workspace = true
2926
oxipng = { version = "9.1.5", default-features = false }
3027
pollster = "0.4.0"
31-
smallvec.workspace = true
3228
tracing = { workspace = true, features = ["default"] }
33-
ui-events.workspace = true
34-
vello.workspace = true
3529
wgpu.workspace = true
3630

3731
[dev-dependencies]

masonry_testing/src/harness.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@ use std::num::NonZeroUsize;
99
use std::path::PathBuf;
1010
use std::sync::{Arc, mpsc};
1111

12-
use cursor_icon::CursorIcon;
13-
use dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
1412
use image::{DynamicImage, ImageFormat, ImageReader, Rgba, RgbaImage};
15-
use masonry_core::core::{Properties, WidgetPod};
1613
use oxipng::{Options, optimize_from_memory};
1714
use tracing::debug;
18-
use vello::RendererOptions;
19-
use vello::kurbo::{Point, Size, Vec2};
20-
use vello::peniko::{Blob, Color};
21-
use vello::util::{RenderContext, block_on_wgpu};
2215
use wgpu::{
2316
BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Extent3d, TexelCopyBufferInfo,
2417
TextureDescriptor, TextureFormat, TextureUsages,
@@ -33,7 +26,14 @@ use masonry_core::core::{
3326
PointerState, PointerType, PointerUpdate, ScrollDelta, TextEvent, Widget, WidgetId, WidgetMut,
3427
WidgetRef, WindowEvent,
3528
};
29+
use masonry_core::core::{Properties, WidgetPod};
30+
use masonry_core::cursor_icon::CursorIcon;
31+
use masonry_core::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize};
32+
use masonry_core::kurbo::{Point, Size, Vec2};
33+
use masonry_core::peniko::{Blob, Color};
3634
use masonry_core::util::Duration;
35+
use masonry_core::vello;
36+
use masonry_core::vello::util::{RenderContext, block_on_wgpu};
3737

3838
use crate::screenshots::get_image_diff;
3939

@@ -389,7 +389,7 @@ impl TestHarness {
389389
let queue = &device_handle.queue;
390390
let mut renderer = vello::Renderer::new(
391391
device,
392-
RendererOptions {
392+
vello::RendererOptions {
393393
// TODO - Examine this value
394394
use_cpu: true,
395395
num_init_threads: NonZeroUsize::new(1),

masonry_testing/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ mod screenshots;
1515
mod wrapper_widget;
1616

1717
pub use harness::{PRIMARY_MOUSE, TestHarness, TestHarnessParams};
18-
use masonry_core::core::{Properties, WidgetOptions};
1918
pub use modular_widget::ModularWidget;
2019
pub use recorder_widget::{Record, Recorder, Recording};
2120
pub use wrapper_widget::WrapperWidget;
2221

23-
use masonry_core::core::{Widget, WidgetId, WidgetPod};
22+
use masonry_core::core::{Properties, Widget, WidgetId, WidgetOptions, WidgetPod};
2423

2524
// TODO - Split off into separate file
2625

masonry_testing/src/modular_widget.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
use std::any::TypeId;
55

6-
use accesskit::{Node, Role};
7-
use cursor_icon::CursorIcon;
8-
use smallvec::SmallVec;
96
use tracing::trace_span;
10-
use vello::Scene;
11-
use vello::kurbo::{Point, Size};
127

8+
use masonry_core::accesskit::{Node, Role};
139
use masonry_core::core::{
1410
AccessCtx, AccessEvent, BoxConstraints, ComposeCtx, EventCtx, LayoutCtx, PaintCtx,
1511
PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update,
1612
UpdateCtx, Widget, WidgetId, WidgetRef, find_widget_under_pointer,
1713
};
14+
use masonry_core::cursor_icon::CursorIcon;
15+
use masonry_core::kurbo::{Point, Size};
16+
use masonry_core::smallvec::SmallVec;
17+
use masonry_core::vello::Scene;
1818

1919
pub type PointerEventFn<S> =
2020
dyn FnMut(&mut S, &mut EventCtx<'_>, &mut PropertiesMut<'_>, &PointerEvent);

masonry_testing/src/recorder_widget.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ use std::cell::RefCell;
1313
use std::collections::VecDeque;
1414
use std::rc::Rc;
1515

16-
use accesskit::{Node, Role};
17-
use cursor_icon::CursorIcon;
18-
use smallvec::SmallVec;
19-
use vello::Scene;
20-
use vello::kurbo::{Point, Size};
21-
16+
use masonry_core::accesskit::{Node, Role};
2217
use masonry_core::core::{
2318
AccessCtx, AccessEvent, BoxConstraints, ComposeCtx, EventCtx, LayoutCtx, PaintCtx,
2419
PointerEvent, PropertiesMut, PropertiesRef, QueryCtx, RegisterCtx, TextEvent, Update,
2520
UpdateCtx, Widget, WidgetId, WidgetRef,
2621
};
22+
use masonry_core::cursor_icon::CursorIcon;
23+
use masonry_core::kurbo::{Point, Size};
24+
use masonry_core::smallvec::SmallVec;
25+
use masonry_core::vello::Scene;
2726

2827
// TODO - Re-enable doc test.
2928
// Doc test is currently disabled because it depends on a parent crate.

masonry_testing/src/wrapper_widget.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33

44
use std::any::TypeId;
55

6-
use accesskit::{Node, Role};
7-
use smallvec::{SmallVec, smallvec};
8-
use vello::Scene;
9-
use vello::kurbo::{Point, Size};
10-
6+
use masonry_core::accesskit::{Node, Role};
117
use masonry_core::core::{
128
AccessCtx, AccessEvent, BoxConstraints, ComposeCtx, EventCtx, LayoutCtx, PaintCtx,
139
PointerEvent, PropertiesMut, PropertiesRef, RegisterCtx, TextEvent, Update, UpdateCtx, Widget,
1410
WidgetId, WidgetMut, WidgetPod,
1511
};
12+
use masonry_core::kurbo::{Point, Size};
13+
use masonry_core::smallvec::{SmallVec, smallvec};
14+
use masonry_core::vello::Scene;
1615

1716
/// A basic wrapper widget that can replace its child.
1817
pub struct WrapperWidget {

0 commit comments

Comments
 (0)