Commit Graph

60 Commits (d04beb0e4a9b903fce241f15f2f1264701fc99a2)

Author SHA1 Message Date
Myk ad2d9cad03
[lua] implement keyboard focus subsystem (#2160)
* implement keyboard focus subsystem

* Fix error in focus group combining

* documentation for the inputToSubviews decision

* modify unit tests to catch that last bug
2022-06-01 17:42:13 -07:00
Timur Kelman 07f54deb0b
fix wrong `Label.frame_body.x2` value (#2134)
* fix wrong `Label.frame_body.x2` value

`update_scroll_inset` might change `frame_inset`, i.e. we need to `computeFrame` with the new values.

* add tests for Label

* add missing `local`, remove code in comments

* move `TestFramedScreen` outside test functions
2022-05-27 15:25:17 -07:00
lethosor 888c531774
Add mock.observe_func(), improve mock.lua documentation
observe_func() is similar to func() but passes through all calls to a specified
function.
2022-05-27 00:33:44 -04:00
myk002 53609db1f9 let CycleHotkeyLabels take numeric initial_options
even if all of the option values are non-numeric
2022-05-18 15:39:52 -07:00
myk002 af47434f52
protect against 0 width in string:wrap() 2022-04-29 11:29:19 -07:00
lethosor d1f0edd33b
Apply initial pre-commit config 2022-04-12 14:48:19 -04:00
Myk 4f9608da13
Document and update argparse module (#2089)
also add unit tests and use new string fns in processArgs and allow it to recognize parameters with two dashes instead of just one
2022-04-11 16:16:55 -07:00
Myk 96b5b4420b
Add string:escape_pattern() utility function (#2082)
* add string:escape_pattern() to dfhack.lua

stolen from devel/query.lua. will migrate scripts to use the common implementation later
2022-04-10 21:18:01 -07:00
myk002 ecdfca89d1 support nil to indicate no short param name 2021-09-25 22:00:49 -07:00
myk002 fc556c9e5d implement non-alias long form params
now long form parameters can exist by themselves without being an alias
for a required equivalent short form param
2021-09-25 22:00:49 -07:00
lethosor d5be63823d
Merge remote-tracking branch 'TymurGubayev/patch-1' into develop 2021-08-31 00:55:36 -04:00
myk002 39a8f2c799 migrate existing tests to use expect.str_find() 2021-08-25 06:38:22 -07:00
myk002 9168f9359d
name test method the same as the method under test 2021-08-24 21:29:32 -07:00
myk002 691e54dfc6
rename expect.find to expect.str_find 2021-08-24 21:06:12 -07:00
myk002 b2f44f00f1
add pattern matching expect.find() for unit tests
settled on `find()` since the string method of the same name has the
same semantics. other options: `str_find()` since it fails on non-string
or `match()` (but that might imply that the pattern needs to match the
entire string).
2021-08-23 22:59:30 -07:00
lethosor 3a27a5d6a0
Allow dialog tests to run outside of fortress mode 2021-08-22 17:45:45 -04:00
myk002 86b2329b7f
fix hardcoded call to pairs, add test 2021-08-20 22:55:07 -07:00
myk002 119595dcaf
use df.item._identity to test noniterable userdata 2021-08-19 21:57:16 -07:00
myk002 0f0ae156c3
test printall_recurse 2021-08-19 21:57:16 -07:00
myk002 c5bb139282
unit test with userdata 2021-08-19 21:57:16 -07:00
myk002 d9c6c2dde3
add safe_pairs, update unit tests 2021-08-19 21:57:16 -07:00
myk002 3f2795e80a
unit tests first draft 2021-08-19 21:56:44 -07:00
Timur Kelman 4c2473de92
add test.ListBox_with_multi_select_and_visual_indicator
this test also demonstrates actual (minimal) example usage
2021-07-31 11:46:59 +02:00
Timur Kelman 4bf8b6daab
fix tabs and whitespaces 2021-07-30 23:23:58 +02:00
Timur Kelman 70d088c763
add tests for dialog.lua 2021-07-30 23:21:35 +02:00
lethosor 1014c41db6
Add context to some loops in tests 2021-07-05 20:49:25 -04:00
myk002 f1bcf0c7b5
make dwarfmode test not require autocorrection 2021-07-05 16:05:12 -07:00
myk002 4eb8870797
add unit tests 2021-07-05 16:02:19 -07:00
myk002 0ef5134a33
add optional coordinate validation to coords 2021-07-04 07:32:29 -07:00
myk002 56a1c8b4d5
coordinates can be 0 2021-07-03 16:26:39 -07:00
myk002 aefb893daa
remove redundant tests 2021-07-02 23:29:02 -07:00
myk002 9535ff82bb
add argparse library functions 2021-07-02 23:11:17 -07:00
lethosor f9627a0cfb
Add another split() test for pattern delimiters 2021-07-03 00:33:28 -04:00
lethosor da3b522061
Enable string.split() tests
Ref #1888 (step 4)
2021-07-03 00:31:19 -04:00
myk002 36b2d05ff6
add dfhack string functions and tests
added string:split
added string:trim
added a default value for wrap width
added function comments
added tests for all string functions (the tests for string:split will be commented out until we remove the competing implementation in gui/load-screen
2021-07-02 13:21:54 -07:00
myk002 eafa6e86f7
add utils.normalizePath() 2021-06-29 12:22:05 -07:00
lethosor e070f4d9d8
Merge remote-tracking branch 'myk002/myk_sidebar' into develop 2021-06-28 01:03:13 -04:00
lethosor 4945018e92
Merge remote-tracking branch 'myk002/myk_multi_mock' into develop 2021-06-25 01:27:46 -04:00
lethosor 0297a5b1b8
Check some more cases, especially empty strings 2021-06-24 00:42:50 -04:00
myk002 5b12c64cba
add new string function: wrap()
refactored and improved from the implementation in quickfort's dialog.lua
2021-06-23 13:59:39 -07:00
myk002 000b589e3a
add dwarfmode library function: enterSidebarMode()
refactored from quickfort. this common implementation will replace the
now redundant functions in quickfort, gui/mass-remove, and gui/blueprint
2021-06-23 12:29:37 -07:00
myk002 b7a970a309
allow mock.func() to return multiple values 2021-06-15 13:16:05 -07:00
myk002 59b08e99f6
fix -- handling and required arg detection 2021-05-07 15:21:45 -07:00
myk002 fd735d4b42
treat negative numbers as non-options in getopt 2021-05-07 15:21:45 -07:00
lethosor 403f822520
Add tests for patch() where patching raises an error 2021-04-17 00:59:56 -04:00
lethosor ee8e10429d
Add initial implementation of mock.restore()
Like mock.patch() but only restores original values instead of also setting
new values initially.
2021-04-16 00:34:46 -04:00
lethosor 757736728d
Add a mock.func() helper for mocking functions 2021-04-10 01:22:03 -04:00
lethosor 5424392273
mock.patch(): propagate return values 2021-04-09 00:41:39 -04:00
lethosor f25b8a0d14
Fix patching value with nil 2021-04-09 00:35:54 -04:00
lethosor 7b2f01d45b
Add initial mock.patch() implementation for tests 2021-04-09 00:32:10 -04:00