1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
# testsuite_mouse_include section for BASIC256
# Modification History
# date programmer description
# 20140406 j.m.reneau made spots larger for android testing
# 20140530 j.m.reneau added mouseb statement test
# 20160908 j.m.reneau added doubleclick
# 20200331 J.M.RENEAU added escape for non 3 bottom mouses
currentsuite = "mouse"
# macos and android do not have 3 button mouses
rightbutton = ostype=ostype_windows or ostype=ostype_linux
centerbutton = ostype=ostype_windows or ostype=ostype_linux
clg
penwidth 1
color blue
rect 50,10,200,40
color red
rect 50,60,200,40
color green
rect 50,110,200,40
color yellow
rect 50,160,200,40
color black
circle 150,250,40
refresh
print "left click on the blue rectangle or tap escape"
clickclear
escaped = false
while clickb <> mousebutton_left and not escaped
if key = 16777216 then escaped = true
pause .01
end while
if not escaped then call n("left click blue",pixel(clickx, clicky),blue)
if rightbutton then
print "RIGHT click on the red rectangle or tap escape"
clickclear
escaped = false
while clickb <> mousebutton_right and not escaped
if key = 16777216 then escaped = true
pause .01
end while
if not escaped then call n("right click red",pixel(clickx, clicky),red)
endif
if centerbutton then
print "CENTER click on the GREEN rectangle or tap escape"
clickclear
escaped = false
while clickb <> mousebutton_center and not escaped
if key = 16777216 then escaped = true
pause .01
end while
if not escaped then call n("center click greend",pixel(clickx, clicky),green)
end if
print "DOUBLE left click on the yellow rectangle or tap escape"
clickclear
escaped = false
while clickb <> mousebutton_left + mousebutton_doubleclick and not escaped
if key = 16777216 then escaped = true
pause .01
end while
if not escaped then call n("left click yellow",pixel(clickx, clicky),yellow)
print "move mouse over black dot or tap escape"
while pixel(mousex, mousey)<> black and key <> 16777216
pause .01
end while
print "click right mouse button or tap escape"
escaped = false
a = msec
while mouseb <> mousebutton_right and not escaped
if key = 16777216 then escaped = true
pause .01
end while
if not escaped then
print (msec - a) + " you took ms to press the button"
a = msec
while mouseb = mousebutton_right
pause .01
end while
print (msec - a) + " you presss the button for ms"
end if
|