Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[widget audit] toga.Button #1761

Merged
merged 66 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
92fd082
Whitespace change to use as the starting point for a PR.
freakboy3742 Jan 31, 2023
d206715
Add changenote.
freakboy3742 Jan 31, 2023
9fdf46e
Fix tracing on Windows
mhsmith Jan 31, 2023
38bd4d6
Migrate dummy widget tools to pytest.
freakboy3742 Feb 1, 2023
b541c09
Remove use of shadow attribute for button label.
freakboy3742 Feb 1, 2023
7077562
Convert Button tests to pytest.
freakboy3742 Feb 1, 2023
ec04ddc
Fix Android tests, get to 100% coverage.
freakboy3742 Feb 1, 2023
859ad48
Fix get_text implementation on gtk and winforms.
freakboy3742 Feb 1, 2023
f93158e
100% coverage on iOS.
freakboy3742 Feb 1, 2023
67f3374
Remove deprecated code from Button.
freakboy3742 Feb 1, 2023
ca8a760
Winforms to 100%.
freakboy3742 Feb 1, 2023
8a03783
GTK to 100%.
freakboy3742 Feb 1, 2023
37985ae
Winforms to 100%, no skips.
freakboy3742 Feb 2, 2023
2b9714e
Add test selection from the command line, and a slow mode.
freakboy3742 Feb 3, 2023
2ea497e
Fix and mark tests that aren't reliable
freakboy3742 Feb 6, 2023
c8e41b1
Updated dummy assertions to be simple functions.
freakboy3742 Feb 6, 2023
a07ebde
GTK Button color tests passing.
freakboy3742 Feb 7, 2023
e6c3096
Add a warning about UI animations.
freakboy3742 Feb 8, 2023
163fa97
Re-enable the button size test.
freakboy3742 Feb 16, 2023
8c24cbe
Correct handling of color for non-button widgets.
freakboy3742 Feb 16, 2023
df7c13e
Remove refresh calls that aren't needed any more.
freakboy3742 Feb 16, 2023
d1fdf8b
Removed the xfail marker from some tests.
freakboy3742 Feb 16, 2023
2e7f8d0
Modified the color test to assert all components in one assertion.
freakboy3742 Feb 20, 2023
da9c1ba
Use a programmatic approach to disable animations.
freakboy3742 Feb 20, 2023
50c4fee
iOS Button tests to 100%.
freakboy3742 Feb 22, 2023
4a2944f
iOS button to 100%.
freakboy3742 Feb 24, 2023
fe92bb9
Partial fixes for Android colors and fonts.
freakboy3742 Feb 24, 2023
73f0c5a
Implement `await redraw` for Android
mhsmith Feb 26, 2023
2ff0e95
Fix Android font size calculation
mhsmith Feb 26, 2023
e6ed1c1
Fix button background color
mhsmith Feb 27, 2023
db63ecc
Modify font size and font handling.
freakboy3742 Feb 28, 2023
493e722
Add support for resetting foreground color.
freakboy3742 Feb 28, 2023
c3d5c8a
Ensure size probes return SP not DP.
freakboy3742 Feb 28, 2023
542faf7
Use del rather than assigning None to clear style.
freakboy3742 Feb 28, 2023
d3581ec
Don't allow newlines in button text.
freakboy3742 Feb 28, 2023
e1458ba
Correct label color tests.
freakboy3742 Feb 28, 2023
32451bd
Button at 100% on all tested platforms!
freakboy3742 Feb 28, 2023
c788a8c
Rework the EventLog so it is global.
freakboy3742 Feb 28, 2023
da5105a
Disallow empty labels on buttons.
freakboy3742 Feb 28, 2023
5bf1cbb
Revert a libs restructure.
freakboy3742 Feb 28, 2023
29924f0
More tweaks to the dummy test assertions.
freakboy3742 Feb 28, 2023
7e2bc2d
Removed a redundant background color implementation.
freakboy3742 Feb 28, 2023
8211f8b
Add notes about button text restrictions.
freakboy3742 Feb 28, 2023
8cd8531
Merge branch 'main' into audit-button
freakboy3742 Mar 5, 2023
857d899
Change `= None` tests to `del`, for compatibility with travertino mai…
mhsmith Mar 13, 2023
7bd87a5
Fix Android font size, and add font size reset test
mhsmith Mar 13, 2023
16ec542
Add memory retention for cached font instances.
freakboy3742 Mar 13, 2023
8bd9528
Merge branch 'system-ci' into audit-button
mhsmith Mar 14, 2023
e83f2fa
Allow default font to be returned as SANS_SERIF as well as SYSTEM
mhsmith Mar 14, 2023
81e2d29
Add examples/font_size
mhsmith Mar 14, 2023
02a345d
Add bold and italic font tests (working on Android, Cocoa and iOS)
mhsmith Mar 16, 2023
9248973
Add bold and italic font tests (working on GTK and Winforms)
mhsmith Mar 17, 2023
45e52e6
Remove redundant set_font methods in dummy widgets
mhsmith Mar 17, 2023
8445dae
Merge branch 'main' into audit-button
freakboy3742 Mar 20, 2023
c646ef0
Improve comments
mhsmith Mar 20, 2023
e2da16b
Move generic font mapping assertions to tests_backend (Android, Cocoa…
mhsmith Mar 20, 2023
926c3d6
Move generic font mapping assertions to tests_backend (GTK)
mhsmith Mar 20, 2023
7f96efa
Move generic font mapping assertions to tests_backend (Winforms)
mhsmith Mar 20, 2023
36ed554
Fix typos
mhsmith Mar 20, 2023
091e3ec
Allow Button text to be set to an empty string, and make Winforms dis…
mhsmith Mar 20, 2023
dd73a9b
Use subclassing rather than an isinstance check.
freakboy3742 Mar 20, 2023
cfdc3e5
Revert the use of an interface state variable for button text.
freakboy3742 Mar 21, 2023
ce54201
Mark some classes with Test in the name as not-tests.
freakboy3742 Mar 21, 2023
5abe2f1
Tweak section heading.
freakboy3742 Mar 21, 2023
f76c90a
Modify the winforms button probe to do ZWS normalization.
freakboy3742 Mar 21, 2023
8f55716
Use correct zero width space character, and remove unnecessary workar…
mhsmith Mar 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Correct handling of color for non-button widgets.
  • Loading branch information
freakboy3742 committed Feb 25, 2023
commit 8c24cbe9f233642552fa1d0a1a0dfd2aef457531
5 changes: 3 additions & 2 deletions gtk/tests_backend/widgets/button.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from toga.colors import TRANSPARENT
from toga_gtk.libs import Gtk

from .base import SimpleProbe
Expand All @@ -13,8 +14,8 @@ def text(self):
@property
def background_color(self):
color = super().background_color
# Background color of
if color.r == 0 and color.g == 0 and color.b == 0 and color.a == 0.0:
# Background color of TRANSPARENT is treated as a reset.
if color == TRANSPARENT:
return None
return color

Expand Down
10 changes: 8 additions & 2 deletions gtk/tests_backend/widgets/properties.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
from travertino.fonts import Font

from toga.colors import rgba
from toga.colors import TRANSPARENT, rgba
from toga.style.pack import CENTER, JUSTIFY, LEFT, RIGHT
from toga_gtk.libs import Gtk, Pango


def toga_color(color):
if color:
return rgba(
c = rgba(
int(color.red * 255),
int(color.green * 255),
int(color.blue * 255),
color.alpha,
)

# Background color of rgba(0,0,0,0.0) is TRANSPARENT.
if c.r == 0 and c.g == 0 and c.b == 0 and c.a == 0.0:
return TRANSPARENT
else:
return c
else:
return None

Expand Down