# 1.6.0: the bookmarks panel and links. test/wine/edit_tests.sh starts it with a copy of test/toc.pdf open, the Recent
# list on and confirm_save=0, and puts plain (= sample.pdf, no bookmarks), remote (= tocremote.pdf) and broken
# (= tocbroken.pdf) copies next to it; @R = the run's suffix. Page points come from test/mksamples.py: contents line j of page 2 has its baseline at
# y = 110 + 26 j (clicks at x 150, y - 5); "4 Reference" j=8 -> 313, "1.2 Terms" j=2 (highlighted) -> 157,
# "2.1 Requirements" j=4 -> 209, the named destination -> 415, the web link -> 445.
wait 1500
echo --- 1. at start: panel closed, its button shown, Recent shown
state test/out/t28_01_start-@R.txt
echo --- 2. the button opens it: the PDF's tree as the PDF says (1 open, 2 + 4 closed), under the Recent list (1.6.1)
bm
wait 800
state test/out/t28_02_open-@R.txt
shotscreen test/out/t28_02_open-@R.png
echo --- 3. expand 2 Installation with its arrow
bmarrow 2 Installation
wait 300
state test/out/t28_03_expanded-@R.txt
echo --- 4. click 2.2 Steps: its heading at the top, highlighted, one Back step; a double-click on 1.1 Scope = one more step
bmrow 2.2 Steps
wait 800
state test/out/t28_04_jump-@R.txt
bmdbl 1.1 Scope
wait 800
state test/out/t28_04b_dbl-@R.txt
echo --- 5. page 21 (vim 21G): the highlight moves to chapter 3
type 21G
wait 500
state test/out/t28_05_ch3-@R.txt
echo --- 6. page 15, inside 2.2.1 (hidden under the closed 2.2): the highlight is on 2.2 Steps
type 15G
wait 500
state test/out/t28_06_hidden-@R.txt
echo --- 7. collapse 2 Installation: the highlight goes up to it
bmarrow 2 Installation
wait 300
state test/out/t28_07_collapsed-@R.txt
echo --- 8. a short window: the wheel over the panel scrolls the list, not the page
# Recent off for steps 8-8d (1.6.1: it stays above the panel), so the panel has the room it had in 1.6.0 and a strip
# under its last row for 8c
recentbtn
wait 300
resize 1000 420
wait 600
bmarrow 2 Installation
wait 300
state test/out/t28_08a_short-@R.txt
echo --- 8c. a click in the strip under the last row shown (more rows below it) does nothing
bmbelow
wait 600
state test/out/t28_08c_below-@R.txt
bmwheel -1
wait 300
state test/out/t28_08b_wheel-@R.txt
echo --- 8d. the window tall again: the list scrolls back so no row hides above
resize 1400 900
wait 600
state test/out/t28_08d_tall-@R.txt
recentbtn
wait 300
echo --- 9. the contents page: hover a link, click it, Alt+Left, Alt+Right, mouse back
type 2G
wait 500
phover 2 150 313
wait 200
state test/out/t28_09_hover-@R.txt
pclick 2 150 313
wait 700
state test/out/t28_10_link-@R.txt
key alt+left
wait 400
state test/out/t28_11_back-@R.txt
key alt+right
wait 400
state test/out/t28_12_forward-@R.txt
xbutton 1
wait 400
state test/out/t28_13_mouse_back-@R.txt
echo --- 10. the highlighted contents line (1.2 Terms): the link wins
pclick 2 150 157
wait 700
state test/out/t28_14_highlighted-@R.txt
key alt+left
wait 400
echo --- 11. double-click a link: one jump, no word selected
pdblclick 2 150 209
wait 900
state test/out/t28_15_dblclick-@R.txt
key alt+left
wait 400
echo --- 12. a drag across a link (inside the word Reference) selects text and does not jump
state test/out/t28_16a_before_drag-@R.txt
pdown 2 80 313
pmove 2 100 313
pmove 2 125 313
pup 2 125 313
wait 400
state test/out/t28_16b_drag-@R.txt
key esc
echo --- 13. the named-destination link; the web link does nothing
pclick 2 150 415
wait 700
state test/out/t28_17_named-@R.txt
key alt+left
wait 400
phover 2 150 445
wait 200
state test/out/t28_18_web_hover-@R.txt
pclick 2 150 445
wait 700
state test/out/t28_19_web_click-@R.txt
echo --- 14. with the edit column open, links are ignored (the column narrows the page: compare after it opened)
key ctrl+e
wait 500
state test/out/t28_20a_edit_open-@R.txt
pclick 2 150 313
wait 700
state test/out/t28_20b_edit_click-@R.txt
key ctrl+e
wait 300
echo --- 15. F4 closes/opens; Ctrl+B hides the column, F4 brings it back with the panel; no tooltip left behind
bmhover 3 Using
wait 300
state test/out/t28_21a_hover_long-@R.txt
key f4
wait 300
state test/out/t28_21_f4_closed-@R.txt
key f4
wait 600
state test/out/t28_22_f4_open-@R.txt
key ctrl+b
wait 300
state test/out/t28_23_hidden-@R.txt
key f4
wait 600
state test/out/t28_24_f4_column-@R.txt
echo --- 16. page edits with the panel open
echo --- 16a. delete page 6 (filler): targets move up a page; bookmark + link land; Back steps re-mapped
type 6G
wait 400
prclick 6 300 400
wait 300
key d
wait 1500
state test/out/t28_25_deleted-@R.txt
bmrow 4 Reference
wait 800
state test/out/t28_26_bm_after_delete-@R.txt
type 2G
wait 500
pclick 2 150 209
wait 800
state test/out/t28_27_link_after_delete-@R.txt
echo --- 16b. undo: page back, bookmark lands; Redo still works (the tree is not read again); undo again
key ctrl+z
wait 1500
bmrow 4 Reference
wait 800
state test/out/t28_28_undo-@R.txt
key ctrl+y
wait 1500
state test/out/t28_29_redo-@R.txt
key ctrl+z
wait 1500
echo --- 16c. delete page 30 (the target of 4 Reference): the bookmark is dimmed and does nothing; undo: works again
type 30G
wait 400
prclick 30 300 700
wait 300
key d
wait 1500
state test/out/t28_30a_target_gone-@R.txt
bmrow 4 Reference
wait 800
state test/out/t28_30b_click_gone-@R.txt
key ctrl+z
wait 1500
bmrow 4 Reference
wait 800
state test/out/t28_30c_back-@R.txt
echo --- 16d. turn page 30 clockwise: the bookmark still lands on page 30; undo
prclick 30 300 700
wait 300
key r
wait 1500
type 2G
wait 400
bmrow 4 Reference
wait 800
state test/out/t28_31_turned-@R.txt
key ctrl+z
wait 1500
echo --- 16e. the whole view turned 270 degrees (r three times): 4 Reference still lands on page 30; turned back
key r
wait 300
key r
wait 300
key r
wait 700
bmrow 4 Reference
wait 800
state test/out/t28_31b_view270-@R.txt
key r
wait 700
echo --- 17. a PDF without bookmarks; then back to the first tab (its tree, expand state, scroll)
state test/out/t28_32a_before_plain-@R.txt
setclip Z:\src\test\out\t28-@R-plain.pdf
key ctrl+shift+o
wait 500
key enter
wait 1500
state test/out/t28_32b_plain-@R.txt
shotscreen test/out/t28_32b_plain-@R.png
click 100 17
wait 700
state test/out/t28_32c_back_to_toc-@R.txt
echo --- 17b. bookmarks that point outside this PDF (another file's page 50, a web address with #page=3): shown with no
echo ---     page here and doing nothing; the other bookmarks work
setclip Z:\src\test\out\t28-@R-remote.pdf
key ctrl+shift+o
wait 500
key enter
wait 1500
state test/out/t28_32d_remote-@R.txt
bmrow 7 Web
wait 600
state test/out/t28_32e_remote_click-@R.txt
bmrow 4 Reference
wait 800
state test/out/t28_32f_remote_ok-@R.txt
click 100 17
wait 700
echo --- 18. a broken bookmark tree (MuPDF repairs it while reading it), read for the first time after an Undo:
echo ---     the Redo survives and nothing changes in the PDF
key f4
wait 300
setclip Z:\src\test\out\t28-@R-broken.pdf
key ctrl+shift+o
wait 500
key enter
wait 2000
pdown 3 60 170
pmove 3 200 170
pup 3 300 170
wait 400
mini 0
wait 800
state test/out/t28_33a_broken_marked-@R.txt
key ctrl+z
wait 800
state test/out/t28_33b_broken_undone-@R.txt
key f4
wait 1500
state test/out/t28_34_broken_read-@R.txt
key ctrl+y
wait 800
state test/out/t28_35a_broken_redone-@R.txt
key ctrl+z
wait 800
state test/out/t28_35b_broken_undone2-@R.txt
echo --- 19. Settings: "Always show bookmarks on the left" (S_SHOWBM = 17); then close everything
key f4
wait 300
key ctrl+comma
wait 600
sclick 17 0
wait 300
sclick 13 0
wait 300
state test/out/t28_36_setting-@R.txt
key ctrl+w
key n
key ctrl+w
key n
key ctrl+w
key n
key ctrl+w
key n
wait 500
quit
