diff --git a/text/gotext_test.go b/text/gotext_test.go index d6863925..2ed5f9b7 100644 --- a/text/gotext_test.go +++ b/text/gotext_test.go @@ -567,10 +567,10 @@ func TestComputeVisualOrder(t *testing.T) { func FuzzLayout(f *testing.F) { ltrFace, _ := opentype.Parse(goregular.TTF) rtlFace, _ := opentype.Parse(nsareg.TTF) - f.Add("د عرمثال dstي met لم aqل جدmوpمg lرe dرd لو عل ميrةsdiduntut lab renنيتذدagلaaiua.ئPocttأior رادرsاي mيrbلmnonaيdتد ماةعcلخ.", true, uint8(10), uint16(200)) + f.Add("د عرمثال dstي met لم aqل جدmوpمg lرe dرd لو عل ميrةsdiduntut lab renنيتذدagلaaiua.ئPocttأior رادرsاي mيrbلmnonaيdتد ماةعcلخ.", true, false, uint8(10), uint16(200)) shaper := testShaper(ltrFace, rtlFace) - f.Fuzz(func(t *testing.T, txt string, rtl bool, fontSize uint8, width uint16) { + f.Fuzz(func(t *testing.T, txt string, rtl bool, truncate bool, fontSize uint8, width uint16) { locale := system.Locale{ Direction: system.LTR, } @@ -580,9 +580,14 @@ func FuzzLayout(f *testing.F) { if fontSize < 1 { fontSize = 1 } + maxLines := 0 + if truncate { + maxLines = 1 + } lines := shaper.LayoutRunes(Parameters{ PxPerEm: fixed.I(int(fontSize)), MaxWidth: int(width), + MaxLines: maxLines, Locale: locale, }, []rune(txt)) validateLines(t, lines.lines, len([]rune(txt))) diff --git a/text/testdata/fuzz/FuzzLayout/2a7730fcbcc3550718b37415eb6104cf09159c7d756cc3530ccaa9007c0a2c06 b/text/testdata/fuzz/FuzzLayout/2a7730fcbcc3550718b37415eb6104cf09159c7d756cc3530ccaa9007c0a2c06 index 00ec62d7..d59920e1 100644 --- a/text/testdata/fuzz/FuzzLayout/2a7730fcbcc3550718b37415eb6104cf09159c7d756cc3530ccaa9007c0a2c06 +++ b/text/testdata/fuzz/FuzzLayout/2a7730fcbcc3550718b37415eb6104cf09159c7d756cc3530ccaa9007c0a2c06 @@ -1,5 +1,6 @@ go test fuzz v1 string("\x1d") bool(true) +bool(false) byte('\x1c') uint16(227) diff --git a/text/testdata/fuzz/FuzzLayout/3fc3ee939f0df44719bee36a67df3aa3a562e2f2f1cfb665a650f60e7e0ab4e6 b/text/testdata/fuzz/FuzzLayout/3fc3ee939f0df44719bee36a67df3aa3a562e2f2f1cfb665a650f60e7e0ab4e6 index a673277d..d7d13819 100644 --- a/text/testdata/fuzz/FuzzLayout/3fc3ee939f0df44719bee36a67df3aa3a562e2f2f1cfb665a650f60e7e0ab4e6 +++ b/text/testdata/fuzz/FuzzLayout/3fc3ee939f0df44719bee36a67df3aa3a562e2f2f1cfb665a650f60e7e0ab4e6 @@ -1,5 +1,6 @@ go test fuzz v1 string("0") bool(true) +bool(false) uint8(27) uint16(200) diff --git a/text/testdata/fuzz/FuzzLayout/40894369fe6a0c11 b/text/testdata/fuzz/FuzzLayout/40894369fe6a0c11 new file mode 100644 index 00000000..e22d0085 --- /dev/null +++ b/text/testdata/fuzz/FuzzLayout/40894369fe6a0c11 @@ -0,0 +1,6 @@ +go test fuzz v1 +string("\n") +bool(false) +bool(true) +byte('±') +uint16(0) diff --git a/text/testdata/fuzz/FuzzLayout/4197f52af4459898 b/text/testdata/fuzz/FuzzLayout/4197f52af4459898 index 0f23a51f..ccba6bf9 100644 --- a/text/testdata/fuzz/FuzzLayout/4197f52af4459898 +++ b/text/testdata/fuzz/FuzzLayout/4197f52af4459898 @@ -1,5 +1,6 @@ go test fuzz v1 string("\n") bool(false) +bool(false) byte('±') uint16(0) diff --git a/text/testdata/fuzz/FuzzLayout/594e4fda2e3462061d50b6a74279d7e3e486d8ac211e45049cfa4833257ef236 b/text/testdata/fuzz/FuzzLayout/594e4fda2e3462061d50b6a74279d7e3e486d8ac211e45049cfa4833257ef236 index 55e03d2f..b3b1470c 100644 --- a/text/testdata/fuzz/FuzzLayout/594e4fda2e3462061d50b6a74279d7e3e486d8ac211e45049cfa4833257ef236 +++ b/text/testdata/fuzz/FuzzLayout/594e4fda2e3462061d50b6a74279d7e3e486d8ac211e45049cfa4833257ef236 @@ -1,5 +1,6 @@ go test fuzz v1 string("\u2029") bool(false) +bool(false) byte('*') uint16(72) diff --git a/text/testdata/fuzz/FuzzLayout/6b452fd81f16c000dbe525077b6f4ba91b040119d82d55991d568014f4ba671e b/text/testdata/fuzz/FuzzLayout/6b452fd81f16c000dbe525077b6f4ba91b040119d82d55991d568014f4ba671e index d96cf3f1..9ef2ecd3 100644 --- a/text/testdata/fuzz/FuzzLayout/6b452fd81f16c000dbe525077b6f4ba91b040119d82d55991d568014f4ba671e +++ b/text/testdata/fuzz/FuzzLayout/6b452fd81f16c000dbe525077b6f4ba91b040119d82d55991d568014f4ba671e @@ -1,5 +1,6 @@ go test fuzz v1 string("Aͮ000000000000000") bool(false) +bool(false) byte('\u0087') uint16(111) diff --git a/text/testdata/fuzz/FuzzLayout/6b5a1e9cd750a9aa8dafe11bc74e2377c0664f64bbf2ac8b1cdd0ce9f55461b3 b/text/testdata/fuzz/FuzzLayout/6b5a1e9cd750a9aa8dafe11bc74e2377c0664f64bbf2ac8b1cdd0ce9f55461b3 index 2c9c79cb..83d4623d 100644 --- a/text/testdata/fuzz/FuzzLayout/6b5a1e9cd750a9aa8dafe11bc74e2377c0664f64bbf2ac8b1cdd0ce9f55461b3 +++ b/text/testdata/fuzz/FuzzLayout/6b5a1e9cd750a9aa8dafe11bc74e2377c0664f64bbf2ac8b1cdd0ce9f55461b3 @@ -1,5 +1,6 @@ go test fuzz v1 string("\x1e") bool(true) +bool(false) byte('\n') uint16(254) diff --git a/text/testdata/fuzz/FuzzLayout/940ce2b5ed93df01 b/text/testdata/fuzz/FuzzLayout/940ce2b5ed93df01 index 7a9c2411..2b0c5370 100644 --- a/text/testdata/fuzz/FuzzLayout/940ce2b5ed93df01 +++ b/text/testdata/fuzz/FuzzLayout/940ce2b5ed93df01 @@ -1,5 +1,6 @@ go test fuzz v1 string("000000000000000 00000000 ٰ00000") bool(true) +bool(false) byte('\n') uint16(121) diff --git a/text/testdata/fuzz/FuzzLayout/be56090b98f3c84da6ff9e857d5487d1a89309f7312ccde5ff8b94fcd29521eb b/text/testdata/fuzz/FuzzLayout/be56090b98f3c84da6ff9e857d5487d1a89309f7312ccde5ff8b94fcd29521eb index b69aab61..bc442df2 100644 --- a/text/testdata/fuzz/FuzzLayout/be56090b98f3c84da6ff9e857d5487d1a89309f7312ccde5ff8b94fcd29521eb +++ b/text/testdata/fuzz/FuzzLayout/be56090b98f3c84da6ff9e857d5487d1a89309f7312ccde5ff8b94fcd29521eb @@ -1,5 +1,6 @@ go test fuzz v1 string("\r") bool(false) +bool(false) byte('T') uint16(200) diff --git a/text/testdata/fuzz/FuzzLayout/dda958d1b1bb9df71f81c575cb8900f97fc1c20e19de09fc0ffca8ff0c8d9e5a b/text/testdata/fuzz/FuzzLayout/dda958d1b1bb9df71f81c575cb8900f97fc1c20e19de09fc0ffca8ff0c8d9e5a index 491ffc04..2dd32f5b 100644 --- a/text/testdata/fuzz/FuzzLayout/dda958d1b1bb9df71f81c575cb8900f97fc1c20e19de09fc0ffca8ff0c8d9e5a +++ b/text/testdata/fuzz/FuzzLayout/dda958d1b1bb9df71f81c575cb8900f97fc1c20e19de09fc0ffca8ff0c8d9e5a @@ -1,5 +1,6 @@ go test fuzz v1 string("\u0085") bool(true) +bool(false) byte('\x10') uint16(271) diff --git a/text/testdata/fuzz/FuzzLayout/de31ec6b1ac7797daefecf39baaace51fa4348bed0e3b662dd50aa341f67d10c b/text/testdata/fuzz/FuzzLayout/de31ec6b1ac7797daefecf39baaace51fa4348bed0e3b662dd50aa341f67d10c index 4ce4a3ee..268f5d1e 100644 --- a/text/testdata/fuzz/FuzzLayout/de31ec6b1ac7797daefecf39baaace51fa4348bed0e3b662dd50aa341f67d10c +++ b/text/testdata/fuzz/FuzzLayout/de31ec6b1ac7797daefecf39baaace51fa4348bed0e3b662dd50aa341f67d10c @@ -1,5 +1,6 @@ go test fuzz v1 string("0") bool(false) +bool(false) byte('\x00') uint16(142) diff --git a/text/testdata/fuzz/FuzzLayout/e79034d6c7a6ce74d7a689f4ea99e50a6ecd0d4134e3a77234172d13787ac4ea b/text/testdata/fuzz/FuzzLayout/e79034d6c7a6ce74d7a689f4ea99e50a6ecd0d4134e3a77234172d13787ac4ea index 67545850..6cfce4df 100644 --- a/text/testdata/fuzz/FuzzLayout/e79034d6c7a6ce74d7a689f4ea99e50a6ecd0d4134e3a77234172d13787ac4ea +++ b/text/testdata/fuzz/FuzzLayout/e79034d6c7a6ce74d7a689f4ea99e50a6ecd0d4134e3a77234172d13787ac4ea @@ -1,5 +1,6 @@ go test fuzz v1 string("\n") bool(true) +bool(false) byte('\t') uint16(200) diff --git a/text/testdata/fuzz/FuzzLayout/f1f0611baadc20469863e483f58a3ca4eba895087316b31e598f0b05c978d87c b/text/testdata/fuzz/FuzzLayout/f1f0611baadc20469863e483f58a3ca4eba895087316b31e598f0b05c978d87c index 0edc44cc..9f3bf2b4 100644 --- a/text/testdata/fuzz/FuzzLayout/f1f0611baadc20469863e483f58a3ca4eba895087316b31e598f0b05c978d87c +++ b/text/testdata/fuzz/FuzzLayout/f1f0611baadc20469863e483f58a3ca4eba895087316b31e598f0b05c978d87c @@ -1,5 +1,6 @@ go test fuzz v1 string("ع0 ׂ0") bool(false) +bool(false) byte('\u0098') uint16(198) diff --git a/text/testdata/fuzz/FuzzLayout/f2ebea678c72f6c394d7f860599b281593098b0aad864231d756c3e9699029c1 b/text/testdata/fuzz/FuzzLayout/f2ebea678c72f6c394d7f860599b281593098b0aad864231d756c3e9699029c1 index 42d93e8f..fb73892b 100644 --- a/text/testdata/fuzz/FuzzLayout/f2ebea678c72f6c394d7f860599b281593098b0aad864231d756c3e9699029c1 +++ b/text/testdata/fuzz/FuzzLayout/f2ebea678c72f6c394d7f860599b281593098b0aad864231d756c3e9699029c1 @@ -1,5 +1,6 @@ go test fuzz v1 string("\x1c") bool(true) +bool(false) byte('\u009c') uint16(200)