| 1 | import datatypes { DoublyLinkedList } |
| 2 | |
| 3 | pub type LayoutBoxId = usize |
| 4 | |
| 5 | pub struct LayoutBox { |
| 6 | } |
| 7 | |
| 8 | pub struct LayoutTree { |
| 9 | mut: |
| 10 | root ?LayoutBoxId |
| 11 | boxes []LayoutBox |
| 12 | } |
| 13 | |
| 14 | pub fn LayoutTree.new() LayoutTree { |
| 15 | return LayoutTree{ |
| 16 | root: ?LayoutBoxId(none) |
| 17 | boxes: []LayoutBox{} |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | fn test_main() { |
| 22 | mut tree := LayoutTree.new() |
| 23 | tree.root = 1 |
| 24 | if tree.root != none { |
| 25 | mut parents := DoublyLinkedList[LayoutBoxId]{} |
| 26 | parents.push_back(tree.root) |
| 27 | assert parents.len == 1 |
| 28 | } else { |
| 29 | assert false |
| 30 | } |
| 31 | } |
| 32 | |