added basic enums

This commit is contained in:
Nickiel12 2021-12-10 16:02:18 -08:00
parent a6cacbbd58
commit 1699c771c8
4 changed files with 76 additions and 12 deletions

View file

@ -1,12 +1,11 @@
pub enum CameraScenes {
#[derive(PartialEq, Debug)]
pub enum Scenes {
CameraDefault,
CameraWithUpperRight,
CameraWithLargeUpperRight,
CameraWithLowerRight,
}
pub enum ScreenScenes {
ScreenDefault,
ScreenWithUpperRight,
ScreenWithLowerRight,

View file

@ -1,2 +1,46 @@
use super::enums::{self};
pub struct StreamStates {
pub stream_running: bool,
pub stream_is_muted: bool,
pub computer_sound_is_on: bool,
pub change_scene_on_change_slide_hotkey: bool,
pub scene_is_augmented: bool,
pub timer_can_run: bool,
pub timer_length: f32,
pub timer_text: String,
pub current_scene: enums::Scenes,
pub camera_sub_scene: enums::Scenes,
pub screen_sub_scene: enums::Scenes,
}
impl Default for StreamStates {
fn default() -> Self {
StreamStates {
stream_running: false,
stream_is_muted: false,
computer_sound_is_on: true,
change_scene_on_change_slide_hotkey: true,
scene_is_augmented: false,
timer_can_run: true,
timer_length: 15.0,
timer_text: String::from("0.0"),
current_scene: enums::Scenes::CameraDefault,
camera_sub_scene: enums::Scenes::CameraDefault,
screen_sub_scene: enums::Scenes::ScreenDefault,
}
}
}
impl StreamStates {
pub fn new() -> Self {
StreamStates{..Default::default()}
}
}

View file

@ -5,20 +5,43 @@ use crate::modules::stream_states as s_s;
fn has_all_enums() {
{
let members = [
s_s::enums::CameraScenes::CameraDefault,
s_s::enums::CameraScenes::CameraWithUpperRight,
s_s::enums::CameraScenes::CameraWithLowerRight,
s_s::enums::CameraScenes::CameraWithLargeUpperRight,
s_s::enums::Scenes::CameraDefault,
s_s::enums::Scenes::CameraWithUpperRight,
s_s::enums::Scenes::CameraWithLowerRight,
s_s::enums::Scenes::CameraWithLargeUpperRight,
];
assert_eq!(members.len(), 4);
}
{
let members = [
s_s::enums::ScreenScenes::ScreenDefault,
s_s::enums::ScreenScenes::ScreenWithUpperRight,
s_s::enums::ScreenScenes::ScreenWithLowerRight,
s_s::enums::Scenes::ScreenDefault,
s_s::enums::Scenes::ScreenWithUpperRight,
s_s::enums::Scenes::ScreenWithLowerRight,
];
assert_eq!(members.len(), 3);
}
}
#[test]
fn create_stream_states_class() {
let stream_state = s_s::stream_states_class::StreamStates::new();
assert_eq!(stream_state.stream_running, false);
assert_eq!(stream_state.stream_is_muted, false);
assert_eq!(stream_state.computer_sound_is_on, true);
assert_eq!(stream_state.change_scene_on_change_slide_hotkey, true);
assert_eq!(stream_state.scene_is_augmented, false);
assert_eq!(stream_state.timer_text, "0.0");
assert_eq!(stream_state.timer_length, 15.0);
assert_eq!(stream_state.timer_can_run, true);
assert_eq!(stream_state.current_scene, s_s::enums::Scenes::CameraDefault);
assert_eq!(stream_state.camera_sub_scene, s_s::enums::Scenes::CameraDefault);
assert_eq!(stream_state.screen_sub_scene, s_s::enums::Scenes::ScreenDefault);
}
#[test]
fn sub_scene_correctness(){
assert_eq!(true, false, "not implemented yet");
}

View file

@ -4,5 +4,3 @@ fn it_works() {
let result = 2 + 2;
assert_eq!(result, 4);
}
//Stream States Tests