mattn / go-gtk

Go binding for GTK
http://mattn.github.com/go-gtk
BSD 3-Clause "New" or "Revised" License
2.11k stars 247 forks source link

Dialog.GetWidgetForResponse's result should not reuse #352

Closed lidaobing closed 6 years ago

lidaobing commented 6 years ago

testcase:

func TestDialog_GetWidgetForResponse(t *testing.T) {
    dialog := NewDialog()
    dialog.AddButton("A", RESPONSE_ACCEPT)
    dialog.AddButton("B", RESPONSE_CANCEL)
    accept := dialog.GetWidgetForResponse(int(RESPONSE_ACCEPT))
    cancel := dialog.GetWidgetForResponse(int(RESPONSE_CANCEL))
    assert.Equal(t, newButtonInternal(accept.GWidget).GetLabel(), "A")
    assert.Equal(t, newButtonInternal(cancel.GWidget).GetLabel(), "B")
}

result:

=== RUN   TestDialog_GetWidgetForResponse
--- FAIL: TestDialog_GetWidgetForResponse (0.00s)
        Error Trace:    gtk_test.go:78
    Error:          Not equal:
                    expected: "B"
                    actual: "A"
FAIL