use crate::{Nc, NcCell, NcChannels, NcPlane, NcStyle};
use serial_test::serial;
#[test]
#[serial]
fn constructors() -> crate::NcResult<()> {
let nc = unsafe { Nc::new()? };
let plane = NcPlane::new_pile_sized(nc, 0, 0, 10, 10)?;
let mut cell = NcCell::new();
assert![NcCell::from_char7b('e').is_ok()];
assert![NcCell::from_char7b('é').is_err()];
let c1 = NcCell::from_char7b('a')?;
let c2 = NcCell::from_char7b('b')?;
assert_ne![c1, c2];
let mut c1d = c1.duplicate(plane)?;
assert_eq![c1d, c1];
c1d.init();
assert_ne![c1d, c1];
assert_eq![c1d, NcCell::new()];
assert![NcCell::from_char(plane, 'é').is_ok()];
#[cfg(not(target_os = "macos"))] assert![NcCell::from_char(plane, '௵').is_ok()];
assert![NcCell::from_str(plane, "௵").is_ok()];
let c = NcCell::from_str(plane, "←↓→");
assert![c.is_ok()];
assert_eq![1, NcCell::load(plane, &mut cell, "e")?];
assert_eq![2, NcCell::load(plane, &mut cell, "é")?];
assert_eq![3, NcCell::load(plane, &mut cell, "௵")?];
assert_eq![4, NcCell::load(plane, &mut cell, "🚀")?];
assert_eq![17, NcCell::load(plane, &mut cell, "🤦🏼♂️")?];
assert_eq![
4,
NcCell::prime(
plane,
&mut cell,
"🚀",
NcStyle::Underline,
NcChannels::from_rgb_both(0x112233)
)?
];
assert_eq![NcStyle::Underline, cell.styles()];
assert_eq![NcChannels::from_rgb_both(0x112233), cell.channels()];
cell.release(plane);
plane.destroy()?;
unsafe { nc.stop()? };
Ok(())
}