Philipp Hörist pushed to branch gtk4 at gajim / gajim
Commits: 7ec1f596 by Philipp Hörist at 2024-10-04T20:01:38+02:00 refactor: Fix ConversationView Test - - - - - 1 changed file: - test/dialogs/conversation_view.py Changes: ===================================== test/dialogs/conversation_view.py ===================================== @@ -1,7 +1,10 @@ +from typing import Any + import tempfile from unittest.mock import MagicMock from gi.repository import Gdk +from gi.repository import GLib from gi.repository import Gtk from nbxmpp.protocol import JID @@ -23,7 +26,7 @@ from gajim.gtk.avatar import generate_default_avatar from gajim.gtk.control import ChatControl -ACCOUNT = 'm...@test.tld' +ACCOUNT = 'testacc1' FROM_JID = 'cont...@test.tld' BASE_TIMESTAMP = 1672531200 @@ -42,10 +45,7 @@ def __init__(self) -> None: jump_to_button = Gtk.Button(label='Jump to 500') jump_to_button.connect('clicked', self._on_jump_to_clicked) - button_box = Gtk.Box( - spacing=6, - halign=Gtk.Align.CENTER, - margin_bottom=6) + button_box = Gtk.Box(spacing=6, halign=Gtk.Align.CENTER, margin_bottom=6) button_box.append(jump_to_button) box = Gtk.Box(spacing=6, orientation=Gtk.Orientation.VERTICAL) @@ -53,28 +53,21 @@ def __init__(self) -> None: box.append(button_box) self.set_child(box) - self.connect('key-press-event', self._on_key_press_event) + # self.connect('key-press-event', self._on_key_press_event) def _get_contact(self) -> BareContact: contact = MagicMock(spec='BareContact') contact.connect = MagicMock() contact.account = ACCOUNT - contact.jid = FROM_JID + contact.jid = JID.from_string(FROM_JID) contact.name = 'Test Contact' contact.is_groupchat = False - avatar = generate_default_avatar( - 'T', - (0.2, 0.1, 0.7), - AvatarSize.ROSTER, - 1) + avatar = generate_default_avatar('T', (0.2, 0.1, 0.7), AvatarSize.ROSTER, 1) contact.get_avatar = MagicMock(return_value=avatar) contact.settings = ContactSettings(ACCOUNT, JID.from_string(ACCOUNT)) return contact - def _on_key_press_event(self, - _widget: Gtk.Widget, - event: Any - ) -> None: + def _on_key_press_event(self, _widget: Gtk.Widget, event: Any) -> None: if event.keyval == Gdk.KEY_Escape: self.destroy() @@ -112,21 +105,23 @@ def add_archive_messages() -> None: app.settings = Settings(in_memory=True) app.settings.init() app.settings.add_account(ACCOUNT) +app.settings.set_account_setting('testacc1', 'address', 'u...@domain.org') app.storage.events = EventStorage() app.storage.events.init() -app.storage.archive = MessageArchiveStorage(in_memory=True) -app.storage.archive.init() -add_archive_messages() - configpaths.set_separation(True) configpaths.set_config_root(tempfile.gettempdir()) configpaths.init() +app.storage.archive = MessageArchiveStorage(in_memory=True) +app.storage.archive.init() +add_archive_messages() + app.preview_manager = PreviewManager() win = ConversationViewTest() -win.connect('destroy', Gtk.main_quit) +win.show() -Gtk.main() +while Gtk.Window.get_toplevels().get_n_items() > 0: + GLib.MainContext().default().iteration(True) View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/7ec1f596274cfb8110298f0718e32cd3a1ad864b -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/7ec1f596274cfb8110298f0718e32cd3a1ad864b You're receiving this email because of your account on dev.gajim.org.
_______________________________________________ Commits mailing list -- commits@gajim.org To unsubscribe send an email to commits-le...@gajim.org