Skip scrolling tests on Qt < 5.7
This fixes tests on OS X on Travis, since Homebrew is still on Qt 5.6.
This commit is contained in:
parent
22d9c49169
commit
c58a0e926f
@ -311,6 +311,17 @@ def hint_and_follow(quteproc, args, letter):
|
||||
quteproc.send_cmd(':follow-hint {}'.format(letter))
|
||||
|
||||
|
||||
@bdd.when("I wait until the scroll position changed")
|
||||
def wait_scroll_position(quteproc):
|
||||
quteproc.wait_scroll_pos_changed()
|
||||
|
||||
|
||||
@bdd.when(bdd.parsers.parse("I wait until the scroll position changed to "
|
||||
"{x}/{y}"))
|
||||
def wait_scroll_position_arg(quteproc, x, y):
|
||||
quteproc.wait_scroll_pos_changed(x, y)
|
||||
|
||||
|
||||
## Then
|
||||
|
||||
|
||||
@ -525,8 +536,8 @@ def _get_scroll_values(quteproc):
|
||||
|
||||
@bdd.then(bdd.parsers.re(r"the page should be scrolled "
|
||||
r"(?P<direction>horizontally|vertically)"))
|
||||
def check_scrolled(request, quteproc, direction):
|
||||
quteproc.wait_for(message='Scroll position changed to *')
|
||||
def check_scrolled(quteproc, direction):
|
||||
quteproc.wait_scroll_pos_changed()
|
||||
x, y = _get_scroll_values(quteproc)
|
||||
if direction == 'horizontally':
|
||||
assert x != 0
|
||||
|
@ -8,55 +8,55 @@ Feature: Setting positional marks
|
||||
|
||||
Scenario: Setting and jumping to a local mark
|
||||
When I run :scroll-px 5 10
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log
|
||||
And I wait until the scroll position changed to 5/10
|
||||
And I run :set-mark a
|
||||
And I run :scroll-px 0 20
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 30)" in the log
|
||||
And I wait until the scroll position changed to 5/30
|
||||
And I run :jump-mark a
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log
|
||||
And I wait until the scroll position changed to 5/10
|
||||
Then the page should be scrolled to 5 10
|
||||
|
||||
Scenario: Jumping back after jumping to a particular percentage
|
||||
When I run :scroll-px 10 20
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 20)" in the log
|
||||
And I wait until the scroll position changed to 10/20
|
||||
And I run :scroll-perc 100
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :jump-mark "'"
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 20)" in the log
|
||||
And I wait until the scroll position changed to 10/20
|
||||
Then the page should be scrolled to 10 20
|
||||
|
||||
Scenario: Setting the same local mark on another page
|
||||
When I run :scroll-px 5 10
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log
|
||||
And I wait until the scroll position changed to 5/10
|
||||
And I run :set-mark a
|
||||
And I open data/marks.html
|
||||
And I run :scroll-px 0 20
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(0, 20)" in the log
|
||||
And I wait until the scroll position changed to 0/20
|
||||
And I run :set-mark a
|
||||
And I run :jump-mark a
|
||||
Then the page should be scrolled to 0 20
|
||||
|
||||
Scenario: Jumping to a local mark after returning to a page
|
||||
When I run :scroll-px 5 10
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log
|
||||
And I wait until the scroll position changed to 5/10
|
||||
And I run :set-mark a
|
||||
And I run :scroll-px 0 20
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 30)" in the log
|
||||
And I wait until the scroll position changed to 5/30
|
||||
And I open data/numbers/1.txt
|
||||
And I run :set-mark a
|
||||
And I open data/marks.html
|
||||
And I run :jump-mark a
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 10)" in the log
|
||||
And I wait until the scroll position changed to 5/10
|
||||
Then the page should be scrolled to 5 10
|
||||
|
||||
Scenario: Setting and jumping to a global mark
|
||||
When I run :scroll-px 5 20
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 20)" in the log
|
||||
And I wait until the scroll position changed to 5/20
|
||||
And I run :set-mark A
|
||||
And I open data/numbers/1.txt
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
And I run :jump-mark A
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(5, 20)" in the log
|
||||
And I wait until the scroll position changed to 5/20
|
||||
Then data/marks.html should be loaded
|
||||
And the page should be scrolled to 5 20
|
||||
|
||||
@ -74,13 +74,13 @@ Feature: Setting positional marks
|
||||
Scenario: Jumping to a local mark after changing fragments
|
||||
When I open data/marks.html#top
|
||||
And I run :scroll 'top'
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
And I run :scroll-px 10 10
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 10)" in the log
|
||||
And I wait until the scroll position changed to 10/10
|
||||
And I run :set-mark a
|
||||
When I open data/marks.html#bottom
|
||||
And I run :jump-mark a
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 10)" in the log
|
||||
And I wait until the scroll position changed to 10/10
|
||||
Then the page should be scrolled to 10 10
|
||||
|
||||
@qtwebengine_todo: Does not emit loaded signal for fragments?
|
||||
@ -88,16 +88,16 @@ Feature: Setting positional marks
|
||||
When I hint with args "links normal" and follow s
|
||||
And I wait until data/marks.html#bottom is loaded
|
||||
And I run :jump-mark "'"
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should be scrolled to 0 0
|
||||
|
||||
Scenario: Jumping back after searching
|
||||
When I run :scroll-px 20 15
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(20, 15)" in the log
|
||||
And I wait until the scroll position changed to 20/15
|
||||
And I run :search Waldo
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :jump-mark "'"
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(20, 15)" in the log
|
||||
And I wait until the scroll position changed to 20/15
|
||||
Then the page should be scrolled to 20 15
|
||||
|
||||
# FIXME:qtwebengine
|
||||
@ -105,17 +105,17 @@ Feature: Setting positional marks
|
||||
Scenario: Jumping back after search-next
|
||||
When I run :search Grail
|
||||
And I run :search-next
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :jump-mark "'"
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should be scrolled to 0 0
|
||||
|
||||
Scenario: Hovering a hint does not set the ' mark
|
||||
When I run :scroll-px 30 20
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(30, 20)" in the log
|
||||
And I wait until the scroll position changed to 30/20
|
||||
And I run :scroll-perc 0
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I hint with args "links hover" and follow s
|
||||
And I run :jump-mark "'"
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(30, 20)" in the log
|
||||
And I wait until the scroll position changed to 30/20
|
||||
Then the page should be scrolled to 30 20
|
||||
|
@ -537,23 +537,23 @@ Feature: Various utility commands.
|
||||
Given I open data/scroll/simple.html
|
||||
And I run :tab-only
|
||||
When I run :scroll down with count 3
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll up
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :repeat-command with count 2
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: :repeat-command with not-normal command inbetween
|
||||
Given I open data/scroll/simple.html
|
||||
And I run :tab-only
|
||||
When I run :scroll down with count 3
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll up
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :prompt-accept
|
||||
And I run :repeat-command with count 2
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
Then the page should not be scrolled
|
||||
And the error "prompt-accept: This command is only allowed in prompt/yesno mode." should be shown
|
||||
|
||||
|
@ -17,32 +17,32 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling down and up
|
||||
When I run :scroll-px 10 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 0)" in the log
|
||||
And I wait until the scroll position changed to 10/0
|
||||
And I run :scroll-px -10 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling right and left
|
||||
When I run :scroll-px 0 10
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(0, 10)" in the log
|
||||
And I wait until the scroll position changed to 0/10
|
||||
And I run :scroll-px 0 -10
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling down and up with count
|
||||
When I run :scroll-px 0 10 with count 2
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(0, 20)" in the log
|
||||
And I wait until the scroll position changed to 0/20
|
||||
When I run :scroll-px 0 -10
|
||||
When I run :scroll-px 0 -10
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling left and right with count
|
||||
When I run :scroll-px 10 0 with count 2
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(20, 0)" in the log
|
||||
And I wait until the scroll position changed to 20/0
|
||||
When I run :scroll-px -10 0
|
||||
When I run :scroll-px -10 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: :scroll-px with a very big value
|
||||
@ -68,9 +68,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling down and up
|
||||
When I run :scroll down
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll up
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling right
|
||||
@ -79,9 +79,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling right and left
|
||||
When I run :scroll right
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll left
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
# causes segfault with postEvent instead of sendEvent
|
||||
@ -95,9 +95,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling with page down and page up
|
||||
When I run :scroll page-down
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll page-up
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling to bottom
|
||||
@ -106,9 +106,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling to bottom and to top
|
||||
When I run :scroll bottom
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll top
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: :scroll with invalid argument
|
||||
@ -118,10 +118,10 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling down and up with count
|
||||
When I run :scroll down with count 2
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll up
|
||||
And I run :scroll up
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling right
|
||||
@ -130,26 +130,26 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling right and left
|
||||
When I run :scroll right
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll left
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling right and left with count
|
||||
When I run :scroll right with count 2
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll left
|
||||
And I run :scroll left
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
@qtwebengine_skip: Causes memory leak...
|
||||
Scenario: Scrolling down with a very big count
|
||||
When I run :scroll down with count 99999999999
|
||||
And I wait until the scroll position changed
|
||||
# Make sure it doesn't hang
|
||||
And I run :message-info "Still alive!"
|
||||
Then the message "Still alive!" should be shown
|
||||
And "Scroll position changed to *" should be logged
|
||||
|
||||
Scenario: :scroll on a page without scrolling
|
||||
When I open data/hello.txt
|
||||
@ -164,9 +164,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling to bottom and to top with :scroll-perc
|
||||
When I run :scroll-perc 100
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-perc 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling to middle with :scroll-perc
|
||||
@ -179,9 +179,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling to middle and to top with :scroll-perc
|
||||
When I run :scroll-perc 50
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-perc 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling to right with :scroll-perc
|
||||
@ -190,9 +190,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling to right and to left with :scroll-perc
|
||||
When I run :scroll-perc --horizontal 100
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-perc --horizontal 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling to middle (horizontally) with :scroll-perc
|
||||
@ -201,9 +201,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling to middle and to left with :scroll-perc
|
||||
When I run :scroll-perc --horizontal 50
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-perc --horizontal 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: :scroll-perc without argument
|
||||
@ -250,9 +250,9 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling down and up with :scroll-page
|
||||
When I run :scroll-page 0 1
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-page 0 -1
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling right with :scroll-page
|
||||
@ -265,24 +265,24 @@ Feature: Scrolling
|
||||
|
||||
Scenario: Scrolling right and left with :scroll-page
|
||||
When I run :scroll-page 1 0
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-page -1 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
Scenario: Scrolling right and left with :scroll-page and count
|
||||
When I run :scroll-page 1 0 with count 2
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-page -1 0
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-page -1 0
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint()" in the log
|
||||
And I wait until the scroll position changed to 0/0
|
||||
Then the page should not be scrolled
|
||||
|
||||
@qtwebengine_todo: at_bottom is not implemented yet
|
||||
Scenario: :scroll-page with --bottom-navigate
|
||||
When I run :scroll-perc 100
|
||||
And I wait for "Scroll position changed to *" in the log
|
||||
And I wait until the scroll position changed
|
||||
And I run :scroll-page --bottom-navigate next 0 1
|
||||
Then data/hello2.txt should be loaded
|
||||
|
||||
|
@ -68,7 +68,7 @@ Feature: Saving and loading sessions
|
||||
Scenario: Scrolling (qtwebengine)
|
||||
When I open data/scroll/simple.html
|
||||
And I run :scroll-px 10 20
|
||||
And I wait for "Scroll position changed to PyQt5.QtCore.QPoint(10, 20)" in the log
|
||||
And I wait until the scroll position changed to 10/20
|
||||
Then the session should look like:
|
||||
windows:
|
||||
- tabs:
|
||||
|
@ -298,6 +298,31 @@ class QuteProc(testprocess.Process):
|
||||
function='javaScriptConsoleMessage',
|
||||
message='[*] {}'.format(message))
|
||||
|
||||
def wait_scroll_pos_changed(self, x=None, y=None):
|
||||
"""Wait until a "Scroll position changed" message was found.
|
||||
|
||||
With QtWebEngine, on older Qt versions which lack
|
||||
QWebEnginePage.scrollPositionChanged, this also skips the test.
|
||||
"""
|
||||
__tracebackhide__ = (lambda e:
|
||||
e.errisinstance(testprocess.WaitForTimeout))
|
||||
if (x is None and y is not None) or (y is None and x is not None):
|
||||
raise ValueError("Either both x/y or neither must be given!")
|
||||
|
||||
if self.request.config.webengine:
|
||||
from PyQt5.QtWebEngineWidgets import QWebEnginePage
|
||||
if not hasattr(QWebEnginePage, 'scrollPositionChanged'):
|
||||
# Qt < 5.7
|
||||
pytest.skip("QWebEnginePage.scrollPositionChanged missing")
|
||||
if x is None and y is None:
|
||||
point = '*'
|
||||
elif x == '0' and y == '0':
|
||||
point = 'PyQt5.QtCore.QPoint()'
|
||||
else:
|
||||
point = 'PyQt5.QtCore.QPoint({}, {})'.format(x, y)
|
||||
self.wait_for(category='webview',
|
||||
message='Scroll position changed to ' + point)
|
||||
|
||||
def wait_for(self, timeout=None, **kwargs):
|
||||
"""Extend wait_for to add divisor if a test is xfailing."""
|
||||
__tracebackhide__ = (lambda e:
|
||||
|
Loading…
Reference in New Issue
Block a user