From 726525b26a8db42f84dde8d8eb7e8c2f18dc9675 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 17 Nov 2015 06:57:33 +0100 Subject: [PATCH] bdd: Add some more tests for scrolling with floats. --- qutebrowser/browser/commands.py | 2 +- tests/integration/features/scroll.feature | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index b8581bc7b..92b9edb82 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -685,7 +685,7 @@ class CommandDispatcher: pass elif mult_y < 0: 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)) mult_y = 0 if mult_x == 0 and mult_y == 0: diff --git a/tests/integration/features/scroll.feature b/tests/integration/features/scroll.feature index 524f4fdcf..6063f338d 100644 --- a/tests/integration/features/scroll.feature +++ b/tests/integration/features/scroll.feature @@ -152,6 +152,10 @@ Feature: Scrolling When I run :scroll-perc 50 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 When I run :scroll-perc 50 And I run :scroll-perc 0 @@ -202,6 +206,10 @@ Feature: Scrolling When I run :scroll-page 0 1 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 When 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 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 When I run :scroll-page 1 0 And I run :scroll-page -1 0