Skip to content

Commit 1caebb3

Browse files
authored
Merge pull request #67 from GGRei/vgui-hygiene-ci-logs-20260624
clean: v-gui notices and test CI logs
2 parents 9687aba + 07b24b2 commit 1caebb3

57 files changed

Lines changed: 544 additions & 415 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,17 @@ jobs:
118118
- name: Run tests
119119
env:
120120
VFLAGS: -no-parallel -cc clang
121-
run: v test gui/
121+
run: |
122+
test_manifest="${RUNNER_TEMP}/gui-test-files"
123+
git -C gui ls-files '*_test.v' | LC_ALL=C sort > "$test_manifest"
124+
test_count="$(wc -l < "$test_manifest" | tr -d ' ')"
125+
echo "Test files: $test_count"
126+
i=0
127+
while IFS= read -r file; do
128+
i=$((i + 1))
129+
echo "[$i/$test_count] gui/$file"
130+
done < "$test_manifest"
131+
v test gui/
122132
- name: Check compilation of examples
123133
if: github.event_name == 'pull_request'
124134
env:
@@ -387,7 +397,13 @@ jobs:
387397
VFLAGS: -no-parallel -cc msvc
388398
VJOBS: 1
389399
VTEST_ONLY_FN: test_*
390-
run: v test gui/
400+
run: |
401+
$testFiles = @(git -C gui ls-files '*_test.v' | Sort-Object)
402+
Write-Host "Test files: $($testFiles.Count)"
403+
for ($i = 0; $i -lt $testFiles.Count; $i++) {
404+
Write-Host ("[{0}/{1}] gui/{2}" -f ($i + 1), $testFiles.Count, $testFiles[$i])
405+
}
406+
v test gui/
391407
- name: Check compilation of examples
392408
if: github.event_name == 'pull_request'
393409
env:

