diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-09-06 21:39:05 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-09-06 21:39:05 -0700 |
commit | eaf95be10124f2a6e264640a178b2afa7c495d3e (patch) | |
tree | 3e10faa639bd4252f2551e6a4597aa8ad2f95bb7 /405screen.mu | |
parent | 742bbf27f7ac4b001744b991ffbf95df84344886 (diff) | |
download | mu-eaf95be10124f2a6e264640a178b2afa7c495d3e.tar.gz |
6738
Diffstat (limited to '405screen.mu')
-rw-r--r-- | 405screen.mu | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/405screen.mu b/405screen.mu index 2693dd93..f3dbe4c7 100644 --- a/405screen.mu +++ b/405screen.mu @@ -414,9 +414,13 @@ $show-cursor:body: { # Mu doesn't have multi-line strings, so we provide functions for rows or portions of rows. # Tab characters (that translate into multiple screen cells) not supported. -fn check-screen-row screen-on-stack: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { +fn check-screen-row screen: (addr screen), row-idx: int, expected: (addr array byte), msg: (addr array byte) { + check-screen-row-from screen, row-idx, 1, expected, msg +} + +fn check-screen-row-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { var screen/esi: (addr screen) <- copy screen-on-stack - var idx/ecx: int <- screen-cell-index screen, row-idx, 1 + var idx/ecx: int <- screen-cell-index screen, row-idx, col-idx # compare 'expected' with the screen contents starting at 'idx', grapheme by grapheme var e: (stream byte 0x100) var e-addr/edx: (addr stream byte) <- address e @@ -446,9 +450,6 @@ fn check-screen-row screen-on-stack: (addr screen), row-idx: int, expected: (add } } -fn check-screen-row-from screen-on-stack: (addr screen), row-idx: int, col-idx: int, expected: (addr array byte), msg: (addr array byte) { -} - # various variants by screen-cell attribute; spaces in the 'expected' data should not match the attribute fn check-screen-row-in-color screen-on-stack: (addr screen), fg: color, row-idx: int, expected: (addr array byte), msg: (addr array byte) { @@ -616,6 +617,17 @@ fn test-move-cursor-row-too-large-saturates { check-screen-row screen, 5, " a", "F - test-move-cursor-row-too-large-saturates" } +fn test-check-screen-row-from { + var screen-on-stack: screen + var screen/esi: (addr screen) <- address screen-on-stack + initialize-screen screen, 5, 4 + move-cursor screen, 1, 4 + var c/eax: grapheme <- copy 0x61 # 'a' + print-grapheme screen, c + check-screen-row screen, 1, " a", "F - test-check-screen-row-from/baseline" + check-screen-row-from screen, 1, 4, "a", "F - test-check-screen-row-from" +} + fn main -> exit-status/ebx: int { run-tests exit-status <- copy 0 |