From 1a244a3d6bd124563ce47f0917a5ee74fc898c67 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 1 Sep 2017 20:28:08 +0200 Subject: [PATCH] Add setget test --- lib/entry/libimagentrygps/src/entry.rs | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/entry/libimagentrygps/src/entry.rs b/lib/entry/libimagentrygps/src/entry.rs index 29b06e9b..b1d1d198 100644 --- a/lib/entry/libimagentrygps/src/entry.rs +++ b/lib/entry/libimagentrygps/src/entry.rs @@ -87,5 +87,37 @@ mod tests { assert!(res.is_ok()); } + + #[test] + fn test_setget_gps() { + setup_logging(); + + let store = get_store(); + + let mut entry = store.create(PathBuf::from("test_setget_gps")).unwrap(); + + let coordinates = Coordinates { + latitude: GPSValue::new(0, 0, 0), + longitude: GPSValue::new(0, 0, 0), + }; + + let res = entry.set_coordinates(coordinates); + assert!(res.is_ok()); + + let coordinates = entry.get_coordinates(); + + assert!(coordinates.is_ok()); + let coordinates = coordinates.unwrap(); + + assert!(coordinates.is_some()); + let coordinates = coordinates.unwrap(); + + assert_eq!(0, coordinates.longitude.degree); + assert_eq!(0, coordinates.longitude.minutes); + assert_eq!(0, coordinates.longitude.seconds); + assert_eq!(0, coordinates.latitude.degree); + assert_eq!(0, coordinates.latitude.minutes); + assert_eq!(0, coordinates.latitude.seconds); + } }