diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 74d193025..e1b71d186 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -992,7 +992,7 @@ function Scrollbar:onInput(keys) return false end - if self.parent_view:getMousePos() then + if self.parent_view and self.parent_view:getMousePos() then if keys.CONTEXT_SCROLL_UP then self.on_scroll('up_small') return true diff --git a/library/lua/helpdb.lua b/library/lua/helpdb.lua index 4ce078a22..a4e75ff0c 100644 --- a/library/lua/helpdb.lua +++ b/library/lua/helpdb.lua @@ -789,7 +789,7 @@ function ls(filter_str, skip_tags, show_dev_commands, exclude_strs) end if not show_dev_commands then local dev_tags = {'dev', 'unavailable'} - if dfhack.getHideArmokTools() then + if filter_str ~= 'armok' and dfhack.getHideArmokTools() then table.insert(dev_tags, 'armok') end table.insert(excludes, {tag=dev_tags}) diff --git a/test/library/argparse.lua b/test/library/argparse.lua index 5e85e6465..33891a834 100644 --- a/test/library/argparse.lua +++ b/test/library/argparse.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local argparse = require('argparse') local guidm = require('gui.dwarfmode') diff --git a/test/library/gui.lua b/test/library/gui.lua index fe04614d6..af8b15b6d 100644 --- a/test/library/gui.lua +++ b/test/library/gui.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local gui = require('gui') function test.getKeyDisplay() @@ -10,6 +12,7 @@ end function test.clear_pen() expect.table_eq(gui.CLEAR_PEN, { + tile = df.global.init.texpos_border_interior, ch = string.byte(' '), fg = COLOR_BLACK, bg = COLOR_BLACK, diff --git a/test/library/gui/dialogs.lua b/test/library/gui/dialogs.lua index 0d3724c2e..4ee16027e 100644 --- a/test/library/gui/dialogs.lua +++ b/test/library/gui/dialogs.lua @@ -1,3 +1,5 @@ +--config.targets = 'core' + local gui = require('gui') local function send_keys(...) local keys = {...} diff --git a/test/library/gui/widgets.EditField.lua b/test/library/gui/widgets.EditField.lua index 23558987b..eb35bb22c 100644 --- a/test/library/gui/widgets.EditField.lua +++ b/test/library/gui/widgets.EditField.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local widgets = require('gui.widgets') function test.editfield_cursor() @@ -20,18 +22,18 @@ function test.editfield_cursor() expect.eq('ones two threes', e.text) expect.eq(5, e.cursor) - e:onInput{CURSOR_LEFT=true} + e:onInput{KEYBOARD_CURSOR_LEFT=true} expect.eq(4, e.cursor) - e:onInput{CURSOR_RIGHT=true} + e:onInput{KEYBOARD_CURSOR_RIGHT=true} expect.eq(5, e.cursor) - e:onInput{A_CARE_MOVE_W=true} - expect.eq(1, e.cursor, 'interpret alt-left as home') - e:onInput{A_MOVE_E_DOWN=true} - expect.eq(6, e.cursor, 'interpret ctrl-right as goto beginning of next word') - e:onInput{A_CARE_MOVE_E=true} - expect.eq(16, e.cursor, 'interpret alt-right as end') - e:onInput{A_MOVE_W_DOWN=true} - expect.eq(9, e.cursor, 'interpret ctrl-left as goto end of previous word') + -- e:onInput{A_CARE_MOVE_W=true} + -- expect.eq(1, e.cursor, 'interpret alt-left as home') -- uncomment when we have a home key + e:onInput{CUSTOM_CTRL_F=true} + expect.eq(6, e.cursor, 'interpret Ctrl-f as goto beginning of next word') + e:onInput{CUSTOM_CTRL_E=true} + expect.eq(16, e.cursor, 'interpret Ctrl-e as end') + e:onInput{CUSTOM_CTRL_B=true} + expect.eq(9, e.cursor, 'interpret Ctrl-b as goto end of previous word') end function test.editfield_click() diff --git a/test/library/gui/widgets.Label.lua b/test/library/gui/widgets.Label.lua index 4693d3d0d..bb6e06235 100644 --- a/test/library/gui/widgets.Label.lua +++ b/test/library/gui/widgets.Label.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local gui = require('gui') local widgets = require('gui.widgets') diff --git a/test/library/gui/widgets.Scrollbar.lua b/test/library/gui/widgets.Scrollbar.lua index dbe033ba4..d1024a1cf 100644 --- a/test/library/gui/widgets.Scrollbar.lua +++ b/test/library/gui/widgets.Scrollbar.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local gui = require('gui') local widgets = require('gui.widgets') @@ -10,7 +12,7 @@ function test.update() expect.eq(1, s.elems_per_page) expect.eq(1, s.num_elems) expect.eq(0, s.bar_offset) - expect.eq(1, s.bar_height) + expect.eq(2, s.bar_height) -- top_elem, elems_per_page, num_elems s:update(1, 10, 0) @@ -18,7 +20,7 @@ function test.update() expect.eq(10, s.elems_per_page) expect.eq(0, s.num_elems) expect.eq(0, s.bar_offset) - expect.eq(1, s.bar_height) + expect.eq(2, s.bar_height) -- first 10 of 50 shown s:update(1, 10, 50) diff --git a/test/library/gui/widgets.lua b/test/library/gui/widgets.lua index 51622e691..8f58076e6 100644 --- a/test/library/gui/widgets.lua +++ b/test/library/gui/widgets.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local widgets = require('gui.widgets') function test.hotkeylabel_click() diff --git a/test/library/helpdb.lua b/test/library/helpdb.lua index 1f1e58ba9..29bc14f41 100644 --- a/test/library/helpdb.lua +++ b/test/library/helpdb.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local h = require('helpdb') local mock_plugin_db = { diff --git a/test/library/misc.lua b/test/library/misc.lua index e746ec1a6..dd1dae2c6 100644 --- a/test/library/misc.lua +++ b/test/library/misc.lua @@ -1,5 +1,7 @@ -- tests misc functions added by dfhack.lua +config.targets = 'core' + function test.safe_pairs() for k,v in safe_pairs(nil) do expect.fail('nil should not be iterable') diff --git a/test/library/print.lua b/test/library/print.lua index 3f9b5a78c..3a839168e 100644 --- a/test/library/print.lua +++ b/test/library/print.lua @@ -1,5 +1,7 @@ -- tests print-related functions added by dfhack.lua +config.targets = 'core' + local dfhack = dfhack local mock_print = mock.func() diff --git a/test/library/string.lua b/test/library/string.lua index d22f262bf..8854fa21c 100644 --- a/test/library/string.lua +++ b/test/library/string.lua @@ -1,5 +1,7 @@ -- tests string functions added by dfhack.lua +config.targets = 'core' + function test.startswith() expect.true_(('abcd'):startswith('')) expect.true_(('abcd'):startswith('abc')) diff --git a/test/library/test_util/expect_unit.lua b/test/library/test_util/expect_unit.lua index 1c3bd51e8..7f1fa3146 100644 --- a/test/library/test_util/expect_unit.lua +++ b/test/library/test_util/expect_unit.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local expect_raw = require('test_util.expect') function test.str_find() diff --git a/test/library/test_util/mock.lua b/test/library/test_util/mock.lua index 1031a496a..93c24e160 100644 --- a/test/library/test_util/mock.lua +++ b/test/library/test_util/mock.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local mock = require('test_util.mock') local test_table = { diff --git a/test/library/utils.lua b/test/library/utils.lua index cf2024618..c33e53a7f 100644 --- a/test/library/utils.lua +++ b/test/library/utils.lua @@ -1,3 +1,5 @@ +config.targets = 'core' + local utils = require 'utils' function test.OrderedTable() @@ -102,7 +104,7 @@ function test.df_expr_to_ref() expect.eq(df.reinterpret_cast(df.world, utils.df_expr_to_ref('unit[0]').value), df.global.world) expect.eq(utils.df_expr_to_ref('unit[1]'), utils.df_expr_to_ref('unit.1')) - expect.eq(df.reinterpret_cast(df.ui, utils.df_expr_to_ref('unit[1]').value), df.global.plotinfo) + expect.eq(df.reinterpret_cast(df.plotinfost, utils.df_expr_to_ref('unit[1]').value), df.global.plotinfo) expect.error_match('index out of bounds', function() utils.df_expr_to_ref('unit.2') end) expect.error_match('index out of bounds', function() utils.df_expr_to_ref('unit[2]') end) diff --git a/test/structures/misc.lua b/test/structures/misc.lua index 277457dfe..ebfe8edd4 100644 --- a/test/structures/misc.lua +++ b/test/structures/misc.lua @@ -1,8 +1,9 @@ -config.targets = 'core' +-- TODO: fix crash in test.viewscreenDtors with viewscreen_legendsst +--config.targets = 'core' function test.overlappingGlobals() local globals = {} - for name, _ in pairs(df.global) do + for name in pairs(df.global) do local gvar = df.global:_field(name) local size, addr = gvar:sizeof() table.insert(globals, {