Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollView doesn't remove a view that was previously added on both versions. #2970

Closed
BDisp opened this issue Nov 10, 2023 · 0 comments · Fixed by #2971
Closed

ScrollView doesn't remove a view that was previously added on both versions. #2970

BDisp opened this issue Nov 10, 2023 · 0 comments · Fixed by #2971

Comments

@BDisp
Copy link
Collaborator

BDisp commented Nov 10, 2023

This unit test will fail:

		[Fact, AutoInitShutdown]
		public void Remove_Added_View_Is_Allowed ()
		{
			var sv = new ScrollView () {
				Width = 20,
				Height = 20,
				ContentSize = new Size (100, 100)
			};
			sv.Add (new View () { Width = Dim.Fill (), Height = Dim.Fill (50), Id = "View1" },
				new View () { Y = 51, Width = Dim.Fill (), Height = Dim.Fill (), Id = "View2" });

			Application.Top.Add (sv);
			Application.Begin (Application.Top);

			Assert.Equal (3, sv.Subviews.Count);
			Assert.Equal (2, sv.Subviews [0].Subviews.Count);

			sv.Remove (sv.Subviews [0].Subviews [1]);
			Assert.Equal (3, sv.Subviews.Count);
			Assert.Single (sv.Subviews [0].Subviews);
			Assert.Equal ("View1", sv.Subviews [0].Subviews [0].Id);
		}
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Nov 10, 2023
BDisp added a commit to BDisp/Terminal.Gui that referenced this issue Nov 10, 2023
@tig tig closed this as completed in #2971 Nov 15, 2023
tig pushed a commit that referenced this issue Nov 15, 2023
tig pushed a commit that referenced this issue Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant