Skip to content

Commit

Permalink
fix: hard update animations
Browse files Browse the repository at this point in the history
  • Loading branch information
muhlba91 committed Dec 14, 2023
1 parent 4d78e84 commit 63b341e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
7 changes: 3 additions & 4 deletions onyx_client/data/numeric_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ def update_with(self, other: Optional["NumericValue"]):
self.read_only = (
self.read_only if other.read_only is None else other.read_only
)
if self.animation is not None:
self.animation.update_with(other.animation)
else:
self.animation = other.animation
# if other.animation is None it would mean that the animation is cancelled by Onyx.
# in fact, we can just overwrite it no matter the value.
self.animation = other.animation

def __eq__(self, other):
if isinstance(self, other.__class__):
Expand Down
19 changes: 19 additions & 0 deletions tests/data/test_numeric_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,24 @@ def test_update_with_only_existing(self):
)
assert value == expected

def test_update_with_none_animation(self):
value = NumericValue(
10,
10,
100,
True,
)
expected = NumericValue(20, 20, 200, True, None)
value.update_with(
NumericValue(
20,
20,
200,
None,
None,
)
)
assert value == expected

def test_not_eq(self):
assert NumericValue(10, 10, 100, True) != 10

0 comments on commit 63b341e

Please sign in to comment.