bdd: Add some more tests for scrolling with floats.

This commit is contained in:
Florian Bruhin 2015-11-17 06:57:33 +01:00
parent 40e2258ef3
commit 726525b26a
2 changed files with 13 additions and 1 deletions

View File

@ -685,7 +685,7 @@ class CommandDispatcher:
pass pass
elif mult_y < 0: elif mult_y < 0:
self.scroll('page-up', count=-int(mult_y)) self.scroll('page-up', count=-int(mult_y))
elif mult_y > 0: elif mult_y > 0: # pragma: no branch
self.scroll('page-down', count=int(mult_y)) self.scroll('page-down', count=int(mult_y))
mult_y = 0 mult_y = 0
if mult_x == 0 and mult_y == 0: if mult_x == 0 and mult_y == 0:

View File

@ -152,6 +152,10 @@ Feature: Scrolling
When I run :scroll-perc 50 When I run :scroll-perc 50
Then the page should be scrolled vertically. Then the page should be scrolled vertically.
Scenario: Scrolling to middle with :scroll-perc (float)
When I run :scroll-perc 50.5
Then the page should be scrolled vertically.
Scenario: Scrolling to middle and to top with :scroll-perc Scenario: Scrolling to middle and to top with :scroll-perc
When I run :scroll-perc 50 When I run :scroll-perc 50
And I run :scroll-perc 0 And I run :scroll-perc 0
@ -202,6 +206,10 @@ Feature: Scrolling
When I run :scroll-page 0 1 When I run :scroll-page 0 1
Then the page should be scrolled vertically. Then the page should be scrolled vertically.
Scenario: Scrolling down with :scroll-page (float)
When I run :scroll-page 0 1.5
Then the page should be scrolled vertically.
Scenario: Scrolling down and up with :scroll-page Scenario: Scrolling down and up with :scroll-page
When I run :scroll-page 0 1 When I run :scroll-page 0 1
And I run :scroll-page 0 -1 And I run :scroll-page 0 -1
@ -211,6 +219,10 @@ Feature: Scrolling
When I run :scroll-page 1 0 When I run :scroll-page 1 0
Then the page should be scrolled horizontally. Then the page should be scrolled horizontally.
Scenario: Scrolling right with :scroll-page (float)
When I run :scroll-page 1.5 0
Then the page should be scrolled horizontally.
Scenario: Scrolling right and left with :scroll-page Scenario: Scrolling right and left with :scroll-page
When I run :scroll-page 1 0 When I run :scroll-page 1 0
And I run :scroll-page -1 0 And I run :scroll-page -1 0