Skip to content

Commit 9028396

Browse files
committed
tests 2
1 parent 77f5eb4 commit 9028396

File tree

2 files changed

+86
-43
lines changed

2 files changed

+86
-43
lines changed

src/rust/lib_ccxr/src/isdbs/isdbd.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -954,19 +954,19 @@ pub const DEFAULT_CLUT: [Rgba; 128] = [
954954
zata,
955955
];
956956

957-
#[repr(C)]
958-
pub struct disp_area {
959-
pub x: c_int,
960-
pub y: c_int,
961-
pub w: c_int,
962-
pub h: c_int,
963-
}
964-
965-
#[repr(C)]
966-
pub struct fscale {
967-
pub fscx: c_int,
968-
pub fscy: c_int,
969-
}
957+
// #[repr(C)]
958+
// pub struct disp_area {
959+
// pub x: c_int,
960+
// pub y: c_int,
961+
// pub w: c_int,
962+
// pub h: c_int,
963+
// }
964+
965+
// #[repr(C)]
966+
// pub struct fscale {
967+
// pub fscx: c_int,
968+
// pub fscy: c_int,
969+
// }
970970

971971
#[repr(C)]
972972
pub struct spacing {
@@ -993,9 +993,9 @@ pub enum CcxStreamMode {
993993
Program = 2,
994994
Asf = 3,
995995
McPoodlesRaw = 4,
996-
Rcwt = 5, // Raw Captions With Time, not used yet.
997-
Myth = 6, // Use the myth loop
998-
Mp4 = 7, // MP4, ISO-
996+
Rcwt = 5, // Raw Captions With Time, not used yet.
997+
Myth = 6, // Use the myth loop
998+
Mp4 = 7, // MP4, ISO-
999999
Wtv = 9,
10001000
Gxf = 11,
10011001
Mkv = 12,
@@ -1013,14 +1013,14 @@ pub enum CcxOutputDateFormat {
10131013
}
10141014

10151015
pub struct CcxEncodersTranscriptFormat {
1016-
show_start_time: i32, // Show start and/or end time.
1017-
show_end_time: i32, // Show start and/or end time.
1018-
show_mode: i32, // Show which mode if available (E.G.: POP, RU1, ...)
1019-
show_cc: i32, // Show which CC channel has been captured.
1016+
show_start_time: i32, // Show start and/or end time.
1017+
show_end_time: i32, // Show start and/or end time.
1018+
show_mode: i32, // Show which mode if available (E.G.: POP, RU1, ...)
1019+
show_cc: i32, // Show which CC channel has been captured.
10201020
relative_timestamp: i32, // Timestamps relative to start of sample or in UTC?
1021-
xds: i32, // Show XDS or not
1022-
use_colors: i32, // Add colors or no colors
1023-
is_final: i32, // Used to determine if these parameters should be changed afterwards.
1021+
xds: i32, // Show XDS or not
1022+
use_colors: i32, // Add colors or no colors
1023+
is_final: i32, // Used to determine if these parameters should be changed afterwards.
10241024
}
10251025

10261026
#[repr(i32)]
@@ -1267,4 +1267,4 @@ pub enum CcxStreamModeEnum {
12671267

12681268
pub struct CcxOptions {
12691269
pub messages_target: i32,
1270-
}
1270+
}

src/rust/lib_ccxr/src/isdbs/tests.rs

Lines changed: 62 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
extern crate libc;
2+
3+
use std::os::raw::{c_char, c_int, c_long, c_uchar, c_uint, c_ulonglong, c_void};
4+
25
use crate::isdbs::isdbd::*;
36
use crate::isdbs::isdbs::*;
47

@@ -111,11 +114,21 @@ mod tests {
111114
raster_color: 0,
112115
layout_state: ISDBSubLayout {
113116
format: WritingFormat::None,
114-
display_area: DisplayArea { x: 0, y: 0 },
117+
display_area: DispArea {
118+
x: 0,
119+
y: 0,
120+
w: 0,
121+
h: 0,
122+
},
115123
font_size: 0,
116-
font_scale: FontScale { fscx: 0, fscy: 0 },
124+
font_scale: FScale { fscx: 0, fscy: 0 },
117125
cell_spacing: 0,
118-
cursor_pos: DisplayArea { x: 0, y: 0 },
126+
cursor_pos: DispArea {
127+
x: 0,
128+
y: 0,
129+
w: 0,
130+
h: 0,
131+
},
119132
ccc: 0,
120133
acps: 0,
121134
},
@@ -140,11 +153,21 @@ mod tests {
140153
fn test_init_layout() {
141154
let mut layout = ISDBSubLayout {
142155
font_size: 0,
143-
display_area: DisplayArea { x: 0, y: 0 },
144-
font_scale: FontScale { fscx: 0, fscy: 0 },
156+
display_area: DispArea {
157+
x: 0,
158+
y: 0,
159+
w: 0,
160+
h: 0,
161+
},
162+
font_scale: FScale { fscx: 0, fscy: 0 },
145163
format: WritingFormat::None,
146164
cell_spacing: 0,
147-
cursor_pos: DisplayArea { x: 0, y: 0 },
165+
cursor_pos: DispArea {
166+
x: 0,
167+
y: 0,
168+
w: 0,
169+
h: 0,
170+
},
148171
ccc: 0,
149172
acps: 0,
150173
};
@@ -185,14 +208,24 @@ mod tests {
185208
fn test_init_layout_custom_values() {
186209
let mut layout = ISDBSubLayout {
187210
font_size: 50,
188-
display_area: DisplayArea { x: 10, y: 20 },
189-
font_scale: FontScale {
211+
display_area: DispArea {
212+
x: 10,
213+
y: 20,
214+
w: 0,
215+
h: 0,
216+
},
217+
font_scale: FScale {
190218
fscx: 150,
191219
fscy: 150,
192220
},
193221
format: WritingFormat::None,
194222
cell_spacing: 0,
195-
cursor_pos: DisplayArea { x: 0, y: 0 },
223+
cursor_pos: DispArea {
224+
x: 0,
225+
y: 0,
226+
w: 0,
227+
h: 0,
228+
},
196229
ccc: 0,
197230
acps: 0,
198231
};
@@ -549,7 +582,7 @@ mod tests {
549582
}
550583

551584
#[test]
552-
unsafe fn test_delete_isdb_decoder_with_entries() {
585+
fn test_delete_isdb_decoder_with_entries() {
553586
let mut ctx = ISDBSubContext {
554587
text_list_head: ListHead {
555588
next: ptr::null_mut(),
@@ -582,7 +615,7 @@ mod tests {
582615
next: ptr::null_mut(),
583616
prev: ptr::null_mut(),
584617
},
585-
buf: alloc(Layout::from_size_align(128, 1).unwrap()) as *mut i8,
618+
buf: unsafe { alloc(Layout::from_size_align(128, 1).unwrap()) as *mut i8 },
586619
used: 0,
587620
len: 128,
588621
pos: ISDBPos { x: 0, y: 0 },
@@ -596,7 +629,7 @@ mod tests {
596629
next: ptr::null_mut(),
597630
prev: ptr::null_mut(),
598631
},
599-
buf: alloc(Layout::from_size_align(128, 1).unwrap()) as *mut i8,
632+
buf: unsafe { alloc(Layout::from_size_align(128, 1).unwrap()) as *mut i8 },
600633
used: 0,
601634
len: 128,
602635
pos: ISDBPos { x: 0, y: 0 },
@@ -640,14 +673,24 @@ mod tests {
640673
fn test_allocate_text_node() {
641674
let layout = ISDBSubLayout {
642675
font_size: 36,
643-
display_area: DisplayArea { x: 0, y: 0 },
644-
font_scale: FontScale {
676+
display_area: DispArea {
677+
x: 0,
678+
y: 0,
679+
w: 0,
680+
h: 0,
681+
},
682+
font_scale: FScale {
645683
fscx: 100,
646684
fscy: 100,
647685
},
648686
format: WritingFormat::None,
649687
cell_spacing: 0,
650-
cursor_pos: DisplayArea { x: 0, y: 0 },
688+
cursor_pos: DispArea {
689+
x: 0,
690+
y: 0,
691+
w: 0,
692+
h: 0,
693+
},
651694
ccc: 0,
652695
acps: 0,
653696
};
@@ -785,7 +828,7 @@ mod tests {
785828
}
786829

787830
#[test]
788-
fn test_append_char() {
831+
fn test_append_char_1() {
789832
let mut ctx = ISDBSubContext {
790833
nb_char: 0,
791834
nb_line: 0,
@@ -858,7 +901,7 @@ mod tests {
858901
}
859902

860903
#[test]
861-
fn test_list_empty() {
904+
fn test_list_empty_1() {
862905
let mut head = ListHead {
863906
next: ptr::null_mut(),
864907
prev: ptr::null_mut(),
@@ -872,7 +915,7 @@ mod tests {
872915
}
873916

874917
#[test]
875-
fn test_append_char() {
918+
fn test_append_char_2() {
876919
let mut ctx = ISDBSubContext {
877920
nb_char: 0,
878921
nb_line: 0,
@@ -945,7 +988,7 @@ mod tests {
945988
}
946989

947990
#[test]
948-
fn test_list_empty() {
991+
fn test_list_empty_2() {
949992
let mut head = ListHead {
950993
next: ptr::null_mut(),
951994
prev: ptr::null_mut(),

0 commit comments

Comments
 (0)