mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-18 07:27:43 +00:00
import and export of routes, ref #192
This commit is contained in:
1 parent
da9abbae5e
commit
dc36de2a48
10 files changed
+620
-62
No files matched your search
@@ -112,7 +112,10 @@ fn test_unknown_file_has_no_structure() {
|
||||
assert!(crate::queries::files::file_structure(&id).is_undefined());
|
||||
assert!(crate::queries::files::file_structure("not an id").is_undefined());
|
||||
assert!(crate::queries::files::file_statistics(&id).is_undefined());
|
||||
assert!(crate::queries::files::export_file(&id, true, true, true, true, true, true).is_none());
|
||||
assert!(
|
||||
crate::queries::files::export_file(&id, true, true, true, true, true, true, false)
|
||||
.is_none()
|
||||
);
|
||||
assert_eq!(
|
||||
crate::queries::coordinates::segment_coordinates(&id).length(),
|
||||
0
|
||||
@@ -265,7 +268,8 @@ fn test_export_and_exportable_data() {
|
||||
let ids = order();
|
||||
|
||||
let bytes =
|
||||
crate::queries::files::export_file(&ids[0], true, true, true, true, true, true).unwrap();
|
||||
crate::queries::files::export_file(&ids[0], true, true, true, true, true, true, false)
|
||||
.unwrap();
|
||||
assert!(String::from_utf8(bytes).unwrap().contains("<gpx"));
|
||||
|
||||
// the time is the first bit
|
||||
@@ -284,6 +288,23 @@ fn test_export_and_exportable_data() {
|
||||
assert_eq!(crate::queries::files::exportable_data(&[1, 2, 3]), 0);
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn test_export_as_route() {
|
||||
started_with(&[(SIMPLE, "plain")]);
|
||||
let id = order().remove(0);
|
||||
let text = |as_route| {
|
||||
let bytes =
|
||||
crate::queries::files::export_file(&id, true, true, true, true, true, true, as_route)
|
||||
.unwrap();
|
||||
String::from_utf8(bytes).unwrap()
|
||||
};
|
||||
let tracks = text(false);
|
||||
assert!(tracks.contains("<trk>") && !tracks.contains("<rte>"));
|
||||
let routes = text(true);
|
||||
assert!(routes.contains("<rte>") && !routes.contains("<trk>"));
|
||||
assert!(routes.contains("<rtept"));
|
||||
}
|
||||
|
||||
#[wasm_bindgen_test]
|
||||
fn test_select_and_reorder_files() {
|
||||
started_with(&[(SIMPLE, "a"), (WITH_TIME, "b")]);
|
||||
|
||||
Reference in new issue
Block a user