Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unlimitedbacon committed Nov 4, 2018
1 parent 3e17674 commit 9367b83
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
language: rust
addons:
apt:
packages:
- libxxf86vm-dev
- libosmesa6-dev
cache: cargo
before_install:
- cargo install cargo-deb || echo "cargo-deb already installed"
script:
- cargo build --verbose
# Disable testing for now until headless context is working
# - cargo test --verbose
- cargo build
# Ubuntu 14.04 is too old to support headless mode.
# Have to wait until Travis upgrades to 16.04.
#- RUST_BACKTRACE=1 xvfb-run cargo test
before_deploy:
- mkdir target/deploy/
- cargo build --release
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ pub fn run(config: &Config) -> Result<(), Box<Error>> {
},
Err(e) => {
warn!("Unable to create headless GL context. Trying hidden window instead. Reason: {:?}", e);
println!("Unable to create headless GL context. Trying hidden window instead. Reason: {:?}", e);
let (display, _) = create_normal_display(&config)?;
let texture = glium::Texture2d::empty(&display, config.width, config.height).unwrap();
let depthtexture = glium::texture::DepthTexture2d::empty(&display, config.width, config.height).unwrap();
Expand All @@ -308,15 +309,17 @@ mod tests {

#[test]
fn cube() {
let img_filename = "cube.png".to_string();
let config = Config {
stl_filename: "test_data/cube.stl".to_string(),
img_filename: "cube.png".to_string(),
img_filename: Some(img_filename.clone()),
width: 1024,
height: 768,
visible: false,
verbosity: 2,
};

match fs::remove_file(&config.img_filename) {
match fs::remove_file(&img_filename) {
Ok(_) => (),
Err(ref error) if error.kind() == ErrorKind::NotFound => (),
Err(_) => {
Expand All @@ -326,7 +329,7 @@ mod tests {

run(&config).expect("Error in run function");

let size = fs::metadata(config.img_filename)
let size = fs::metadata(img_filename)
.expect("No file created")
.len();

Expand Down

0 comments on commit 9367b83

Please sign in to comment.