Skip to content

Commit

Permalink
Fix and add tests for window arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
WilfSilver committed May 14, 2022
1 parent 6c160a3 commit e53cc20
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
61 changes: 60 additions & 1 deletion crates/yuck/src/config/snapshots/yuck__config__test__config.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Config(
window_definitions: {
"some-window": WindowDefinition(
name: "some-window",
expected_args: [],
args_span: Span(18446744073709551615, 18446744073709551615, 18446744073709551615),
geometry: Some(WindowGeometry(
anchor_point: AnchorPoint(
x: START,
Expand All @@ -56,7 +58,7 @@ Config(
),
)),
stacking: Foreground,
monitor_number: Some(12),
monitor_number: Some(Literal(DynVal("12", Span(278, 280, 0)))),
widget: Basic(BasicWidgetUse(
name: "bar",
attrs: Attributes(
Expand All @@ -83,6 +85,63 @@ Config(
),
),
),
"some-window-with-args": WindowDefinition(
name: "some-window-with-args",
expected_args: [
AttrSpec(
name: AttrName("arg"),
optional: false,
span: Span(523, 526, 0),
),
AttrSpec(
name: AttrName("arg2"),
optional: false,
span: Span(527, 531, 0),
),
],
args_span: Span(522, 532, 0),
geometry: Some(WindowGeometry(
anchor_point: AnchorPoint(
x: START,
y: START,
),
offset: Coords(
x: Pixels(0),
y: Pixels(0),
),
size: Coords(
x: Percent(12),
y: Pixels(20),
),
)),
stacking: Foreground,
monitor_number: Some(Literal(DynVal("12", Span(595, 597, 0)))),
widget: Basic(BasicWidgetUse(
name: "bar",
attrs: Attributes(
span: Span(784, 795, 0),
attrs: {
AttrName("arg"): AttrEntry(
key_span: Span(785, 789, 0),
value: SimplExpr(Span(790, 795, 0), Literal(DynVal("bla", Span(790, 795, 0)))),
),
},
),
children: [],
span: Span(780, 796, 0),
name_span: Span(781, 784, 0),
)),
resizable: true,
backend_options: BackendWindowOptions(
wm_ignore: false,
sticky: true,
window_type: Dock,
struts: StrutDefinition(
side: Left,
dist: Pixels(30),
),
),
),
},
var_definitions: {
VarName("some_var"): VarDefinition(
Expand Down
7 changes: 7 additions & 0 deletions crates/yuck/src/config/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ fn test_config() {
:geometry (geometry :width "12%" :height "20px")
:reserve (struts :side "left" :distance "30px")
(bar :arg "bla"))
(defwindow some-window-with-args [arg arg2]
:stacking "fg"
:monitor 12
:resizable true
:geometry (geometry :width "12%" :height "20px")
:reserve (struts :side "left" :distance "30px")
(bar :arg "bla"))
"#;
let mut files = YuckFiles::new();
let (span, asts) = files.load_str("config.yuck".to_string(), input.to_string()).unwrap();
Expand Down

0 comments on commit e53cc20

Please sign in to comment.