~eliasnaur/gio

35a8231963662815bab57457b1a8c48ee34903f5 — Serhat Sevki Dincer 1 year, 4 months ago 39b1158
text,widget: remove ineffective assignments

Signed-off-by: Serhat Sevki Dincer <jfcgauss@gmail.com>
3 files changed, 5 insertions(+), 6 deletions(-)

M text/gotext_test.go
M widget/editor_test.go
M widget/selectable.go
M text/gotext_test.go => text/gotext_test.go +1 -1
@@ 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
}


M widget/editor_test.go => widget/editor_test.go +4 -4
@@ 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")

M widget/selectable.go => widget/selectable.go +0 -1
@@ 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.