From d5e860c891364b55c1c1e8e0b0b5f6bc4e2b27b6 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Fri, 14 Jun 2024 12:07:09 +0800 Subject: [PATCH] Allow for some branches we can't test. --- android/src/toga_android/app.py | 5 +++-- android/src/toga_android/window.py | 5 +++-- iOS/src/toga_iOS/container.py | 9 +++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/android/src/toga_android/app.py b/android/src/toga_android/app.py index fc0f01a138..347d9126d1 100644 --- a/android/src/toga_android/app.py +++ b/android/src/toga_android/app.py @@ -93,9 +93,10 @@ def onOptionsItemSelected(self, menuitem): def onPrepareOptionsMenu(self, menu): # If the main window doesn't have a toolbar, there's no preparation required; - # this is a simple main window, which can't have commands. + # this is a simple main window, which can't have commands. This can't be + # validated in the testbed, so it's marked no-cover. if not hasattr(self._impl.interface.main_window, "toolbar"): - return False + return False # pragma: no cover menu.clear() itemid = 1 # 0 is the same as Menu.NONE. diff --git a/android/src/toga_android/window.py b/android/src/toga_android/window.py index c0eda688ac..4ababa5266 100644 --- a/android/src/toga_android/window.py +++ b/android/src/toga_android/window.py @@ -56,8 +56,9 @@ def close(self): # pragma: no cover # closed, so the platform-specific close handling is never triggered. pass - def configure_titlebar(self): - # Hide the titlebar on a simple window. + def configure_titlebar(self): # pragma: no cover + # Hide the titlebar on a simple window. The testbed can't create a simple + # window, so we can't test this. self.app.native.getSupportActionBar().hide() def set_app(self, app): diff --git a/iOS/src/toga_iOS/container.py b/iOS/src/toga_iOS/container.py index 118df59ac1..0d012f291f 100644 --- a/iOS/src/toga_iOS/container.py +++ b/iOS/src/toga_iOS/container.py @@ -153,12 +153,13 @@ def __init__( def height(self): return self.layout_native.bounds.size.height - self.top_offset + # The testbed app won't instantiate a simple app, so we can't test these properties @property - def top_offset(self): + def top_offset(self): # pragma: no cover return UIApplication.sharedApplication.statusBarFrame.size.height @property - def title(self): + def title(self): # pragma: no cover return self._title @title.setter @@ -201,10 +202,6 @@ def __init__( # Set the controller's view to be the root content widget self.content_controller.view = self.native - @property - def height(self): - return self.layout_native.bounds.size.height - self.top_offset - @property def top_offset(self): return (