about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-11 00:40:07 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-11 00:40:07 -0700
commit3a4be20aba860bb62db3271b8e157bcc807514b0 (patch)
treea68ae1e42168040615addd54032a7f2454fa190a /apps
parent13cbff7589c95a21bf69bc93dbe605db063087bc (diff)
downloadmu-3a4be20aba860bb62db3271b8e157bcc807514b0.tar.gz
6773 - markdown browser now seems fully tested
Diffstat (limited to 'apps')
-rw-r--r--apps/browse/main.mu56
1 files changed, 56 insertions, 0 deletions
diff --git a/apps/browse/main.mu b/apps/browse/main.mu
index 956dc4aa..22bd73ae 100644
--- a/apps/browse/main.mu
+++ b/apps/browse/main.mu
@@ -98,6 +98,62 @@ fn test-render-heading-text {
   check-screen-row          screen,       4, " def  ", "F - test-render-heading-text/row4"
 }
 
+fn test-render-bold-text {
+  # input text
+  var input-storage: (handle buffered-file)
+  var input-ah/eax: (addr handle buffered-file) <- address input-storage
+  populate-buffered-file-containing "a *b* c", input-ah
+  var in/eax: (addr buffered-file) <- lookup input-storage
+  # output screen
+  var pg: paginated-screen
+  var pg-addr/ecx: (addr paginated-screen) <- address pg
+  initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1  # 6 columns, single page
+  #
+  render pg-addr, in
+  var screen-ah/eax: (addr handle screen) <- get pg, screen
+  var screen/eax: (addr screen) <- lookup *screen-ah
+  check-screen-row         screen, 2, " a b c", "F - test-render-bold-text/text"
+  check-screen-row-in-bold screen, 2, "   b  ", "F - test-render-bold-text/bold"
+}
+
+# terminals don't always support italics, so we'll just always render italics
+# as bold.
+fn test-render-pseudoitalic-text {
+  # input text
+  var input-storage: (handle buffered-file)
+  var input-ah/eax: (addr handle buffered-file) <- address input-storage
+  populate-buffered-file-containing "a _b_ c", input-ah
+  var in/eax: (addr buffered-file) <- lookup input-storage
+  # output screen
+  var pg: paginated-screen
+  var pg-addr/ecx: (addr paginated-screen) <- address pg
+  initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1  # 6 columns, single page
+  #
+  render pg-addr, in
+  var screen-ah/eax: (addr handle screen) <- get pg, screen
+  var screen/eax: (addr screen) <- lookup *screen-ah
+  check-screen-row         screen, 2, " a b c", "F - test-render-pseudoitalic-text/text"
+  check-screen-row-in-bold screen, 2, "   b  ", "F - test-render-pseudoitalic-text/bold"
+}
+
+fn test-render-asterisk-in-text {
+  # input text
+  var input-storage: (handle buffered-file)
+  var input-ah/eax: (addr handle buffered-file) <- address input-storage
+  populate-buffered-file-containing "a*b*c", input-ah
+  var in/eax: (addr buffered-file) <- lookup input-storage
+  # output screen
+  var pg: paginated-screen
+  var pg-addr/ecx: (addr paginated-screen) <- address pg
+  initialize-fake-paginated-screen pg-addr, 8, 6, 5, 1, 1  # 6 columns, single page
+  #
+  render pg-addr, in
+  var screen-ah/eax: (addr handle screen) <- get pg, screen
+  var screen/eax: (addr screen) <- lookup *screen-ah
+  check-screen-row         screen, 2, " a*b*c", "F - test-render-bold-text/text"
+  check-screen-row-in-bold screen, 2, "      ", "F - test-render-bold-text/bold"
+}
+
 fn render-normal screen: (addr paginated-screen), fs: (addr buffered-file) {
   var newline-seen?/esi: boolean <- copy 0  # false
   var start-of-paragraph?/edi: boolean <- copy 1  # true