File: test_app.py

package info (click to toggle)
qutebrowser 3.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,432 kB
  • sloc: python: 72,411; javascript: 31,862; sh: 874; xml: 149; makefile: 52
file content (25 lines) | stat: -rw-r--r-- 781 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

"""Tests for the qutebrowser.app module."""

from qutebrowser.qt.core import QBuffer

from qutebrowser.misc import objects
from qutebrowser import app


def test_on_focus_changed_issue1484(monkeypatch, qapp, caplog):
    """Check what happens when on_focus_changed is called with wrong args.

    For some reason, Qt sometimes calls on_focus_changed() with a QBuffer as
    argument. Let's make sure we handle that gracefully.
    """
    monkeypatch.setattr(objects, 'qapp', qapp)

    buf = QBuffer()
    app.on_focus_changed(buf, buf)

    expected = "on_focus_changed called with non-QWidget {!r}".format(buf)
    assert caplog.messages == [expected]