hints: add precision tests for different zoom levels
This commit is contained in:
parent
dd594b0eca
commit
9799c30c2b
@ -472,9 +472,15 @@ class HintManager(QObject):
|
|||||||
rect = self._get_first_rectangle(elem)
|
rect = self._get_first_rectangle(elem)
|
||||||
pos = rect.center()
|
pos = rect.center()
|
||||||
|
|
||||||
|
# fix coordinates according to zoom level
|
||||||
|
zoom = elem.webFrame().zoomFactor()
|
||||||
|
if not config.get('ui', 'zoom-text-only'):
|
||||||
|
pos.setX(pos.x() * zoom)
|
||||||
|
pos.setY(pos.y() * zoom)
|
||||||
|
|
||||||
action = "Hovering" if context.target == Target.hover else "Clicking"
|
action = "Hovering" if context.target == Target.hover else "Clicking"
|
||||||
log.hints.debug("{} on '{}' at position {}".format(
|
log.hints.debug("{} on '{}' at position {} (zoom = {})".format(
|
||||||
action, elem.debug_text(), pos))
|
action, elem.debug_text(), pos, zoom))
|
||||||
|
|
||||||
self.start_hinting.emit(target_mapping[context.target])
|
self.start_hinting.emit(target_mapping[context.target])
|
||||||
if context.target in [Target.tab, Target.tab_fg, Target.tab_bg,
|
if context.target in [Target.tab, Target.tab_fg, Target.tab_bg,
|
||||||
|
@ -50,5 +50,12 @@
|
|||||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis <a href="/data/hello.txt">nostrud exercitation</a> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis <a href="/data/hello.txt">nostrud exercitation</a> ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div style="border: 1px solid silver;">
|
||||||
|
<p>Test precision with different zoom levels:</p>
|
||||||
|
<div>
|
||||||
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim <a href="/data/hello.txt">id</a> est laborum.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -41,3 +41,21 @@ Feature: Using hints
|
|||||||
And I run :hint links normal
|
And I run :hint links normal
|
||||||
And I run :follow-hint g
|
And I run :follow-hint g
|
||||||
Then data/hello.txt should be loaded
|
Then data/hello.txt should be loaded
|
||||||
|
|
||||||
|
Scenario: Following a link with zoom 125%.
|
||||||
|
When I open data/hints/link.html
|
||||||
|
And I run :zoom 125
|
||||||
|
And I run :hint links normal
|
||||||
|
And I run :follow-hint h
|
||||||
|
And I run :zoom 100
|
||||||
|
Then data/hello.txt should be loaded
|
||||||
|
|
||||||
|
Scenario: Following a link with zoom 125% and zoom-text-only == True.
|
||||||
|
When I open data/hints/link.html
|
||||||
|
And I run :set ui zoom-text-only true
|
||||||
|
And I run :zoom 125
|
||||||
|
And I run :hint links normal
|
||||||
|
And I run :follow-hint h
|
||||||
|
And I run :zoom 100
|
||||||
|
And I run :set ui zoom-text-only false
|
||||||
|
Then data/hello.txt should be loaded
|
||||||
|
Loading…
Reference in New Issue
Block a user