test-cleancode: check some of the examples too

pull/8553/head
Delyan Angelov 2021-02-04 17:34:49 +02:00
parent 3e4e0a35e3
commit 32cc95a340
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
8 changed files with 67 additions and 55 deletions

View File

@ -11,6 +11,9 @@ const (
'vlib/v', 'vlib/v',
'cmd/v', 'cmd/v',
'cmd/tools', 'cmd/tools',
'examples/2048',
'examples/tetris',
'examples/term.ui',
] ]
verify_known_failing_exceptions = []string{} verify_known_failing_exceptions = []string{}
vfmt_verify_list = [ vfmt_verify_list = [

View File

@ -66,7 +66,7 @@ const (
gx.rgb(237, 204, 97), /* 256 */ gx.rgb(237, 204, 97), /* 256 */
gx.rgb(237, 200, 80), /* 512 */ gx.rgb(237, 200, 80), /* 512 */
gx.rgb(237, 197, 63), /* 1024 */ gx.rgb(237, 197, 63), /* 1024 */
gx.rgb(237, 194, 46), /* 2048 */ gx.rgb(237, 194, 46),
] ]
}, },
&Theme{ &Theme{

View File

@ -88,11 +88,13 @@ fn event(e &tui.Event, x voidptr) {
} }
} }
mut app := &App{} fn main() {
app.tui = tui.init( mut app := &App{}
user_data: app app.tui = tui.init(
frame_fn: frame user_data: app
event_fn: event frame_fn: frame
hide_cursor: true event_fn: event
) hide_cursor: true
app.tui.run() ? )
app.tui.run() ?
}

View File

@ -31,15 +31,17 @@ fn event(e &tui.Event, x voidptr) {
} }
} }
mut app := &App{} fn main() {
app.tui = tui.init( mut app := &App{}
user_data: app app.tui = tui.init(
event_fn: event user_data: app
window_title: 'V term.ui event viewer' event_fn: event
hide_cursor: true window_title: 'V term.ui event viewer'
capture_events: true hide_cursor: true
frame_rate: 60 capture_events: true
use_alternate_buffer: false frame_rate: 60
) use_alternate_buffer: false
println('V term.ui event viewer (press `esc` to exit)\n\n') )
app.tui.run() ? println('V term.ui event viewer (press `esc` to exit)\n\n')
app.tui.run() ?
}

View File

@ -480,17 +480,18 @@ fn event(e &ui.Event, x voidptr) {
app.event(e) app.event(e)
} }
// main fn main() {
mut app := &App{} mut app := &App{}
app.tui = ui.init( app.tui = ui.init(
user_data: app user_data: app
init_fn: init init_fn: init
frame_fn: frame frame_fn: frame
cleanup_fn: cleanup cleanup_fn: cleanup
event_fn: event event_fn: event
fail_fn: fail fail_fn: fail
capture_events: true capture_events: true
hide_cursor: true hide_cursor: true
frame_rate: 60 frame_rate: 60
) )
app.tui.run() ? app.tui.run() ?
}

View File

@ -84,12 +84,14 @@ fn frame(x voidptr) {
app.redraw = false app.redraw = false
} }
mut app := &App{} fn main() {
app.tui = tui.init( mut app := &App{}
user_data: app app.tui = tui.init(
event_fn: event user_data: app
frame_fn: frame event_fn: event
hide_cursor: true frame_fn: frame
frame_rate: 60 hide_cursor: true
) frame_rate: 60
app.tui.run() ? )
app.tui.run() ?
}

View File

@ -460,13 +460,15 @@ fn (mut a App) draw_gameover() {
a.termui.draw_text(start_x, (a.height / 2) + 3 * block_size, ' ##### # # # # ###### ####### ## ###### # # ') a.termui.draw_text(start_x, (a.height / 2) + 3 * block_size, ' ##### # # # # ###### ####### ## ###### # # ')
} }
mut app := &App{} fn main() {
app.termui = termui.init( mut app := &App{}
user_data: app app.termui = termui.init(
event_fn: event user_data: app
frame_fn: frame event_fn: event
init_fn: init frame_fn: frame
hide_cursor: true init_fn: init
frame_rate: 10 hide_cursor: true
) frame_rate: 10
app.termui.run() ? )
app.termui.run() ?
}

View File

@ -61,7 +61,7 @@ const (
gx.rgb(255, 180, 31), /* orange long topleft */ gx.rgb(255, 180, 31), /* orange long topleft */
gx.rgb(33, 66, 255), /* blue long topright */ gx.rgb(33, 66, 255), /* blue long topright */
gx.rgb(74, 198, 255), /* lightblue longest */ gx.rgb(74, 198, 255), /* lightblue longest */
gx.rgb(0, 170, 170), /* unused ? */ gx.rgb(0, 170, 170),
] ]
background_color = gx.white background_color = gx.white
ui_color = gx.rgba(255, 0, 0, 210) ui_color = gx.rgba(255, 0, 0, 210)