diff options
Diffstat (limited to 'contrib/luacurses/test')
-rw-r--r-- | contrib/luacurses/test/filter.lua | 49 | ||||
-rw-r--r-- | contrib/luacurses/test/getnstr.lua | 12 | ||||
-rw-r--r-- | contrib/luacurses/test/getyx.lua | 13 | ||||
-rw-r--r-- | contrib/luacurses/test/hello.lua | 20 | ||||
-rw-r--r-- | contrib/luacurses/test/mouse.lua | 54 | ||||
-rw-r--r-- | contrib/luacurses/test/pair.lua | 18 | ||||
-rw-r--r-- | contrib/luacurses/test/rain.lua | 89 |
7 files changed, 0 insertions, 255 deletions
diff --git a/contrib/luacurses/test/filter.lua b/contrib/luacurses/test/filter.lua deleted file mode 100644 index f8f6ef5824..0000000000 --- a/contrib/luacurses/test/filter.lua +++ /dev/null @@ -1,49 +0,0 @@ - -require("curses"); - -function read_cmd() - curses.attron(curses.A_BOLD); - curses.addstr("Command: "); - curses.attron(underline); - local s = ""; - while (true) do - local c = string.char(curses.getch()); - if (c == '\n') then break; end - s = s .. c; - end - curses.attroff(underline); - curses.attroff(curses.A_BOLD); - curses.addch("\n"); - - return s; -end - - -curses.filter(); -curses.initscr(); -curses.cbreak(); -curses.keypad(curses.stdscr(), TRUE); - -if (curses.has_colors()) then - curses.start_color(); - curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK); - underline = curses.COLOR_PAIR(1); -else - underline = curses.A_UNDERLINE; -end - -while (true) do - local s = read_cmd(); - if (s == "exit") then break; end - curses.reset_shell_mode(); - io.write("\n"); - io.flush(io.stdout); - os.execute(s); - curses.reset_prog_mode(); - curses.touchwin(curses.stdscr()); - curses.erase(); - curses.refresh(); -end - -curses.endwin(); - diff --git a/contrib/luacurses/test/getnstr.lua b/contrib/luacurses/test/getnstr.lua deleted file mode 100644 index 172365ea90..0000000000 --- a/contrib/luacurses/test/getnstr.lua +++ /dev/null @@ -1,12 +0,0 @@ - -require("curses"); - -curses.initscr(); - -curses.keypad(curses.stdscr(), true); -s = curses.mvgetnstr(10, 10, 10); -curses.addstr(s); -curses.getch(); - -curses.endwin(); - diff --git a/contrib/luacurses/test/getyx.lua b/contrib/luacurses/test/getyx.lua deleted file mode 100644 index 4600236bb1..0000000000 --- a/contrib/luacurses/test/getyx.lua +++ /dev/null @@ -1,13 +0,0 @@ - -require("curses"); - -curses.initscr(); -while (true) do - local s = curses.getnstr(1000); - curses.addstr(s); - curses.addstr(":" .. table.concat({curses.getyx(curses.stdscr())}, ' ') .. "\n"); - if (s == "exit") then break; end -end - -curses.endwin(); - diff --git a/contrib/luacurses/test/hello.lua b/contrib/luacurses/test/hello.lua deleted file mode 100644 index 6a1d28a216..0000000000 --- a/contrib/luacurses/test/hello.lua +++ /dev/null @@ -1,20 +0,0 @@ - -require("curses"); - -function show_message(message) - local width = string.len(message) + 6; - win = curses.newwin(5, width, (curses.LINES() - 5) / 2, (curses.COLS() - width) / 2); - win:box('|', '-'); - win:mvaddstr(2, 3, message); - win:getch(); - win:delwin(); -end - -curses.initscr(); -curses.cbreak(); -curses.mvaddstr((curses.LINES() - 5) / 2, (curses.COLS() - 10) / 2, "Hit any key"); -curses.getch(); -show_message("Hello, World!") - -curses.endwin(); - diff --git a/contrib/luacurses/test/mouse.lua b/contrib/luacurses/test/mouse.lua deleted file mode 100644 index 0129cd8c42..0000000000 --- a/contrib/luacurses/test/mouse.lua +++ /dev/null @@ -1,54 +0,0 @@ - -require("curses"); - -function show_message(m) - local width = string.len(m) + 6; - local win = curses.newwin(5, width, (lines - 5) / 2, (cols - width) / 2); - win:keypad(true); - win:attron(curses.COLOR_PAIR(curses.COLOR_RED)); - win:box('|', '-', '+'); - win:mvaddstr(2, 3, m); - win:refresh(); - win:getch(); - win:delwin(); -end - -curses.initscr(); -curses.start_color(); -curses.init_pair(curses.COLOR_BLUE, curses.COLOR_BLUE, curses.COLOR_WHITE); -curses.init_pair(curses.COLOR_RED, curses.COLOR_RED, curses.COLOR_WHITE); -curses.cbreak(); -curses.noecho(); -curses.keypad(curses.stdscr(), true); - -lines = curses.LINES(); -cols = curses.COLS(); - -mmasks = -{ - curses.BUTTON1_CLICKED, - curses.BUTTON2_CLICKED, - curses.BUTTON3_CLICKED, - curses.BUTTON4_CLICKED -}; - -table.foreachi(mmasks, function(_i, _m) curses.addmousemask(_m) end); -curses.attron(curses.COLOR_PAIR(curses.COLOR_BLUE)); -curses.attron(curses.A_BOLD); -curses.mvaddstr((lines - 5) / 2, (cols - 10) / 2, "click"); - -curses.refresh(); -while(true) do - local c = curses.getch(); - if (c == curses.KEY_MOUSE) then - local r, id, x, y, z, bstate = curses.getmouse(); - if (r) then - show_message("id = " .. id .. ", x = " .. x .. ", y = " .. y .. ", z = " .. z .. ", bstate = " .. - string.format("0x%x", bstate)); - end - break; - end -end - -curses.endwin(); - diff --git a/contrib/luacurses/test/pair.lua b/contrib/luacurses/test/pair.lua deleted file mode 100644 index f269800613..0000000000 --- a/contrib/luacurses/test/pair.lua +++ /dev/null @@ -1,18 +0,0 @@ - -require("curses"); - -curses.initscr(); - -curses.start_color(); -curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_YELLOW); -curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_RED); - -for i = 1, 2 do - local r, f, b = curses.pair_content(i); - curses.attrset(curses.COLOR_PAIR(i)); - curses.addstr(f .. ", " .. b .. "\n"); -end - -curses.getch(); -curses.endwin(); - diff --git a/contrib/luacurses/test/rain.lua b/contrib/luacurses/test/rain.lua deleted file mode 100644 index 35e4691021..0000000000 --- a/contrib/luacurses/test/rain.lua +++ /dev/null @@ -1,89 +0,0 @@ - -require("curses"); - -curses.initscr(); -curses.nl(); -curses.noecho(); - - -if (curses.has_colors()) then - curses.start_color(); - curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_BLACK); - curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK); -end - -curses.curs_set(0); -curses.timeout(0); - -math.randomseed(os.time()); - -lines = curses.LINES(); -cols = curses.COLS(); - -xpos = {}; -ypos = {}; -r = lines - 4; -c = cols - 4; -for i = 0, 4 do - xpos[i] = c * math.random() + 2; - ypos[i] = r * math.random() + 2; -end - -function dec(i, max) - if (curses.has_colors()) then - local z = 3 * math.random(); - local c = curses.COLOR_PAIR(z); - curses.attrset(c); - if (math.floor(z) > 0) then - curses.attron(curses.A_BOLD); - end - end - - if (i > 0) then return i - 1; - else return max; - end -end - -i = 0; -while(true) do - x = c * math.random() + 2; - y = r * math.random() + 2; - - curses.mvaddstr(y, x, "."); - - curses.mvaddstr(ypos[i], xpos[i], "o"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i], xpos[i], "O"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i] - 1, xpos[i], "-"); - curses.mvaddstr(ypos[i], xpos[i] - 1, "|.|"); - curses.mvaddstr(ypos[i] + 1, xpos[i], "-"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i] - 2, xpos[i], "-"); - curses.mvaddstr(ypos[i] - 1, xpos[i] - 1, "/ \\"); - curses.mvaddstr(ypos[i], xpos[i] - 2, "| O |"); - curses.mvaddstr(ypos[i] + 1, xpos[i] - 1, "\\ /"); - curses.mvaddstr(ypos[i] + 2, xpos[i], "-"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i] - 2, xpos[i], " "); - curses.mvaddstr(ypos[i] - 1, xpos[i] - 1, " "); - curses.mvaddstr(ypos[i], xpos[i] - 2, " "); - curses.mvaddstr(ypos[i] + 1, xpos[i] - 1, " "); - curses.mvaddstr(ypos[i] + 2, xpos[i], " "); - - - xpos[i] = x; - ypos[i] = y; - - local ch = curses.getch(); - if (ch == string.byte('q', 1)) or (ch == string.byte('Q', 1)) then break; end - curses.refresh(); - curses.napms(50); -end - -curses.endwin(); - |