test: naming a point

[?]
Jun 15, 2022, 4:07 AM
42LVB4DEK3ILS3O5DHFMTJO5HNMJFDYA2WRCLUIOYFPA46MJFZTAC

Dependencies

  • [2] OWK3U6VD tests for drawing polygons
  • [3] BYG5CEMV support for naming points
  • [4] 2XLZCWZC bugfix: rectangles and squares are now saved
  • [5] RF5ALVNY allow the window to be resized
  • [6] DSLD74DK lots more tests
  • [7] F63Q4OV7 several bugfixes
  • [8] CRYGI3LR more drawing tests
  • [9] FEEGTRGQ bugfix: duplicate character on enter
  • [10] Z4KNS42N to open a file without a terminal, drag it on!
  • [11] AJB4LFRB try to maintain a reasonable line width
  • [*] OTIBCAUJ love2d scaffold
  • [*] HOSPP2AN crisp font rendering
  • [*] R6GUSTBY default font size and line-height
  • [*] K2X6G75Z start writing some tests for drawings
  • [*] BJ5X5O4A let's prevent the text cursor from ever getting on a drawing

Change contents

  • edit in main.lua at line 68
    [14.4161]
    [15.26]
    -- widest possible character width
    Em = App.newText(love.graphics.getFont(), 'm')
  • edit in main.lua at line 179
    [3.221]
    [3.221]
    Em = App.newText(love.graphics.getFont(), 'm')
  • edit in main.lua at line 182
    [3.288][3.288:337]()
    Em = App.newText(love.graphics.getFont(), 'm')
  • edit in drawing_tests.lua at line 324
    [2.9419]
    function test_name_point()
    io.write('\ntest_name_point')
    -- create a drawing with a line
    App.screen.init{width=Margin_left+300, height=300}
    Lines = load_array{'```lines', '```', ''}
    Line_width = 256 -- drawing coordinates 1:1 with pixels
    Current_drawing_mode = 'line'
    App.draw()
    -- draw a line
    App.run_after_mouse_press(Margin_left+5, Margin_top+Drawing_padding_top+6, 1)
    App.run_after_mouse_release(Margin_left+35, Margin_top+Drawing_padding_top+36, 1)
    local drawing = Lines[1]
    check_eq(#drawing.shapes, 1, 'F - test_name_point/baseline/#shapes')
    check_eq(#drawing.points, 2, 'F - test_name_point/baseline/#points')
    check_eq(drawing.shapes[1].mode, 'line', 'F - test_name_point/baseline/shape:1')
    local p1 = drawing.points[drawing.shapes[1].p1]
    local p2 = drawing.points[drawing.shapes[1].p2]
    check_eq(p1.x, 5, 'F - test_name_point/baseline/p1:x')
    check_eq(p1.y, 6, 'F - test_name_point/baseline/p1:y')
    check_eq(p2.x, 35, 'F - test_name_point/baseline/p2:x')
    check_eq(p2.y, 36, 'F - test_name_point/baseline/p2:y')
    check_nil(p2.name, 'F - test_name_point/baseline/p2:name')
    -- enter 'name' mode without moving the mouse
    App.run_after_keychord('C-n')
    check_eq(Current_drawing_mode, 'name', 'F - test_name_point/mode:1')
    App.run_after_textinput('A')
    check_eq(p2.name, 'A', 'F - test_name_point')
    -- still in 'name' mode
    check_eq(Current_drawing_mode, 'name', 'F - test_name_point/mode:2')
    -- exit 'name' mode
    App.run_after_keychord('return')
    check_eq(Current_drawing_mode, 'line', 'F - test_name_point/mode:3')
    check_eq(p2.name, 'A', 'F - test_name_point')
    end
  • edit in Manual_tests.md at line 17
    [3.90][3.30:59]()
    select a point and name it