<commit_before>extern crate anduin;
extern crate winit;//TODO: no 3rd party crates in tests

use anduin::logic::{Actable, lcm, Application};
use anduin::core;
use anduin::input::{InputProcessor, Key};
use anduin::graphics::Drawable;
use anduin::audio::{music, sound, PlaybackController};
use std::thread::sleep;
use std::time::Duration;

fn create_test_app() {
    let mut application = Application::new("Anduin", "desktop", Some(5));
    println!("application created");
    let game_loop = lcm::GameLoop::new();
    println!("game_loop created");
    application.input.add_input_processor(Box::new(anduin::InputProcessorStuct{}));
    println!("add_input_processor finished");
    game_loop.run(&mut application);
    println!("game_loop runned");
    application.exit();
}

#[test]
fn play_sound() {
    let music = music::Music::new("resources/music.ogg");
    let sound = sound::Sound::new("resources/shot.wav");
    music.play();
    sound.play();
    sleep(Duration::from_millis(5000));
}

#[test]
fn create_game_loop() {
    let game_loop = lcm::GameLoop::new();
    println!("Loop is created {:?}", game_loop);
}

#[test]
fn create_simple_scene() {
    let scene = core::scene::Stage {root: core::scene::Node::new("Root Node")};
    println!("Simple scene is created {:?}", scene);
}

fn create_simple_game()
{
    let scene = core::scene::Stage {
        root: core::scene::Node::build("Root Node", Actor{}, Control{}, Image{})
    };
    scene.update();
}

struct Actor {

}
struct Image {

}
struct Control {

}


impl Actable for Actor {
    fn update(&self) {
        println!("Update self");
    }
}

impl Drawable for Image {
    fn draw(&self) {
        println!("Draw self");
    }
}

impl InputProcessor for Control {
        fn key_down(&self, key: Key)
        {
            println!("Keypushed down: {:?}", key)
        }
    	fn key_up(&self, key: Key)
        {
            println!("Keypushed up: {:?}", key)
        }
}

/*
Simple game TC
Game game = new Game(width, height, title);<commit_msg>Test gitlab integration with github<commit_after>extern crate anduin;
extern crate winit;//TODO: no 3rd party crates in tests

use anduin::logic::{Actable, lcm, Application};
use anduin::core;
use anduin::input::{InputProcessor, Key};
use anduin::graphics::Drawable;
use anduin::audio::{music, sound, PlaybackController};
use std::thread::sleep;
use std::time::Duration;

fn create_test_app() {
    let mut application = Application::new("Anduin", "desktop", Some(5));
    println!("application created");
    let game_loop = lcm::GameLoop::new();
    println!("game_loop created");
    application.input.add_input_processor(Box::new(anduin::InputProcessorStuct{}));
    println!("add_input_processor finished");
    game_loop.run(&mut application);
    println!("game_loop runned");
    application.exit();
}

#[test]
fn play_sound() {
    let music = music::Music::new("resources/music.ogg");
    let sound = sound::Sound::new("resources/shot.wav");
    music.play();
    sound.play();
    sleep(Duration::from_millis(5000));
}

#[test]
fn create_game_loop() {
    let game_loop = lcm::GameLoop::new();
    println!("Loop is created {:?}", game_loop);
}

#[test]
fn create_simple_scene() {
    let scene = core::scene::Stage {root: core::scene::Node::new("Root Node")};
    println!("Simple scene is created {:?}", scene);
}

fn create_simple_game()
{
    let scene = core::scene::Stage {
        root: core::scene::Node::build("Root Node", Actor{}, Control{}, Image{})
    };
    scene.update();
}

struct Actor {

}
struct Image {

}
struct Control {

}


impl Actable for Actor {
    fn update(&self) {
        println!("Updating self");
    }
}

impl Drawable for Image {
    fn draw(&self) {
        println!("Drawing self");
    }
}

impl InputProcessor for Control {
        fn key_down(&self, key: Key)
        {
            println!("Keypushed down: {:?}", key)
        }
    	fn key_up(&self, key: Key)
        {
            println!("Keypushed up: {:?}", key)
        }
}

/*
Simple game TC
Game game = new Game(width, height, title);
{'fraction_non_alphanumeric': 0.1706417506761741, 'fraction_numerical': 0.0029505778214900416, 'mean_word_length': 3.8486293206197852, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6024871', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1310, 'n_words': 305}