mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Various bug fixes (#2945)
* Only update fingerprints if changed * Fix panic when loading primary file fails * Fix gallery/scene association * Fix display of scene gallery in card * Use natural_cs collation with paths for title sorting
This commit is contained in:
@@ -84,3 +84,74 @@ func TestFingerprints_Equals(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestFingerprints_ContentsChanged(t *testing.T) {
|
||||
var (
|
||||
value1 = 1
|
||||
value2 = "2"
|
||||
value3 = 1.23
|
||||
|
||||
fingerprint1 = Fingerprint{
|
||||
Type: FingerprintTypeMD5,
|
||||
Fingerprint: value1,
|
||||
}
|
||||
fingerprint2 = Fingerprint{
|
||||
Type: FingerprintTypeOshash,
|
||||
Fingerprint: value2,
|
||||
}
|
||||
fingerprint3 = Fingerprint{
|
||||
Type: FingerprintTypeMD5,
|
||||
Fingerprint: value3,
|
||||
}
|
||||
)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
f Fingerprints
|
||||
other Fingerprints
|
||||
want bool
|
||||
}{
|
||||
{
|
||||
"identical",
|
||||
Fingerprints{
|
||||
fingerprint1,
|
||||
fingerprint2,
|
||||
},
|
||||
Fingerprints{
|
||||
fingerprint1,
|
||||
fingerprint2,
|
||||
},
|
||||
false,
|
||||
},
|
||||
{
|
||||
"has new",
|
||||
Fingerprints{
|
||||
fingerprint1,
|
||||
fingerprint2,
|
||||
},
|
||||
Fingerprints{
|
||||
fingerprint1,
|
||||
},
|
||||
true,
|
||||
},
|
||||
{
|
||||
"has different value",
|
||||
Fingerprints{
|
||||
fingerprint3,
|
||||
fingerprint2,
|
||||
},
|
||||
Fingerprints{
|
||||
fingerprint1,
|
||||
fingerprint2,
|
||||
},
|
||||
true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := tt.f.ContentsChanged(tt.other); got != tt.want {
|
||||
t.Errorf("Fingerprints.ContentsChanged() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user