Add profile 3D preferences and adapt DICOM preview resolution to memory budget
This commit is contained in:
1 parent
705762d57c
commit
7fd7ae6733
22 files changed
+500
-68
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package users
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestDicom3DSettings(t *testing.T) {
|
||||
defaults := (Dicom3DSettings{}).Normalized()
|
||||
if defaults.MemoryMiB != 1536 || defaults.Quality != "auto" || defaults.Opacity != 30 || !defaults.Valid() {
|
||||
t.Fatal(defaults)
|
||||
}
|
||||
for _, bad := range []Dicom3DSettings{{MemoryMiB: 1537}, {MemoryMiB: -1}, {MemoryMiB: 127}, {Quality: "invalid"}, {Opacity: 101}, {Opacity: -1}} {
|
||||
if bad.Valid() {
|
||||
t.Fatalf("accepted invalid preferences: %+v", bad)
|
||||
}
|
||||
u := User{Dicom3D: bad}
|
||||
if u.Clean("", false, "Dicom3D") == nil {
|
||||
t.Fatalf("saved invalid preferences: %+v", bad)
|
||||
}
|
||||
}
|
||||
for _, quality := range []string{"auto", "original", "half", "quarter"} {
|
||||
u := User{Dicom3D: Dicom3DSettings{MemoryMiB: 512, Quality: quality, Opacity: 50}}
|
||||
if err := u.Clean("", false, "Dicom3D"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user