Looks good, but with a few things that need fixing.
1) The docstrings for next_icon_mouse and previous_icon_mouse should say: "icon" instead of "application".
2) If possible, we should use constsants to define the mouse buttons in unity. These must be defined in X somewhere?
3)Your tests need to be split up, like this:
107 + def test_switcher_scroll_next(self): 108 + self.set_timeout_setting(False) 109 + sleep(1) 110 + 111 + self.switcher.initiate() 112 + sleep(.2) 113 + 114 + start = self.switcher.get_selection_index() 115 + self.switcher.next_icon_mouse() 116 + sleep(.2) 117 + 118 + end = self.switcher.get_selection_index() 119 + self.assertThat(start, NotEquals(0)) 120 + self.assertThat(end, Equals(start + 1)) 121 +
def test_switcher_ignores_fast_wheel_down_events(self): 122 + # Quickly repeatead events should be ignored (except the first) 123 + start = self.switcher.get_selection_index() 124 + self.switcher.next_icon_mouse() 125 + self.switcher.next_icon_mouse() 126 + sleep(.2) 127 + 128 + end = self.switcher.get_selection_index() 129 + self.assertThat(end, Equals(start + 1)) 130 + 131 + self.switcher.terminate() 132 +
133 + def test_switcher_scroll_prev(self): 134 + self.set_timeout_setting(False) 135 + sleep(1) 136 + 137 + self.switcher.initiate() 138 + sleep(.2) 139 + 140 + start = self.switcher.get_selection_index() 141 + self.switcher.previous_icon_mouse() 142 + sleep(.2) 143 + 144 + end = self.switcher.get_selection_index() 145 + self.assertThat(start, NotEquals(0)) 146 + self.assertThat(end, Equals(start - 1)) 147 +
def test_switcher_ignores_fast_wheel_down_events(self): 148 + # Quickly repeatead events should be ignored (except the first) 149 + start = self.switcher.get_selection_index() 150 + self.switcher.previous_icon_mouse() 151 + self.switcher.previous_icon_mouse() 152 + sleep(.2) 153 + 154 + end = self.switcher.get_selection_index() 155 + self.assertThat(end, Equals(start - 1)) 156 + 157 + self.switcher.terminate() 158 + self.set_timeout_setting(True) 159 +
« Back to merge proposal
Looks good, but with a few things that need fixing.
1) The docstrings for next_icon_mouse and previous_icon_mouse should say: "icon" instead of "application".
2) If possible, we should use constsants to define the mouse buttons in unity. These must be defined in X somewhere?
3)Your tests need to be split up, like this:
107 + def test_switcher_ scroll_ next(self) : timeout_ setting( False) initiate( ) get_selection_ index() next_icon_ mouse() get_selection_ index() (start, NotEquals(0)) (end, Equals(start + 1))
108 + self.set_
109 + sleep(1)
110 +
111 + self.switcher.
112 + sleep(.2)
113 +
114 + start = self.switcher.
115 + self.switcher.
116 + sleep(.2)
117 +
118 + end = self.switcher.
119 + self.assertThat
120 + self.assertThat
121 +
def test_switcher_ ignores_ fast_wheel_ down_events( self): get_selection_ index() next_icon_ mouse() next_icon_ mouse() get_selection_ index() (end, Equals(start + 1)) terminate( )
122 + # Quickly repeatead events should be ignored (except the first)
123 + start = self.switcher.
124 + self.switcher.
125 + self.switcher.
126 + sleep(.2)
127 +
128 + end = self.switcher.
129 + self.assertThat
130 +
131 + self.switcher.
132 +
133 + def test_switcher_ scroll_ prev(self) : timeout_ setting( False) initiate( ) get_selection_ index() previous_ icon_mouse( ) get_selection_ index() (start, NotEquals(0)) (end, Equals(start - 1))
134 + self.set_
135 + sleep(1)
136 +
137 + self.switcher.
138 + sleep(.2)
139 +
140 + start = self.switcher.
141 + self.switcher.
142 + sleep(.2)
143 +
144 + end = self.switcher.
145 + self.assertThat
146 + self.assertThat
147 +
def test_switcher_ ignores_ fast_wheel_ down_events( self): get_selection_ index() previous_ icon_mouse( ) previous_ icon_mouse( ) get_selection_ index() (end, Equals(start - 1)) terminate( ) timeout_ setting( True)
148 + # Quickly repeatead events should be ignored (except the first)
149 + start = self.switcher.
150 + self.switcher.
151 + self.switcher.
152 + sleep(.2)
153 +
154 + end = self.switcher.
155 + self.assertThat
156 +
157 + self.switcher.
158 + self.set_
159 +