X Auto Testing Tools

xAutoClick
http://xautoclick.sourceforge.net/documentation.html

Linux下類似按鍵精靈的東東。
可以改進一下用於X driver的測試。


XTest Extention是關鍵,嘗試Auto Testing工具的開發,積累.
libXtst包含的函數有:
       XTestQueryExtension, XTestCompareCursorWithWindow, XTestCompareCurrentCursorWithWindow, XTestFakeKeyEvent,
       XTestFakeButtonEvent, XTestFakeMotionEvent, XTestFakeRelativeMotionEvent, XTestGrabControl, XTestSetGContextOfGC,
       XTestSetVisualIDOfVisual, XTestDiscard - XTest extension functions

鍵盤的按鍵操作函數:
int XTestFakeKeyEvent(display, keycode, is_press, delay);

 Display *display;
 unsigned int keycode;
 Bool is_press;
 unsigned long delay;


鼠標的按鍵操作函數:
 int XTestFakeButtonEvent(display, button, is_press, delay);

 Display *display;
 unsigned int button;
  Bool is_press;
  unsigned long delay;


還有判斷鼠標移動位置等函數,總體來說是“Keep It Simple”的設計。

使用這個擴展進行X窗口等測試,需要考慮延展性。先實現幾個最簡單的操作小程序:鼠標單擊左鍵、雙擊左鍵、鼠標位置移動、鍵盤輸入等。再編寫shell腳本調用‘Little tool’去進行綜合測試。

熟悉了XTestFakeKeyEvent, XTestFakeButtonEvent, XTestFakeMotionEvent, XTestFakeRelativeMotionEvent, XTestGrabControl等使用方法。
但是如下兩個函數並不熟悉:

XTestSetGContextOfGC
       sets the GContext within the opaque datatype referenced by gc to be that specified by gid.

XTestSetVisualIDOfVisual
       sets the VisualID within the opaque datatype referenced by visual to be that specified by
       visualid.


PS: XTestFakeKeyEvent類似Windows下SendMessage(hwnd, KEY_PRESS,0 ,128)的功能
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章