~ubuntu-branches/ubuntu/precise/unity-2d/precise-security

« back to all changes in this revision

Viewing changes to tests/misc/lib/xdo/test/test_keyboard.rb

  • Committer: Package Import Robot
  • Author(s): Didier Roche, Didier Roche, Aurélien Gâteau
  • Date: 2012-01-13 09:12:36 UTC
  • mfrom: (1.1.25)
  • Revision ID: package-import@ubuntu.com-20120113091236-844z32uco10hs6ym
Tags: 5.2.0-0ubuntu1
[ Didier Roche ]
* New upstream release:
  - Select quicklist items with just one right click (LP: #688830)
  - Launcher - Dragging and dropping a running application in to the Trash
    should quit the application and (if the app is pinned to the Launcher)
    un-pin the application from the Launcher (LP: #870143)
  - Dash - "See more..." line should be base-aligned with section header
    (LP: #748101)
  - right click on the dash icon should display a list of the lenses
    (LP: #868452)
  - Top Bar - rename the "Desktop" title in the Top Bar (displayed when no
    window has focus)  to "Ubuntu Desktop" (LP: #869873)
  - Application title on quicklist should be bold (or more visible)
    (LP: #900400)
  - unity-2d-launcher crashed with SIGSEGV  when opening a folder on a CD
    (LP: #831868)
  - unity-2d-places crashed with SIGSEGV in QScriptValue::call()
    (LP: #836498)
  - unity-2d-launcher crashed with SIGSEGV in geis_finish() (LP: #850893)
  - unity-2d-places crashed with SIGABRT in raise() (LP: #857575)
  - unity-2d-launcher crashed with SIGSEGV in exit() (LP: #859596)
  - [spread] layout broken since bzr revision 799 of lp:unity-2d
    (LP: #900895)
  - [workspace switcher] keyboard navigation of workspace switcher broken
    for accessibility (LP: #744978)
  - [spread] workspace switcher performance is poor, especially on low
    powered CPUs (LP: #745764)
  - Launcher - the rendering of the BFB and Lens squircle does not match the
    design (LP: #838708)
  - [dash] Huge performance hit when scrolling search results with
    accessibility enabled (LP: #862956)
  - DBUS_STARTER_ADDRESS and DBUS_STARTER_BUS_TYPE aren't always unset from
    environment making gedit and possibly others fail to start (LP: #873027)
  - Win Key can not be disabled in Unity-2d (LP: #873580)
  - [dash] Unity-2d dash very slow to open (LP: #881756)
  - [tests] LauncherViewTest hanging (LP: #894380)
  - [tests] Unit tests failing due to lack of Xserver (LP: #894381)
  - [launcher] Alt+F1 broken: does not give the focus to the launcher's
    content (LP: #901505)
  - [tests] Add Automated User Experience testing (LP: #903495)
  - [workspace switcher] Performance can be poor when using the opengl
    backend because of window texture sizes that are not limited
    (LP: #808716)
  - [dash] no way to unmaximize (LP: #860400)
  - [launcher] In non-composite mode, background is black (LP: #879288)
  - [dash] Unity 2D shows 'Search' instead of 'Run Command' on ALT + F2
    (LP: #883392)
  - [launcher] Removing icon from launcher makes it hide immediately
    (LP: #884410)
  - OpenGL disabled regardless of use-opengl setting (LP: #887957)
  - if libdir does not equal lib (LP: #888164)
  - [launcher] Launcher stuck open while mouse moved to left corner of panel
    (LP: #892004)
  - [dash] Long results label are truncated instead of elided and a few
    pixels of the next line is visible (LP: #901491)
  - [launcher] Dash icon missing in PPA (LP: #903182)
  - [launcher] Tile context menu should appear at mouse click down event
    (LP: #813036)
  - [launcher] Trash tile highlight is truncated top and bottom
    (LP: #876589)
  - [dash] Text highlighting color is wrong (LP: #880222)
  - [launcher] left edge of panel should not reveal launcher (LP: #891636)
  - [dash] Word "Filter results" has underline when highlighted
    (LP: #893061)
  - [launcher] Alt+F1, change desktop, Alt+F1, hit Esc: launcher doesn't
    give away focus (LP: #897640)
  - Top Bar - rename the "Desktop" title in the Top Bar (displayed when no
    window has focus)  to "Ubuntu Desktop" (LP: #869873)
  - [launcher] Show desktop doesn't show launcher (LP: #898161)
  - [launcher] Context menu/tooltip not positioned at Tile center
    (LP: #898349)
  - The QT_LAYOUT_DIRECTION string needs a translator comment (LP: #863058)
  - unity panel menus don't stay open when clicked on second monitor
    (LP: #869196)
  - Dash- More fixes to layout and alignments (LP: #906235)
* debian/control:
  - bump libunitycore build-dep to 5.0.

[ Aurélien Gâteau ]
* debian/control:
  - bump build-dep versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
#Encoding: UTF-8
 
3
 
 
4
require "test/unit"
 
5
require "tempfile"
 
6
require File.join(File.dirname(__FILE__), '../keyboard')
 
7
require File.join(File.dirname(__FILE__), '../clipboard')
 
8
require File.join(File.dirname(__FILE__), '../xwindow')
 
9
require File.join(File.dirname(__FILE__), '../simulatable')
 
10
 
 
11
class TestKeyboard < Test::Unit::TestCase
 
12
  
 
13
  #Command to start a simple text editor
 
14
  EDITOR_CMD = "gedit -s"
 
15
  EDITOR_NAME = "gedit"
 
16
  
 
17
  TESTTEXT = "This is test\ntext."
 
18
  TESTTEXT2 = "WXY"
 
19
  TESTTEXT_RAW = "ä{TAB}?b"
 
20
  TESTTEXT_SPECIAL = "ab{TAB}c{TAB}{TAB}d"
 
21
  
 
22
  def setup
 
23
    @editor_pipe = IO.popen(EDITOR_CMD, 'r')
 
24
    sleep 3
 
25
  end
 
26
  
 
27
  def teardown
 
28
    Process.kill 'TERM', @editor_pipe.pid
 
29
    @editor_pipe.close
 
30
  end
 
31
 
 
32
  def test_char
 
33
    Process.kill 'TERM', @editor_pipe.pid
 
34
    @editor_pipe.close #Special file need to be opened
 
35
    tempfile = Tempfile.open("XDOTEST")
 
36
    tempfile.write(TESTTEXT)
 
37
    tempfile.flush
 
38
    sleep 3 #Wait for the buffer to be written out
 
39
    @editor_pipe = IO.popen(EDITOR_CMD + ' ' + tempfile.path, 'r') #So it's automatically killed by #teardown
 
40
    sleep 3
 
41
    tempfile.close
 
42
    20.times{XDo::Keyboard.char("Shift+Right")}
 
43
    XDo::Keyboard.ctrl_c
 
44
    sleep 0.2
 
45
    assert_equal(TESTTEXT, XDo::Clipboard.read_clipboard)
 
46
  end
 
47
  
 
48
  def test_simulate
 
49
    XDo::Keyboard.simulate("A{BS}#{TESTTEXT2}")
 
50
    XDo::Keyboard.ctrl_a
 
51
    XDo::Keyboard.ctrl_c
 
52
    sleep 0.2
 
53
    assert_equal(TESTTEXT2, XDo::Clipboard.read_clipboard)
 
54
    
 
55
    XDo::Keyboard.ctrl_a
 
56
    XDo::Keyboard.delete
 
57
    XDo::Keyboard.simulate(TESTTEXT_SPECIAL)
 
58
    XDo::Keyboard.ctrl_a
 
59
    XDo::Keyboard.ctrl_c
 
60
    sleep 0.2
 
61
    assert_equal(TESTTEXT_SPECIAL.gsub("{TAB}", "\t"), XDo::Clipboard.read_clipboard)
 
62
    
 
63
    XDo::Keyboard.ctrl_a
 
64
    XDo::Keyboard.delete
 
65
    XDo::Keyboard.simulate(TESTTEXT_RAW, true)
 
66
    XDo::Keyboard.ctrl_a
 
67
    XDo::Keyboard.ctrl_c
 
68
    sleep 0.2
 
69
    assert_equal(TESTTEXT_RAW, XDo::Clipboard.read_clipboard)
 
70
  end
 
71
  
 
72
  def test_type
 
73
    XDo::Keyboard.type(TESTTEXT2)
 
74
    XDo::Keyboard.ctrl_a
 
75
    XDo::Keyboard.ctrl_c
 
76
    sleep 0.2
 
77
    assert_equal(TESTTEXT2, XDo::Clipboard.read_clipboard)
 
78
  end
 
79
 
 
80
  def test_window_id
 
81
    XDo::XWindow.unfocus #Ensure that the editor hasn't the input focus anymore
 
82
    sleep 1
 
83
    edit_id = XDo::XWindow.search(EDITOR_NAME).last
 
84
    xwin = XDo::XWindow.new(edit_id)
 
85
    XDo::Keyboard.simulate(TESTTEXT_SPECIAL, false, edit_id)
 
86
    sleep 1
 
87
    xwin.activate
 
88
    XDo::Keyboard.ctrl_a
 
89
    XDo::Keyboard.ctrl_c
 
90
    sleep 0.2
 
91
    assert_equal(TESTTEXT_SPECIAL.gsub("{TAB}", "\t"), XDo::Clipboard.read_clipboard)
 
92
  end
 
93
  
 
94
  def test_include
 
95
    String.class_eval do
 
96
      include XDo::Simulatable
 
97
      
 
98
      def to_xdo
 
99
        to_s
 
100
      end
 
101
    end
 
102
    
 
103
    XDo::Keyboard.ctrl_a
 
104
    XDo::Keyboard.delete
 
105
    "Ein String".simulate
 
106
    XDo::Keyboard.ctrl_a
 
107
    sleep 0.2
 
108
    XDo::Keyboard.ctrl_c
 
109
    sleep 0.2
 
110
    clip = XDo::Clipboard.read_clipboard
 
111
    assert_equal("Ein String", clip, "Simulated typed string fails to match")
 
112
  end
 
113
  
 
114
end