Re-add scroll filtering and disable it for mark/scroll tests

See #2233
This commit is contained in:
Florian Bruhin 2017-10-20 07:36:51 +02:00
parent 455b90ecad
commit fd8e5e30c6
4 changed files with 25 additions and 3 deletions

View File

@ -293,6 +293,7 @@ class WebEngineScroller(browsertab.AbstractScroller):
def __init__(self, tab, parent=None):
super().__init__(tab, parent)
self._args = objreg.get('args')
self._pos_perc = (0, 0)
self._pos_px = QPoint()
self._at_bottom = False
@ -333,9 +334,11 @@ class WebEngineScroller(browsertab.AbstractScroller):
perc_y = min(100, round(100 / dy * jsret['px']['y']))
self._at_bottom = math.ceil(jsret['px']['y']) >= dy
self._pos_perc = perc_x, perc_y
self.perc_changed.emit(*self._pos_perc)
if (self._pos_perc != (perc_x, perc_y) or
'no-scroll-filtering' in self._args.debug_flags):
self._pos_perc = perc_x, perc_y
self.perc_changed.emit(*self._pos_perc)
js_code = javascript.assemble('scroll', 'pos')
self._tab.run_js_async(js_code, update_pos_cb)

View File

@ -159,7 +159,8 @@ def debug_flag_error(flag):
debug-exit: Turn on debugging of late exit.
pdb-postmortem: Drop into pdb on exceptions.
"""
valid_flags = ['debug-exit', 'pdb-postmortem', 'no-sql-history']
valid_flags = ['debug-exit', 'pdb-postmortem', 'no-sql-history',
'no-scroll-filtering']
if flag in valid_flags:
return flag

View File

@ -17,10 +17,19 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_bdd as bdd
bdd.scenarios('marks.feature')
@pytest.fixture(autouse=True)
def turn_on_scroll_logging(quteproc):
"""Make sure all scrolling changes are logged."""
quteproc.send_cmd(":debug-pyeval -q objreg.get('args')."
"debug_flags.append('no-scroll-filtering')")
@bdd.then(bdd.parsers.parse("the page should be scrolled to {x} {y}"))
def check_y(request, quteproc, x, y):
data = quteproc.get_session()

View File

@ -17,5 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import pytest
import pytest_bdd as bdd
bdd.scenarios('scroll.feature')
@pytest.fixture(autouse=True)
def turn_on_scroll_logging(quteproc):
"""Make sure all scrolling changes are logged."""
quteproc.send_cmd(":debug-pyeval -q objreg.get('args')."
"debug_flags.append('no-scroll-filtering')")