Skip to content

Commit

Permalink
feat(test): complete test cases of flex_direction_test and layout_mac…
Browse files Browse the repository at this point in the history
…ro_test
  • Loading branch information
meloalright committed Nov 12, 2024
1 parent c8c6e31 commit 2293ff6
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 22 deletions.
14 changes: 10 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ pub struct TaitankSafeNode {
unique_ptr: UniquePtr<ffi::TaitankSafeNode>,
}

// impl Drop for TaitankSafeNode {
// fn drop(&mut self) {
// ffi::
// }
// }

#[repr(i32)]
pub enum Direction {
Inherit = 0,
Expand All @@ -17,10 +23,10 @@ pub enum Direction {

#[repr(i32)]
pub enum FlexDirection {
FlexDirectionRow,
FlexDirectionRowReverse,
FlexDirectionColumn,
FlexDirectionColumnReverse,
FlexDirectionRow = 0,
FlexDirectionRowReverse = 1,
FlexDirectionColumn = 2,
FlexDirectionColumnReverse = 3,
}

pub fn node_create() -> TaitankSafeNode {
Expand Down
8 changes: 4 additions & 4 deletions src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#[macro_export]
macro_rules! layout {
($a:expr, $b:expr, $c:expr, $d:expr) => {
do_layout($a, $b, $c, $d)
$crate::do_layout($a, $b, $c, $d)
};

($a:expr, $b:expr, $c:expr) => {
do_layout($a, $b, $c, Direction::LTR)
$crate::do_layout($a, $b, $c, $crate::Direction::LTR)
};

($a:expr, $b:expr) => {
do_layout($a, $b, std::f64::NAN, Direction::LTR)
$crate::do_layout($a, $b, std::f64::NAN, $crate::Direction::LTR)
};

($a:expr) => {
do_layout($a, std::f64::NAN, std::f64::NAN, Direction::LTR)
$crate::do_layout($a, std::f64::NAN, std::f64::NAN, $crate::Direction::LTR)
};
}
1 change: 1 addition & 0 deletions src/safe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ TaitankSafeNode::TaitankSafeNode() {
}

TaitankSafeNode::~TaitankSafeNode() {
// printf("[cxx]: TaitankSafeNode::~TaitankSafeNode()\n");
taitank::NodeFreeRecursive(ptr);
}

Expand Down
Loading

0 comments on commit 2293ff6

Please sign in to comment.