From 0b8e024c29f229b02586640be7fffafd36ebcbdd Mon Sep 17 00:00:00 2001 From: shekhar-cis Date: Tue, 11 Oct 2022 12:51:05 +0530 Subject: [PATCH] Update kivy test resolution --- src/bitmessagekivy/mpybit.py | 8 ++------ src/mock/kivy_main.py | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 1cff0b2e..d527d0ae 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -88,14 +88,8 @@ class NavigateApp(MDApp): identity_list = get_identity_list() image_path = load_image_path() app_platform = platform - kivy_state.screen_density = Window.size - window_size = kivy_state.screen_density tr = Lang("en") # for changing in franch replace en with fr - if os.environ.get('INSTALL_TESTS', False): - # Set kivy app resolution while running kivy tests - window_size = (720, 1280) - def __init__(self): super(NavigateApp, self).__init__() # workaround for relative imports @@ -103,6 +97,8 @@ class NavigateApp(MDApp): self.data_screens, self.all_data, self.data_screen_dict, response = load_screen_json() self.kivy_state_obj = KivyStateVariables() self.image_dir = load_image_path() + self.kivy_state_obj.screen_density = Window.size + self.window_size = self.kivy_state_obj.screen_density def build(self): """Method builds the widget""" diff --git a/src/mock/kivy_main.py b/src/mock/kivy_main.py index 0cffb9cf..e0bf587d 100644 --- a/src/mock/kivy_main.py +++ b/src/mock/kivy_main.py @@ -1,13 +1,24 @@ +# pylint: disable=unused-import, wrong-import-position, ungrouped-imports +# flake8: noqa:E401, E402 + """Mock kivy app with mock threads.""" -# pylint: disable=unused-import -# flake8: noqa:E401 - -from pybitmessage import state -from pybitmessage.bitmessagekivy.mpybit import NavigateApp +import os +from kivy.config import Config import multiqueue -from class_addressGenerator import FakeAddressGenerator -from pybitmessage.mock.network import stats, objectracker +from pybitmessage import state + +if os.environ.get('INSTALL_TESTS', False): + Config.set('graphics', 'height', 1280) + Config.set('graphics', 'width', 720) + Config.set('graphics', 'position', 'custom') + Config.set('graphics', 'top', 0) + Config.set('graphics', 'left', 0) + + +from pybitmessage.mock.class_addressGenerator import FakeAddressGenerator # noqa:E402 +from pybitmessage.bitmessagekivy.mpybit import NavigateApp # noqa:E402 +from pybitmessage.mock.network import stats, objectracker # noqa:E402 def main():