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,35 @@
|
||||
package braille
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLineComposesFocusedRegionWithoutChangingSpacing(t *testing.T) {
|
||||
line := Line{Regions: []Region{
|
||||
{Text: "Context "},
|
||||
{Text: "é界", Cursor: 1},
|
||||
{Text: " entry"},
|
||||
}, Focus: 1}
|
||||
frame, err := line.Frame()
|
||||
if err != nil || !reflect.DeepEqual(frame, Frame{Text: "Context é界 entry", Cursor: 9}) {
|
||||
t.Fatalf("frame=%+v err=%v", frame, err)
|
||||
}
|
||||
line.Focus = -1
|
||||
frame, err = line.Frame()
|
||||
if err != nil || frame.Cursor != -1 {
|
||||
t.Fatalf("unfocused frame=%+v err=%v", frame, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLineRejectsInvalidFocusAndCursor(t *testing.T) {
|
||||
for _, line := range []Line{
|
||||
{Focus: 0},
|
||||
{Regions: []Region{{Text: "x"}}, Focus: -2},
|
||||
{Regions: []Region{{Text: "x", Cursor: 2}}, Focus: 0},
|
||||
} {
|
||||
if _, err := line.Frame(); err == nil {
|
||||
t.Fatalf("accepted invalid line %+v", line)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user