diff --git a/plasma/node.py b/plasma/node.py index aca45be..944130e 100644 --- a/plasma/node.py +++ b/plasma/node.py @@ -390,15 +390,6 @@ def min_size_bound(self): def reset_size(self): self._size = None - def grow(self, amt, orient=None): - # TODO Deprecate grow, it should be replaced by size assignment - if self.is_root: - return - if orient is ~self.parent.orient: - self.parent.grow(amt) - return - self.size += amt - @property def flexible(self): """A node is flexible if its size isn't (explicitly or implictly) diff --git a/tests/test_node.py b/tests/test_node.py index 9d6ce45..db3946f 100644 --- a/tests/test_node.py +++ b/tests/test_node.py @@ -2,7 +2,7 @@ from pytest import approx from plasma.debug import draw, info # noqa -from plasma.node import Node, VERTICAL, HORIZONTAL, AddMode, NotRestorableError +from plasma.node import Node, HORIZONTAL, AddMode, NotRestorableError from .conftest import Nodes @@ -68,8 +68,8 @@ def test_add_child_after_with_sizes(self, root): a, b, c = Nodes('a b c') root.add_child(a) root.add_child(b) - a.grow(10) - b.grow(10) + a.size += 10 + b.size += 10 b.parent.add_child_after(c, b) assert a.size == b.size == c.size == 40 @@ -450,7 +450,7 @@ def test_capacity2(self, root): def test_resize(self, root, grid): a, b, c, d, e = grid - a.grow(10) + a.size += 10 assert a.width == a.size == 70 assert b.height == b.size == 25 assert b.width == 50 @@ -460,10 +460,10 @@ def test_resize(self, root, grid): assert c.pos == (70, 25) assert d.pos == (70 + 50/3, 25) assert e.pos == (70 + (50/3)*2, 25) - b.grow(-5) + b.size -= 5 assert c.width == d.width == e.width == 50/3 assert c.height == d.height == e.height == 30 - d.grow(5) + d.size += 5 assert d.width == 50/3 + 5 d.move_up() assert d.size == (50 - b.size) / 2 @@ -511,11 +511,11 @@ def test_resize_absolute_and_relative2(self, root): root.add_child(a) root.add_child(b) root.add_child(c) - a.grow(10) + a.size += 10 assert a.size == 50 assert b.size == 35 assert c.size == 35 - b.grow(10) + b.size += 10 assert a.size == 50 assert b.size == 45 assert c.size == 25 @@ -540,7 +540,7 @@ def test_resize_flat(self, root): def test_resize_minimum(self, grid): a, b, c, d, e = grid - b.grow(-100) + b.size -= 100 assert b.size == 10 def test_resize_all_absolute_underflow(self, root, grid): @@ -607,7 +607,7 @@ def test_resize_only_absolute_remains(self, root): def test_reset_size(self, grid): a, b, c, d, e = grid - a.grow(5) + a.size += 5 assert a.size == 65 a.reset_size() assert a.size == 60 @@ -616,7 +616,7 @@ def test_size_after_split(self, root): a, b, c = Nodes('a b c') root.add_child(a) root.add_child(b) - b.grow(-20) + b.size -= 20 b.flip_with(c) assert b.parent.size == 40 assert b.size == c.size == 25 @@ -642,7 +642,7 @@ def test_resize_parents(self, root): root.add_child(a) root.add_child(b) b.flip_with(c) - b.grow(10, HORIZONTAL) + b.width += 10 assert b.parent.size == 70 assert b.size == c.size == 25 @@ -673,9 +673,9 @@ def test_resize_root(self, root): a, b, c = Nodes('a b c') root.add_child(a) root.add_child(b) - a.grow(10, orient=VERTICAL) - root.grow(10, orient=VERTICAL) - root.grow(10, orient=HORIZONTAL) + a.height += 10 + root.height += 10 + root.width += 10 root.size = 10 assert a._size is b._size is root._size is None