Skip to content

Commit

Permalink
Merge #341
Browse files Browse the repository at this point in the history
341: Fix windows tests r=metasim a=mwm126

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/gdal/blob/master/CODE_OF_CONDUCT.md).
- [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---



Co-authored-by: Mark Meredith <[email protected]>
Co-authored-by: Mark Meredith <[email protected]>
Co-authored-by: Mark Meredith <[email protected]>
  • Loading branch information
4 people authored Nov 21, 2022
2 parents f463ba6 + dfc37ee commit a9d2ba1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/raster/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,17 @@ fn test_create_with_band_type_with_options() {
},
];

let tmp_filename = "/tmp/test.tif";
let tmp_filename = TempFixture::empty("test.tif");
{
let dataset = driver
.create_with_band_type_with_options::<u8, _>(tmp_filename, 256, 256, 1, &options)
.create_with_band_type_with_options::<u8, _>(&tmp_filename, 256, 256, 1, &options)
.unwrap();
let rasterband = dataset.rasterband(1).unwrap();
let block_size = rasterband.block_size();
assert_eq!(block_size, (128, 64));
}

let dataset = Dataset::open(Path::new(tmp_filename)).unwrap();
let dataset = Dataset::open(tmp_filename).unwrap();
let key = "INTERLEAVE";
let domain = "IMAGE_STRUCTURE";
let meta = dataset.metadata_item(key, domain);
Expand Down
31 changes: 17 additions & 14 deletions src/vector/vector_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use super::{
OGRwkbGeometryType, OwnedLayer,
};
use crate::spatial_ref::SpatialRef;
use crate::test_utils::TempFixture;
use crate::{assert_almost_eq, Dataset, DatasetOptions, GdalOpenFlags};
mod convert_geo;
mod sql;
Expand Down Expand Up @@ -788,17 +789,19 @@ mod tests {
// dataset is closed here
}

let ds = Dataset::open(fixture!("output.geojson")).unwrap();
{
let ds = Dataset::open(fixture!("output.geojson")).unwrap();
let mut layer = ds.layer(0).unwrap();
let ft = layer.features().next().unwrap();
assert_eq!(ft.geometry().wkt().unwrap(), "POINT (1 2)");
assert_eq!(
ft.field("Name").unwrap().unwrap().into_string(),
Some("Feature 1".to_string())
);
assert_eq!(ft.field("Value").unwrap().unwrap().into_real(), Some(45.78));
assert_eq!(ft.field("Int_value").unwrap().unwrap().into_int(), Some(1));
}
fs::remove_file(fixture!("output.geojson")).unwrap();
let mut layer = ds.layer(0).unwrap();
let ft = layer.features().next().unwrap();
assert_eq!(ft.geometry().wkt().unwrap(), "POINT (1 2)");
assert_eq!(
ft.field("Name").unwrap().unwrap().into_string(),
Some("Feature 1".to_string())
);
assert_eq!(ft.field("Value").unwrap().unwrap().into_real(), Some(45.78));
assert_eq!(ft.field("Int_value").unwrap().unwrap().into_int(), Some(1));
}

#[test]
Expand Down Expand Up @@ -855,9 +858,9 @@ mod tests {
open_flags: GdalOpenFlags::GDAL_OF_UPDATE,
..DatasetOptions::default()
};
let tmp_file = "/tmp/test.s3db";
std::fs::copy(fixture!("three_layer_ds.s3db"), tmp_file).unwrap();
let ds = Dataset::open_ex(tmp_file, ds_options).unwrap();
let tmp_file = TempFixture::empty("test.s3db");
std::fs::copy(fixture!("three_layer_ds.s3db"), &tmp_file).unwrap();
let ds = Dataset::open_ex(&tmp_file, ds_options).unwrap();
let mut layer = ds.layer(0).unwrap();
let fids: Vec<u64> = layer.features().map(|f| f.fid().unwrap()).collect();
let feature = layer.feature(fids[0]).unwrap();
Expand All @@ -866,7 +869,7 @@ mod tests {
layer.set_feature(feature).ok();

// now we check that the field is 1.
let ds = Dataset::open(tmp_file).unwrap();
let ds = Dataset::open(&tmp_file).unwrap();
let layer = ds.layer(0).unwrap();
let feature = layer.feature(fids[0]).unwrap();
let value = feature.field("id").unwrap().unwrap().into_int().unwrap();
Expand Down

0 comments on commit a9d2ba1

Please sign in to comment.