Satisfy rustfmt and clippy on the album and folder picker changes
rustfmt over the files the albums work touched, and the album merge's incoming row as a named struct rather than an eight-field tuple, which clippy's type_complexity refused.
This commit is contained in:
@@ -661,18 +661,33 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
let filter = RatingFilter::default();
|
||||
let cells = read_cells_scoped(&catalog, Some(Scope::Collection(coll)), &filter, 0, 100).unwrap();
|
||||
let cells =
|
||||
read_cells_scoped(&catalog, Some(Scope::Collection(coll)), &filter, 0, 100).unwrap();
|
||||
assert_eq!(cells.len(), 2);
|
||||
for (i, cell) in cells.iter().enumerate() {
|
||||
assert_eq!(
|
||||
ordinal_of_path(&catalog, Some(Scope::Collection(coll)), &filter, false, &cell.remote_path).unwrap(),
|
||||
ordinal_of_path(
|
||||
&catalog,
|
||||
Some(Scope::Collection(coll)),
|
||||
&filter,
|
||||
false,
|
||||
&cell.remote_path
|
||||
)
|
||||
.unwrap(),
|
||||
Some(i),
|
||||
"{} is drawn at row {i} of the collection",
|
||||
cell.remote_path
|
||||
);
|
||||
}
|
||||
assert_eq!(
|
||||
ordinal_of_path(&catalog, Some(Scope::Collection(coll)), &filter, false, "2019/a.CR2").unwrap(),
|
||||
ordinal_of_path(
|
||||
&catalog,
|
||||
Some(Scope::Collection(coll)),
|
||||
&filter,
|
||||
false,
|
||||
"2019/a.CR2"
|
||||
)
|
||||
.unwrap(),
|
||||
None,
|
||||
"not a member"
|
||||
);
|
||||
|
||||
@@ -415,8 +415,8 @@ mod tests {
|
||||
|
||||
let catalog = with_images(10);
|
||||
let ids = image_ids(&catalog);
|
||||
let album = albums::create(catalog.connection(), "Web", &Place::Local("/out".into()))
|
||||
.unwrap();
|
||||
let album =
|
||||
albums::create(catalog.connection(), "Web", &Place::Local("/out".into())).unwrap();
|
||||
// Two files from one photograph, one from another: two cells.
|
||||
albums::record_exports(
|
||||
catalog.connection(),
|
||||
@@ -460,10 +460,22 @@ mod tests {
|
||||
.unwrap();
|
||||
coll::add_images(catalog.connection(), c, &ids[2..5]).unwrap();
|
||||
|
||||
let cells = read_cells_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default(), 0, 120).unwrap();
|
||||
let cells = read_cells_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(c)),
|
||||
&RatingFilter::default(),
|
||||
0,
|
||||
120,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(cells.len(), 3);
|
||||
assert_eq!(
|
||||
total_images_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default()).unwrap(),
|
||||
total_images_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(c)),
|
||||
&RatingFilter::default()
|
||||
)
|
||||
.unwrap(),
|
||||
3
|
||||
);
|
||||
// Unscoped is still the whole library.
|
||||
@@ -493,11 +505,22 @@ mod tests {
|
||||
coll::add_images(catalog.connection(), iceland, &ids[0..4]).unwrap();
|
||||
|
||||
// The parent itself has no direct members at all.
|
||||
let cells =
|
||||
read_cells_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default(), 0, 120).unwrap();
|
||||
let cells = read_cells_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(trips)),
|
||||
&RatingFilter::default(),
|
||||
0,
|
||||
120,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(cells.len(), 4, "the set shows what its children hold");
|
||||
assert_eq!(
|
||||
total_images_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default()).unwrap(),
|
||||
total_images_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(trips)),
|
||||
&RatingFilter::default()
|
||||
)
|
||||
.unwrap(),
|
||||
4
|
||||
);
|
||||
}
|
||||
@@ -522,11 +545,22 @@ mod tests {
|
||||
coll::add_images(catalog.connection(), trips, &ids[0..2]).unwrap();
|
||||
coll::add_images(catalog.connection(), iceland, &ids[0..3]).unwrap();
|
||||
|
||||
let cells =
|
||||
read_cells_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default(), 0, 120).unwrap();
|
||||
let cells = read_cells_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(trips)),
|
||||
&RatingFilter::default(),
|
||||
0,
|
||||
120,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(cells.len(), 3, "images 0..3, each once");
|
||||
assert_eq!(
|
||||
total_images_scoped(&catalog, Some(Scope::Collection(trips)), &RatingFilter::default()).unwrap(),
|
||||
total_images_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(trips)),
|
||||
&RatingFilter::default()
|
||||
)
|
||||
.unwrap(),
|
||||
3
|
||||
);
|
||||
}
|
||||
@@ -542,7 +576,14 @@ mod tests {
|
||||
let c = coll::create(catalog.connection(), "Big", None, CollectionKind::Manual).unwrap();
|
||||
coll::add_images(catalog.connection(), c, &ids).unwrap();
|
||||
|
||||
let page = read_cells_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default(), 10, 5).unwrap();
|
||||
let page = read_cells_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(c)),
|
||||
&RatingFilter::default(),
|
||||
10,
|
||||
5,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(page.len(), 5);
|
||||
assert_eq!(page[0].name, "img010.CR2");
|
||||
}
|
||||
@@ -556,13 +597,22 @@ mod tests {
|
||||
let catalog = with_images(10);
|
||||
let c = coll::create(catalog.connection(), "Empty", None, CollectionKind::Manual).unwrap();
|
||||
|
||||
assert!(
|
||||
read_cells_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default(), 0, 120)
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
);
|
||||
assert!(read_cells_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(c)),
|
||||
&RatingFilter::default(),
|
||||
0,
|
||||
120
|
||||
)
|
||||
.unwrap()
|
||||
.is_empty());
|
||||
assert_eq!(
|
||||
total_images_scoped(&catalog, Some(Scope::Collection(c)), &RatingFilter::default()).unwrap(),
|
||||
total_images_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(c)),
|
||||
&RatingFilter::default()
|
||||
)
|
||||
.unwrap(),
|
||||
0
|
||||
);
|
||||
}
|
||||
@@ -671,15 +721,29 @@ mod tests {
|
||||
let wanted: Vec<_> = all.iter().rev().copied().collect();
|
||||
dr_catalog::collections::set_order(catalog.connection(), id, &wanted).unwrap();
|
||||
|
||||
let cells = read_cells_scoped(&catalog, Some(Scope::Collection(id)), &RatingFilter::default(), 0, 50).unwrap();
|
||||
let cells = read_cells_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(id)),
|
||||
&RatingFilter::default(),
|
||||
0,
|
||||
50,
|
||||
)
|
||||
.unwrap();
|
||||
let drawn: Vec<_> = cells
|
||||
.iter()
|
||||
.map(|c| dr_types::ImageId(c.image_id as u64))
|
||||
.collect();
|
||||
assert_eq!(drawn, wanted, "the grid draws the order that was written");
|
||||
|
||||
let spanned =
|
||||
read_ids_span(&catalog, Some(Scope::Collection(id)), &RatingFilter::default(), false, 0, 4).unwrap();
|
||||
let spanned = read_ids_span(
|
||||
&catalog,
|
||||
Some(Scope::Collection(id)),
|
||||
&RatingFilter::default(),
|
||||
false,
|
||||
0,
|
||||
4,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(spanned, wanted, "and a range resolves through the same one");
|
||||
|
||||
assert_eq!(
|
||||
@@ -715,8 +779,14 @@ mod tests {
|
||||
let reversed: Vec<_> = all.iter().rev().copied().collect();
|
||||
dr_catalog::collections::set_order(catalog.connection(), parent, &reversed).unwrap();
|
||||
|
||||
let cells =
|
||||
read_cells_scoped(&catalog, Some(Scope::Collection(parent)), &RatingFilter::default(), 0, 50).unwrap();
|
||||
let cells = read_cells_scoped(
|
||||
&catalog,
|
||||
Some(Scope::Collection(parent)),
|
||||
&RatingFilter::default(),
|
||||
0,
|
||||
50,
|
||||
)
|
||||
.unwrap();
|
||||
let drawn: Vec<_> = cells
|
||||
.iter()
|
||||
.map(|c| dr_types::ImageId(c.image_id as u64))
|
||||
|
||||
Reference in New Issue
Block a user