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,23 @@
|
||||
package ocr
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCursorReadAllAndRoutingOffsets(t *testing.T) {
|
||||
cursor := NewCursor(Result{Text: "é one\n\n猫 two"})
|
||||
if _, ok := cursor.Set(2); !ok {
|
||||
t.Fatal("valid rune offset rejected")
|
||||
}
|
||||
lines := cursor.LinesFrom()
|
||||
if len(lines) != 2 || lines[0].Text != "one" || lines[0].Offset != 2 || lines[1].Text != "猫 two" || lines[1].Offset != 7 {
|
||||
t.Fatalf("lines from cursor: %+v", lines)
|
||||
}
|
||||
if _, ok := cursor.Set(-1); ok {
|
||||
t.Fatal("negative route accepted")
|
||||
}
|
||||
if _, ok := cursor.Set(cursor.Length() + 1); ok {
|
||||
t.Fatal("out of range route accepted")
|
||||
}
|
||||
if got, ok := cursor.Slice(0, 1); !ok || got != "é" {
|
||||
t.Fatalf("rune selection: %q %t", got, ok)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user