Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shaping: tests panic when run more than once #136

Closed
dominikh opened this issue Feb 29, 2024 · 0 comments
Closed

shaping: tests panic when run more than once #136

dominikh opened this issue Feb 29, 2024 · 0 comments

Comments

@dominikh
Copy link
Contributor

go test -count=1 ./shaping passes, but go test -count=2 ./shaping fails with

arabic:amiri regular On disk: 540 KB, additional memory: 2234 KB
latin:go regular On disk: 145 KB, additional memory: 337 KB
latin:roboto regular On disk: 164 KB, additional memory: 454 KB
arabic:noto sans arabic regular On disk: 747 KB, additional memory: 3590 KB
free serif regular On disk: 1647 KB, additional memory: 5593 KB
arabic:amiri regular On disk: 540 KB, additional memory: 2217 KB
latin:go regular On disk: 145 KB, additional memory: 337 KB
latin:roboto regular On disk: 164 KB, additional memory: 454 KB
arabic:noto sans arabic regular On disk: 747 KB, additional memory: 3584 KB
free serif regular On disk: 1647 KB, additional memory: 5590 KB
--- FAIL: TestWrapLine (0.00s)
    --- FAIL: TestWrapLine/simple (0.00s)
        wrapping_test.go:924: line 1: run 0: expected 4 glyphs, got 6
        wrapping_test.go:929: expected 9, got 12
    --- FAIL: TestWrapLine/simple_in_pieces_2 (0.00s)
        wrapping_test.go:924: line 1: run 1: expected 3 glyphs, got 5
        wrapping_test.go:929: expected 9, got 12
    --- FAIL: TestWrapLine/simple_fast-path (0.00s)
        wrapping_test.go:929: expected 15, got 14
--- FAIL: TestLineWrap (0.00s)
    --- FAIL: TestLineWrap/all_one_line (0.00s)
        wrapping_test.go:1526: line 0: expected shaping.Range{Offset:0, Count:15} offsets, got shaping.Range{Offset:0, Count:14}
        wrapping_test.go:1536: line 0: expected: shaping.Output{Advance:8320, Size:0, Glyphs:[]shaping.Glyph(nil), LineBounds:shaping.Bounds{Ascent:640, Descent:320, Gap:0}, GlyphBounds:shaping.Bounds{Ascent:640, Descent:0, Gap:0}, Direction:0x0, Runes:shaping.Range{Offset:0, Count:15}, Face:(*font.Face)(nil)}, got shaping.Output{Advance:8320, Size:0, Glyphs:[]shaping.Glyph(nil), LineBounds:shaping.Bounds{Ascent:640, Descent:320, Gap:0}, GlyphBounds:shaping.Bounds{Ascent:640, Descent:0, Gap:0}, Direction:0x0, Runes:shaping.Range{Offset:0, Count:14}, Face:(*font.Face)(nil)}
    --- FAIL: TestLineWrap/line_break_on_last_word (0.00s)
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: runtime error: index out of range [0] with length 0

goroutine 762 [running]:
testing.tRunner.func1.2({0x716020, 0xc00038c5d0})
	/home/dominikh/prj/go/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
	/home/dominikh/prj/go/src/testing/testing.go:1634 +0x377
panic({0x716020?, 0xc00038c5d0?})
	/home/dominikh/prj/go/src/runtime/panic.go:770 +0x132
github.com/go-text/typesetting/shaping.inclusiveGlyphRange(...)
	/home/dominikh/prj/typesetting/shaping/wrapping.go:212
github.com/go-text/typesetting/shaping.cutRun({0x0, 0x0, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
	/home/dominikh/prj/typesetting/shaping/wrapping.go:239 +0x27b
github.com/go-text/typesetting/shaping.(*LineWrapper).processBreakOption(0xc005806b60, {0x4?}, {0x0?, 0x78?, 0x78?})
	/home/dominikh/prj/typesetting/shaping/wrapping.go:1095 +0x31e
github.com/go-text/typesetting/shaping.(*LineWrapper).wrapNextLine(0xc005806b60, {0x0?, 0xd?, 0x10?})
	/home/dominikh/prj/typesetting/shaping/wrapping.go:963 +0x13b
github.com/go-text/typesetting/shaping.(*LineWrapper).WrapNextLine(0xc005806b60, 0x78)
	/home/dominikh/prj/typesetting/shaping/wrapping.go:934 +0x7a5
github.com/go-text/typesetting/shaping.(*LineWrapper).WrapParagraph(0xc005806b60, {0x0, {0x0, 0x0, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, ...}, ...}, ...)
	/home/dominikh/prj/typesetting/shaping/wrapping.go:775 +0x4b8
github.com/go-text/typesetting/shaping.TestLineWrap.func1(0xc0058069c0)
	/home/dominikh/prj/typesetting/shaping/wrapping_test.go:1496 +0x117
testing.tRunner(0xc0058069c0, 0xc00574ef90)
	/home/dominikh/prj/go/src/testing/testing.go:1689 +0xfb
created by testing.(*T).Run in goroutine 755
	/home/dominikh/prj/go/src/testing/testing.go:1742 +0x390
FAIL	github.com/go-text/typesetting/shaping	0.294s
FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant