imgui-rs/src/test.rs
2019-06-27 22:12:25 +03:00

16 lines
399 B
Rust

use parking_lot::{ReentrantMutex, ReentrantMutexGuard};
use std::ptr;
use crate::context::Context;
lazy_static! {
pub static ref TEST_MUTEX: ReentrantMutex<()> = ReentrantMutex::new(());
}
pub fn test_ctx() -> (ReentrantMutexGuard<'static, ()>, Context) {
let guard = TEST_MUTEX.lock();
let mut ctx = Context::create();
ctx.io_mut().ini_filename = ptr::null();
(guard, ctx)
}