Skip to content

DocTabs Indicator remains visible after last tab is removed #4220

Closed
@pbrown12303

Description

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

If you remove all tabs from DocTabs, the selected indicator for the last tab remains visible.

How to reproduce

Run the attached test case. The first time will fail because the testdata is not present. Copy the failed files to the testdata folder and rerun - it will now run and pass all tests. Now compare emptyTabs.xml to afterTabRemoval.xml. The indicator rectangle which has a size of zero in emptyTabs now has an actual size and position in afterTabRemoval. Performing a DocTabs.SelectItem(-1) or DocTabs.Refresh() has no effect.

Screenshots

image

Example code

package container

import (
	"testing"
	"time"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/test"
	"fyne.io/fyne/v2/widget"
)

func TestEntryTextSize(t *testing.T) {
	tabs := container.NewDocTabs()
	tabs.Resize(fyne.NewSize(100, 100))
	tab1 := &container.TabItem{Text: "Test1", Content: widget.NewLabel("Test1")}
	time.Sleep(1000 * time.Millisecond)
	test.AssertObjectRendersToMarkup(t, "emptyTabs.xml", tabs)
	tabs.Append(tab1)
	time.Sleep(1000 * time.Millisecond)
	test.AssertObjectRendersToMarkup(t, "oneTab.xml", tabs)
	tabs.Select(tab1)
	time.Sleep(1000 * time.Millisecond)
	test.AssertObjectRendersToMarkup(t, "afterOneTabSelected.xml", tabs)
	tabs.Remove(tab1)
	time.Sleep(1000 * time.Millisecond)
	test.AssertObjectRendersToMarkup(t, "afterTabRemoval.xml", tabs)
	tabs.Refresh()
	time.Sleep(1000 * time.Millisecond)
	test.AssertObjectRendersToMarkup(t, "afterRefresh.xml", tabs)
	tabs.SelectIndex(-1)
	time.Sleep(1000 * time.Millisecond)
	test.AssertObjectRendersToMarkup(t, "afterSelectMinusOne.xml", tabs)
}

Fyne version

2.3.5

Go compiler version

1.21.0

Operating system and version

Windows 10

Additional Information

Here's the full test project, including testdata:

fyneDocTabsIndicatorTest.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    unverifiedA bug that has been reported but not verified

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions