7788
This commit is contained in:
parent
a4bc5df080
commit
fdc3df0430
|
@ -62,6 +62,25 @@ fn move-cursor-down screen: (addr screen) {
|
|||
set-cursor-position screen, cursor-x, cursor-y
|
||||
}
|
||||
|
||||
fn move-cursor-to-start-of-next-line screen: (addr screen) {
|
||||
var dummy/eax: int <- copy 0
|
||||
var _height/ecx: int <- copy 0
|
||||
dummy, _height <- screen-size screen
|
||||
var limit/edx: int <- copy _height
|
||||
limit <- decrement
|
||||
var cursor-x/eax: int <- copy 0
|
||||
var cursor-y/ecx: int <- copy 0
|
||||
cursor-x, cursor-y <- cursor-position screen
|
||||
compare cursor-y, limit
|
||||
{
|
||||
break-if-<
|
||||
return
|
||||
}
|
||||
cursor-y <- increment
|
||||
cursor-x <- copy 0
|
||||
set-cursor-position screen, cursor-x, cursor-y
|
||||
}
|
||||
|
||||
fn draw-grapheme-at-cursor screen: (addr screen), g: grapheme, color: int, background-color: int {
|
||||
var cursor-x/eax: int <- copy 0
|
||||
var cursor-y/ecx: int <- copy 0
|
||||
|
|
|
@ -8,6 +8,7 @@ fn check-ints-equal _a: int, b: int, msg: (addr array byte) {
|
|||
return
|
||||
}
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
count-test-failure
|
||||
}
|
||||
|
||||
|
@ -24,6 +25,7 @@ fn check _a: boolean, msg: (addr array byte) {
|
|||
return
|
||||
}
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
count-test-failure
|
||||
}
|
||||
|
||||
|
@ -36,5 +38,6 @@ fn check-not _a: boolean, msg: (addr array byte) {
|
|||
return
|
||||
}
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, msg, 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
count-test-failure
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ fn check-screen-row-from screen-on-stack: (addr screen), x: int, y: int, expecte
|
|||
draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
|
||||
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
}
|
||||
idx <- increment
|
||||
increment x
|
||||
|
@ -119,6 +120,7 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
|
|||
draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
|
||||
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
}
|
||||
$check-screen-row-in-color-from:compare-colors: {
|
||||
var color/eax: int <- screen-color-at-idx screen, idx
|
||||
|
@ -142,6 +144,7 @@ fn check-screen-row-in-color-from screen-on-stack: (addr screen), fg: int, y: in
|
|||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, fg, 3/fg/cyan, 0/bg
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed color ", 3/fg/cyan, 0/bg
|
||||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, color, 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
}
|
||||
}
|
||||
idx <- increment
|
||||
|
@ -208,6 +211,8 @@ fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg:
|
|||
draw-grapheme-at-cursor 0/screen, g, 3/cyan, 0/bg
|
||||
move-cursor-rightward-and-downward 0/screen, 0/xmin, 0x80/xmax=screen-width
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "'", 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
break $check-screen-row-in-background-color-from:compare-graphemes
|
||||
}
|
||||
$check-screen-row-in-background-color-from:compare-background-colors: {
|
||||
var background-color/eax: int <- screen-background-color-at-idx screen, idx
|
||||
|
@ -231,6 +236,7 @@ fn check-screen-row-in-background-color-from screen-on-stack: (addr screen), bg:
|
|||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed background-color ", 3/fg/cyan, 0/bg
|
||||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, background-color, 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
}
|
||||
}
|
||||
idx <- increment
|
||||
|
@ -275,6 +281,7 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
|
|||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, y, 3/fg/cyan, 0/bg
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, ") to not be in background-color ", 3/fg/cyan, 0/bg
|
||||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
break $check-background-color-in-screen-row-from:compare-cells
|
||||
}
|
||||
# otherwise assert that background IS bg
|
||||
|
@ -290,6 +297,7 @@ fn check-background-color-in-screen-row-from screen-on-stack: (addr screen), bg:
|
|||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, bg, 3/fg/cyan, 0/bg
|
||||
draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " but observed background-color ", 3/fg/cyan, 0/bg
|
||||
draw-int32-hex-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, background-color, 3/fg/cyan, 0/bg
|
||||
move-cursor-to-start-of-next-line 0/screen
|
||||
}
|
||||
idx <- increment
|
||||
increment x
|
||||
|
|
Loading…
Reference in New Issue
Block a user