Skip to content

Commit

Permalink
Allow for some branches we can't test.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jun 14, 2024
1 parent 52ac11f commit b70867f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
5 changes: 3 additions & 2 deletions android/src/toga_android/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions android/src/toga_android/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions docs/reference/api/app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ otherwise, you wouldn't be able to exit the app.
Notes
-----

* On macOS, menus are tied to the app, not the window; and a menu is mandatory.
Therefore, a minimal macOS app (i.e., an app using a :any:`toga.Window` as the main
window) will still have a menu, but it will only have the bare minimum of menu items.

* Apps executed under Wayland on Linux environment may not show the app's formal name
correctly. Wayland considers many aspects of app operation to be the domain of the
windowing environment, not the app; as a result, some API requests will be ignored
Expand Down
7 changes: 4 additions & 3 deletions iOS/src/toga_iOS/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,17 @@ def __init__(
# Set the controller's view to be the root content widget
self.controller.view = self.native

# The testbed app won't instantiate a simple app, so we can't test these properties
@property
def height(self):
def height(self): # pragma: no cover
return self.layout_native.bounds.size.height - self.top_offset

@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
Expand Down

0 comments on commit b70867f

Please sign in to comment.