_data_source_orm_test.v

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ fn test_grid_orm_data_source_mutate_create_update_delete() {
257257
mut source := GridOrmDataSource{
258258
columns: orm_test_columns()
259259
fetch_fn: orm_test_fetch_ok
260-
create_fn: fn (rows []gui.GridRow, _ &GridAbortSignal) ![]gui.GridRow {
260+
create_fn: fn (rows []GridRow, _ &GridAbortSignal) ![]GridRow {
261261
assert rows.len == 1
262262
return [
263263
GridRow{
@@ -266,7 +266,7 @@ fn test_grid_orm_data_source_mutate_create_update_delete() {
266266
},
267267
]
268268
}
269-
update_fn: fn (_ []gui.GridRow, edits []gui.GridCellEdit, _ &GridAbortSignal) ![]gui.GridRow {
269+
update_fn: fn (_ []GridRow, edits []GridCellEdit, _ &GridAbortSignal) ![]GridRow {
270270
assert edits.len == 1
271271
return [
272272
GridRow{
@@ -414,10 +414,10 @@ fn test_grid_orm_capabilities_with_mutation_fns() {
414414
mut source := GridOrmDataSource{
415415
columns: orm_test_columns()
416416
fetch_fn: orm_test_fetch_ok
417-
create_fn: fn (_ []gui.GridRow, _ &GridAbortSignal) ![]gui.GridRow {
417+
create_fn: fn (_ []GridRow, _ &GridAbortSignal) ![]GridRow {
418418
return []GridRow{}
419419
}
420-
update_fn: fn (_ []gui.GridRow, _ []gui.GridCellEdit, _ &GridAbortSignal) ![]gui.GridRow {
420+
update_fn: fn (_ []GridRow, _ []GridCellEdit, _ &GridAbortSignal) ![]GridRow {
421421
return []GridRow{}
422422
}
423423
delete_many_fn: fn (_ []string, _ &GridAbortSignal) ![]string {
@@ -474,7 +474,7 @@ fn test_grid_orm_data_source_mutate_honors_abort() {
474474
mut source := GridOrmDataSource{
475475
columns: orm_test_columns()
476476
fetch_fn: orm_test_fetch_ok
477-
create_fn: fn (_ []gui.GridRow, _ &GridAbortSignal) ![]gui.GridRow {
477+
create_fn: fn (_ []GridRow, _ &GridAbortSignal) ![]GridRow {
478478
return []GridRow{}
479479
}
480480
}
@@ -1018,7 +1018,7 @@ fn orm_test_columns() []GridOrmColumnSpec {
10181018
]
10191019
}
10201020

1021-
fn orm_test_rows(ids []string) []gui.GridRow {
1021+
fn orm_test_rows(ids []string) []GridRow {
10221022
mut rows := []GridRow{cap: ids.len}
10231023
for id in ids {
10241024
rows << GridRow{

_dock_layout_tree_test.v

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
module gui
2+
3+
fn dock_test_group(id string, panel_ids []string, selected_id string) &DockNode {
4+
return dock_panel_group(id, panel_ids, selected_id)
5+
}
6+
7+
fn dock_test_root() &DockNode {
8+
left := dock_test_group('left', ['left_a', 'left_b'], 'left_b')
9+
right := dock_test_group('right', ['right_a'], 'right_a')
10+
return dock_split('root', .horizontal, 0.35, left, right)
11+
}
12+
13+
fn dock_same_node(a &DockNode, b &DockNode) bool {
14+
return unsafe { a == b }
15+
}
16+
17+
fn test_dock_tree_remove_absent_panel_returns_same_root() {
18+
root := dock_test_root()
19+
same_root := dock_tree_remove_panel(root, 'missing')
20+
21+
assert dock_same_node(same_root, root)
22+
assert root.kind == .split
23+
assert root.first.panel_ids == ['left_a', 'left_b']
24+
assert root.first.selected_id == 'left_b'
25+
assert root.second.panel_ids == ['right_a']
26+
}
27+
28+
fn test_dock_tree_remove_selected_tab_selects_first_remaining_tab() {
29+
root := dock_test_root()
30+
new_root := dock_tree_remove_panel(root, 'left_b')
31+
32+
assert !dock_same_node(new_root, root)
33+
assert !dock_same_node(new_root.first, root.first)
34+
assert dock_same_node(new_root.second, root.second)
35+
assert new_root.first.panel_ids == ['left_a']
36+
assert new_root.first.selected_id == 'left_a'
37+
assert root.first.panel_ids == ['left_a', 'left_b']
38+
assert root.first.selected_id == 'left_b'
39+
}
40+
41+
fn test_dock_tree_remove_last_panel_collapses_split_to_sibling() {
42+
root := dock_test_root()
43+
new_root := dock_tree_remove_panel(root, 'right_a')
44+
45+
assert dock_same_node(new_root, root.first)
46+
assert new_root.id == 'left'
47+
assert new_root.panel_ids == ['left_a', 'left_b']
48+
}
49+
50+
fn test_dock_tree_add_tab_appends_and_selects_added_panel() {
51+
root := dock_test_root()
52+
new_root := dock_tree_add_tab(root, 'right', 'right_b')
53+
54+
assert !dock_same_node(new_root, root)
55+
assert dock_same_node(new_root.first, root.first)
56+
assert !dock_same_node(new_root.second, root.second)
57+
assert new_root.second.panel_ids == ['right_a', 'right_b']
58+
assert new_root.second.selected_id == 'right_b'
59+
assert root.second.panel_ids == ['right_a']
60+
assert root.second.selected_id == 'right_a'
61+
}
62+
63+
fn test_dock_tree_split_at_preserves_direction_and_child_ordering() {
64+
base := dock_test_group('target', ['existing'], 'existing')
65+
66+
left := dock_tree_split_at(base, 'target', 'new_left', .left)
67+
assert left.dir == .horizontal
68+
assert left.first.panel_ids == ['new_left']
69+
assert left.second.panel_ids == ['existing']
70+
71+
right := dock_tree_split_at(base, 'target', 'new_right', .right)
72+
assert right.dir == .horizontal
73+
assert right.first.panel_ids == ['existing']
74+
assert right.second.panel_ids == ['new_right']
75+
76+
top := dock_tree_split_at(base, 'target', 'new_top', .top)
77+
assert top.dir == .vertical
78+
assert top.first.panel_ids == ['new_top']
79+
assert top.second.panel_ids == ['existing']
80+
81+
bottom := dock_tree_split_at(base, 'target', 'new_bottom', .bottom)
82+
assert bottom.dir == .vertical
83+
assert bottom.first.panel_ids == ['existing']
84+
assert bottom.second.panel_ids == ['new_bottom']
85+
}
86+
87+
fn test_dock_tree_move_center_removes_then_adds_tab() {
88+
root := dock_test_root()
89+
new_root := dock_tree_move_panel(root, 'left_b', 'right', .center)
90+
91+
assert new_root.kind == .split
92+
assert new_root.first.panel_ids == ['left_a']
93+
assert new_root.first.selected_id == 'left_a'
94+
assert new_root.second.panel_ids == ['right_a', 'left_b']
95+
assert new_root.second.selected_id == 'left_b'
96+
assert root.first.panel_ids == ['left_a', 'left_b']
97+
assert root.second.panel_ids == ['right_a']
98+
}
99+
100+
fn test_dock_tree_move_window_edge_wraps_after_remove() {
101+
root := dock_test_root()
102+
new_root := dock_tree_move_panel(root, 'left_b', '', .window_right)
103+
104+
assert new_root.kind == .split
105+
assert new_root.dir == .horizontal
106+
assert new_root.ratio == f32(0.8)
107+
assert new_root.first.kind == .split
108+
assert new_root.first.first.panel_ids == ['left_a']
109+
assert new_root.first.second.panel_ids == ['right_a']
110+
assert new_root.second.panel_ids == ['left_b']
111+
assert new_root.second.selected_id == 'left_b'
112+
}
113+
114+
fn test_dock_tree_select_panel_noop_and_change_behavior() {
115+
root := dock_test_root()
116+
same_root := dock_tree_select_panel(root, 'left', 'left_b')
117+
new_root := dock_tree_select_panel(root, 'left', 'left_a')
118+
119+
assert dock_same_node(same_root, root)
120+
assert !dock_same_node(new_root, root)
121+
assert !dock_same_node(new_root.first, root.first)
122+
assert dock_same_node(new_root.second, root.second)
123+
assert new_root.first.panel_ids == ['left_a', 'left_b']
124+
assert new_root.first.selected_id == 'left_a'
125+
assert root.first.selected_id == 'left_b'
126+
}

_window_lifetime_test.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ fn lifetime_grid_columns() []GridColumnCfg {
274274
]
275275
}
276276

277-
fn lifetime_grid_rows() []gui.GridRow {
277+
fn lifetime_grid_rows() []GridRow {
278278
return [
279279
GridRow{
280280
id: 'row-1'
@@ -827,7 +827,7 @@ fn start_lifetime_capturing_crud_save(mut w Window, mut harness &LifetimeCrudSav
827827
on_crud_error: fn [payload, mut harness] (_ string, mut _ Event, mut _ Window) {
828828
harness.error_sum = payload[0] + payload[payload.len - 1]
829829
}
830-
on_rows_change: fn [payload, mut harness] (_ []gui.GridRow, mut _ Event, mut _ Window) {
830+
on_rows_change: fn [payload, mut harness] (_ []GridRow, mut _ Event, mut _ Window) {
831831
harness.rows_change_sum = payload[0] + payload[payload.len - 1]
832832
}
833833
selection: GridSelection{

animation.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ fn max_animation_refresh_kind(current AnimationRefreshKind, incoming AnimationRe
186186
return .none
187187
}
188188

189-
fn update_animate(mut an Animate, mut w Window, mut deferred []AnimationCallback) bool {
189+
fn update_animate(mut an Animate, mut _ Window, mut deferred []AnimationCallback) bool {
190190
if !an.stopped {
191191
if time.since(an.start) > an.delay {
192192
// Capture callback to call after lock release

animation_hero.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ fn capture_heroes_recursive(layout Layout, mut snapshots map[string]HeroSnapshot
158158
}
159159
}
160160

161-
fn update_hero_transition(mut ht HeroTransition, mut w Window, mut deferred []AnimationCallback) bool {
161+
fn update_hero_transition(mut ht HeroTransition, mut _ Window, mut deferred []AnimationCallback) bool {
162162
if ht.stopped {
163163
return false
164164
}

animation_keyframe.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn (_ KeyframeAnimation) refresh_kind() AnimationRefreshKind {
107107
return .layout
108108
}
109109

110-
fn update_keyframe(mut kf KeyframeAnimation, mut w Window, mut deferred []AnimationCallback) bool {
110+
fn update_keyframe(mut kf KeyframeAnimation, mut _ Window, mut deferred []AnimationCallback) bool {
111111
if kf.stopped {
112112
return false
113113
}

animation_layout.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn capture_recursive(layout Layout, mut snapshots map[string]LayoutSnapshot) {
162162
}
163163
}
164164

165-
fn update_layout_transition(mut lt LayoutTransition, mut w Window, mut deferred []AnimationCallback) bool {
165+
fn update_layout_transition(mut lt LayoutTransition, mut _ Window, mut deferred []AnimationCallback) bool {
166166
if lt.stopped {
167167
return false
168168
}

animation_spring.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub fn (mut s SpringAnimation) retarget(to f32) {
206206
s.stopped = false
207207
}
208208

209-
fn update_spring(mut sp SpringAnimation, mut w Window, dt f32, mut deferred []AnimationCallback) bool {
209+
fn update_spring(mut sp SpringAnimation, mut _ Window, dt f32, mut deferred []AnimationCallback) bool {
210210
if sp.stopped || sp.state.at_rest {
211211
return false
212212
}

animation_tween.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fn (_ TweenAnimation) refresh_kind() AnimationRefreshKind {
164164
return .layout
165165
}
166166

167-
fn update_tween(mut tw TweenAnimation, mut w Window, mut deferred []AnimationCallback) bool {
167+
fn update_tween(mut tw TweenAnimation, mut _ Window, mut deferred []AnimationCallback) bool {
168168
if tw.stopped {
169169
return false
170170
}

0 commit comments

Comments
 (0)