Cthulhu is no longer a fork. Now it is a screen reader written in Golang.
This commit is contained in:
1 parent
a998fe67de
commit
069fc674dc
708 files changed
+112482
-532
No files matched your search
@@ -0,0 +1,48 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestOCRSettingsPersistAndRebase(t *testing.T) {
|
||||
settings := DefaultSettings()
|
||||
settings.OCR = OCRSettings{Language: "fra+eng", Layout: 11, Scale: 3, Grayscale: true,
|
||||
Invert: true, BlackWhite: true, Threshold: 231, AutoRefresh: true, RefreshInterval: 700,
|
||||
ConfirmClick: false, CopyFirstResult: true, AutoReadAll: true}
|
||||
encoded, err := encodeWritable(settings)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
decoded, err := decodeWritable(encoded)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if decoded.OCR != settings.OCR {
|
||||
t.Fatalf("OCR settings changed: %+v", decoded.OCR)
|
||||
}
|
||||
global := DefaultSettings()
|
||||
application := global
|
||||
application.OCR.Language = "deu"
|
||||
global.OCR.AutoReadAll = true
|
||||
application.OCR.AutoReadAll = false
|
||||
newGlobal := global
|
||||
newGlobal.OCR.Scale = 2
|
||||
rebased := RebaseApplicationSettings(global, newGlobal, application)
|
||||
if rebased.OCR.Language != "deu" || rebased.OCR.Scale != 2 || rebased.OCR.AutoReadAll {
|
||||
t.Fatalf("OCR override rebase: %+v", rebased.OCR)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOCRAutoReadAllDefaultsAndExplicitFalse(t *testing.T) {
|
||||
settings := DefaultSettings()
|
||||
if settings.OCR.AutoReadAll {
|
||||
t.Fatal("automatic OCR reading must default off")
|
||||
}
|
||||
settings.OCR.AutoReadAll = true
|
||||
apply_profile_ocr(&settings.OCR, writableOCR{})
|
||||
if !settings.OCR.AutoReadAll {
|
||||
t.Fatal("omitted setting changed inherited value")
|
||||
}
|
||||
apply_profile_ocr(&settings.OCR, writableOCR{AutoReadAll: boolPointer(false)})
|
||||
if settings.OCR.AutoReadAll {
|
||||
t.Fatal("explicit false did not override inherited value")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user