text,widget: remove ineffective assignments

Signed-off-by: Serhat Sevki Dincer <jfcgauss@gmail.com>
This commit is contained in:
Serhat Sevki Dincer
2023-02-23 22:41:03 +11:00
committed by Elias Naur
parent 39b1158410
commit 35a8231963
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -258,7 +258,7 @@ func makeTestText(shaper *shaperImpl, primaryDir system.TextDirection, fontSize,
}
simpleText := shaper.shapeAndWrapText(shaper.orderer.sortedFacesForStyle(Font{}), Parameters{PxPerEm: fixed.I(fontSize)}, lineWidth, locale, []rune(simpleSource))
complexText := shaper.shapeAndWrapText(shaper.orderer.sortedFacesForStyle(Font{}), Parameters{PxPerEm: fixed.I(fontSize)}, lineWidth, locale, []rune(complexSource))
shaper = testShaper(rtlFace, ltrFace)
testShaper(rtlFace, ltrFace)
return simpleText, complexText
}
+4 -4
View File
@@ -117,12 +117,12 @@ func TestEditorReadOnly(t *testing.T) {
if cStart != cEnd {
t.Errorf("unexpected initial caret positions")
}
dims := e.Layout(gtx, cache, font, fontSize, nil)
e.Layout(gtx, cache, font, fontSize, nil)
// Select everything.
gtx.Ops.Reset()
gtx.Queue = &testQueue{events: []event.Event{key.Event{Name: "A", Modifiers: key.ModShortcut}}}
dims = e.Layout(gtx, cache, font, fontSize, nil)
e.Layout(gtx, cache, font, fontSize, nil)
textContent := e.Text()
cStart2, cEnd2 := e.Selection()
if cStart2 > cEnd2 {
@@ -138,7 +138,7 @@ func TestEditorReadOnly(t *testing.T) {
// Type some new characters.
gtx.Ops.Reset()
gtx.Queue = &testQueue{events: []event.Event{key.EditEvent{Range: key.Range{Start: cStart2, End: cEnd2}, Text: "something else"}}}
dims = e.Layout(gtx, cache, font, fontSize, nil)
e.Layout(gtx, cache, font, fontSize, nil)
textContent2 := e.Text()
if textContent2 != textContent {
t.Errorf("readonly editor modified by key.EditEvent")
@@ -147,7 +147,7 @@ func TestEditorReadOnly(t *testing.T) {
// Try to delete selection.
gtx.Ops.Reset()
gtx.Queue = &testQueue{events: []event.Event{key.Event{Name: key.NameDeleteBackward}}}
dims = e.Layout(gtx, cache, font, fontSize, nil)
dims := e.Layout(gtx, cache, font, fontSize, nil)
textContent2 = e.Text()
if textContent2 != textContent {
t.Errorf("readonly editor modified by delete key.Event")
-1
View File
@@ -45,7 +45,6 @@ func (s stringSource) ReadAt(b []byte, offset int64) (int, error) {
// ReplaceRunes is unimplemented, as a stringSource is immutable.
func (s stringSource) ReplaceRunes(byteOffset, runeCount int64, str string) {
return
}
// Selectable holds text selection state.