yjftsjthsd-g / keynav

retire your mouse.
Other
18 stars 3 forks source link

Automated testing #7

Open yjftsjthsd-g opened 7 years ago

yjftsjthsd-g commented 7 years ago

It would be quite nice if we could automatically test keynav, mostly so we can make changes and make sure something didn't break. This is a little annoying because it's an X11 program that has nearly no GUI:)

Rough plan:

Of course, once that's working someone will have to actually figure out what to test:)

yjftsjthsd-g commented 7 years ago

Okay, I played around a bit, and I think the above plan can work. Here's some code:)

Start the X server: Xvfb :1 -fbdir $PWD/framebuffers (fbdir is optional, but will let you grab screenshots, which makes it easier to figure out what's going on) Start keynav: DISPLAY=:1 ./keynav Simulate keystrokes to control keynav: DISPLAY=:1 xdotool key ctrl+space j l h k space Check current cursor location: DISPLAY=:1 xdotool getmouselocation Watch X events: DISPLAY=:1 xev -root

yjftsjthsd-g commented 7 years ago

Oh, and as I alluded to, you can get a screenshot via xwud -scale -in $PWD/framebuffers/Xvfb_screen0 or so.

yjftsjthsd-g commented 7 years ago

Working but early prototype at https://github.com/yjftsjthsd-g/keynav/commit/46b9572a98e89da7367bd233c0a85137605815a5