|
|
@ -13,9 +13,9 @@ fn rgb() {
|
|
|
|
assert_eq![0, crate::nccell_fg_rgb(&c1)];
|
|
|
|
assert_eq![0, crate::nccell_fg_rgb(&c1)];
|
|
|
|
assert_eq![0, crate::nccell_bg_rgb(&c1)];
|
|
|
|
assert_eq![0, crate::nccell_bg_rgb(&c1)];
|
|
|
|
|
|
|
|
|
|
|
|
crate::cell_set_fg_rgb(&mut c1, 0x99112233);
|
|
|
|
crate::nccell_set_fg_rgb(&mut c1, 0x99112233);
|
|
|
|
assert_eq![0x112233, crate::nccell_fg_rgb(&c1)];
|
|
|
|
assert_eq![0x112233, crate::nccell_fg_rgb(&c1)];
|
|
|
|
crate::cell_set_bg_rgb(&mut c1, 0x99445566);
|
|
|
|
crate::nccell_set_bg_rgb(&mut c1, 0x99445566);
|
|
|
|
assert_eq![0x445566, crate::nccell_bg_rgb(&c1)];
|
|
|
|
assert_eq![0x445566, crate::nccell_bg_rgb(&c1)];
|
|
|
|
|
|
|
|
|
|
|
|
// rgb8
|
|
|
|
// rgb8
|
|
|
@ -23,12 +23,12 @@ fn rgb() {
|
|
|
|
let mut c2 = NcCell::new();
|
|
|
|
let mut c2 = NcCell::new();
|
|
|
|
let (mut r, mut g, mut b) = (0, 0, 0);
|
|
|
|
let (mut r, mut g, mut b) = (0, 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
crate::cell_set_fg_rgb8(&mut c2, 0x11, 0x22, 0x33);
|
|
|
|
crate::nccell_set_fg_rgb8(&mut c2, 0x11, 0x22, 0x33);
|
|
|
|
let fchannel = crate::nccell_fg_rgb8(&c2, &mut r, &mut g, &mut b);
|
|
|
|
let fchannel = crate::nccell_fg_rgb8(&c2, &mut r, &mut g, &mut b);
|
|
|
|
assert_eq!((0x11, 0x22, 0x33), (r, g, b));
|
|
|
|
assert_eq!((0x11, 0x22, 0x33), (r, g, b));
|
|
|
|
assert_eq![0x112233, fchannel & !crate::NCCELL_BGDEFAULT_MASK];
|
|
|
|
assert_eq![0x112233, fchannel & !crate::NCCELL_BGDEFAULT_MASK];
|
|
|
|
|
|
|
|
|
|
|
|
crate::cell_set_bg_rgb8(&mut c2, 0x44, 0x55, 0x66);
|
|
|
|
crate::nccell_set_bg_rgb8(&mut c2, 0x44, 0x55, 0x66);
|
|
|
|
let bchannel = crate::nccell_bg_rgb8(&c2, &mut r, &mut g, &mut b);
|
|
|
|
let bchannel = crate::nccell_bg_rgb8(&c2, &mut r, &mut g, &mut b);
|
|
|
|
assert_eq!((0x44, 0x55, 0x66), (r, g, b));
|
|
|
|
assert_eq!((0x44, 0x55, 0x66), (r, g, b));
|
|
|
|
assert_eq![0x445566, bchannel & !crate::NCCELL_BGDEFAULT_MASK];
|
|
|
|
assert_eq![0x445566, bchannel & !crate::NCCELL_BGDEFAULT_MASK];
|
|
|
@ -38,8 +38,8 @@ fn rgb() {
|
|
|
|
#[serial]
|
|
|
|
#[serial]
|
|
|
|
fn alpha() {
|
|
|
|
fn alpha() {
|
|
|
|
let mut c1 = NcCell::new();
|
|
|
|
let mut c1 = NcCell::new();
|
|
|
|
assert_eq![0, crate::cell_fg_alpha(&c1)];
|
|
|
|
assert_eq![0, crate::nccell_fg_alpha(&c1)];
|
|
|
|
assert_eq![0, crate::cell_bg_alpha(&c1)];
|
|
|
|
assert_eq![0, crate::nccell_bg_alpha(&c1)];
|
|
|
|
|
|
|
|
|
|
|
|
crate::nccell_set_fg_alpha(&mut c1, crate::NCCELL_ALPHA_TRANSPARENT);
|
|
|
|
crate::nccell_set_fg_alpha(&mut c1, crate::NCCELL_ALPHA_TRANSPARENT);
|
|
|
|
assert_eq![crate::NCCELL_ALPHA_TRANSPARENT, crate::nccell_fg_alpha(&c1)];
|
|
|
|
assert_eq![crate::NCCELL_ALPHA_TRANSPARENT, crate::nccell_fg_alpha(&c1)];
|
|
|
@ -56,20 +56,20 @@ fn default() {
|
|
|
|
assert_eq![true, crate::nccell_bg_default_p(&c1)];
|
|
|
|
assert_eq![true, crate::nccell_bg_default_p(&c1)];
|
|
|
|
|
|
|
|
|
|
|
|
// rgb
|
|
|
|
// rgb
|
|
|
|
crate::cell_set_fg_rgb(&mut c1, 0x112233);
|
|
|
|
crate::nccell_set_fg_rgb(&mut c1, 0x112233);
|
|
|
|
crate::cell_set_bg_rgb(&mut c1, 0x445566);
|
|
|
|
crate::nccell_set_bg_rgb(&mut c1, 0x445566);
|
|
|
|
assert_eq![false, crate::nccell_fg_default_p(&c1)];
|
|
|
|
assert_eq![false, crate::nccell_fg_default_p(&c1)];
|
|
|
|
assert_eq![false, crate::nccell_bg_default_p(&c1)];
|
|
|
|
assert_eq![false, crate::nccell_bg_default_p(&c1)];
|
|
|
|
|
|
|
|
|
|
|
|
// reset
|
|
|
|
// reset
|
|
|
|
crate::cell_set_fg_default(&mut c1);
|
|
|
|
crate::nccell_set_fg_default(&mut c1);
|
|
|
|
crate::cell_set_bg_default(&mut c1);
|
|
|
|
crate::nccell_set_bg_default(&mut c1);
|
|
|
|
assert_eq![true, crate::nccell_fg_default_p(&c1)];
|
|
|
|
assert_eq![true, crate::nccell_fg_default_p(&c1)];
|
|
|
|
assert_eq![true, crate::nccell_bg_default_p(&c1)];
|
|
|
|
assert_eq![true, crate::nccell_bg_default_p(&c1)];
|
|
|
|
|
|
|
|
|
|
|
|
// rgb8
|
|
|
|
// rgb8
|
|
|
|
crate::cell_set_fg_rgb8(&mut c1, 0x11, 0x22, 0x33);
|
|
|
|
crate::nccell_set_fg_rgb8(&mut c1, 0x11, 0x22, 0x33);
|
|
|
|
crate::cell_set_bg_rgb8(&mut c1, 0x44, 0x55, 0x66);
|
|
|
|
crate::nccell_set_bg_rgb8(&mut c1, 0x44, 0x55, 0x66);
|
|
|
|
assert_eq![false, crate::nccell_fg_default_p(&c1)];
|
|
|
|
assert_eq![false, crate::nccell_fg_default_p(&c1)];
|
|
|
|
assert_eq![false, crate::nccell_bg_default_p(&c1)];
|
|
|
|
assert_eq![false, crate::nccell_bg_default_p(&c1)];
|
|
|
|
|
|
|
|
|
|
|
|