Skip to content

Commit 8c68bb0

Browse files
committed
revert RefreshViewTests to main
1 parent c35dca7 commit 8c68bb0

File tree

1 file changed

+0
-124
lines changed

1 file changed

+0
-124
lines changed

src/Controls/tests/DeviceTests/Elements/RefreshView/RefreshViewTests.cs

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
using System.ComponentModel;
55
using System.Runtime.CompilerServices;
66
using System.Threading.Tasks;
7-
using System.Windows.Input;
87
using Microsoft.Maui.Controls;
98
using Microsoft.Maui.Controls.Handlers.Items;
10-
using Microsoft.Maui.DeviceTests.Stubs;
119
using Microsoft.Maui.Handlers;
1210
using Microsoft.Maui.Hosting;
1311
using Microsoft.Maui.Platform;
@@ -27,15 +25,9 @@ void SetupBuilder()
2725
handlers.AddHandler<RefreshView, RefreshViewHandler>();
2826
handlers.AddHandler<Label, LabelHandler>();
2927
handlers.AddHandler<Entry, EntryHandler>();
30-
31-
handlers.AddHandler<Grid, LayoutHandler>();
32-
handlers.AddHandler<NavigationPage, NavigationViewHandler>();
33-
handlers.AddHandler<Button, ButtonHandler>();
34-
handlers.AddHandler(typeof(Toolbar), typeof(ToolbarHandler));
3528
});
3629
});
3730
}
38-
3931
[Fact(DisplayName = "Setting the content of RefreshView removes previous platform view from visual tree")]
4032
public async Task ChangingRefreshViewContentRemovesPreviousContentsPlatformViewFromVisualTree()
4133
{
@@ -55,121 +47,5 @@ await AttachAndRun(refreshView, async (handler) =>
5547
Assert.NotNull(((newContent as IView).Handler as IPlatformViewHandler).PlatformView.GetParent());
5648
});
5749
}
58-
59-
[Fact("Batata")]
60-
public async Task DoesNotLeak()
61-
{
62-
SetupBuilder();
63-
64-
// Long-lived ICommand, like a Singleton ViewModel
65-
var command = new MyCommand();
66-
var c2 = new MyCommand();
67-
WeakReference reference = null;
68-
var navPage = new NavigationPage(new ContentPage());
69-
70-
await CreateHandlerAndAddToWindow<WindowHandlerStub>(new Window(navPage), async window =>
71-
{
72-
var layout = new Grid();
73-
//var refreshView = new RefreshView
74-
//{
75-
// Command = command,
76-
//};
77-
78-
var btn = new Button
79-
{
80-
Command = command
81-
};
82-
83-
var label = new Label();
84-
//refreshView.Content = label;
85-
layout.Add(btn);
86-
//var handler = CreateHandler<LayoutHandler>(layout);
87-
//((window.VirtualView as Window).Page as ContentPage).Content = layout;
88-
89-
var page2 = new ContentPage
90-
{
91-
Content = layout
92-
};
93-
94-
reference = new(btn);
95-
await navPage.PushAsync(page2);
96-
await OnLoadedAsync(btn);
97-
btn.Command = c2;
98-
await navPage.PopAsync();
99-
await OnUnloadedAsync(page2);
100-
_ = 1;
101-
});
102-
103-
104-
105-
//await InvokeOnMainThreadAsync(async () =>
106-
//{
107-
// var layout = new Grid();
108-
// var refreshView = new RefreshView
109-
// {
110-
// Command = command,
111-
// };
112-
// var label = new Label();
113-
// refreshView.Content = label;
114-
// layout.Add(refreshView);
115-
// var handler = CreateHandler<LayoutHandler>(layout);
116-
// await OnLoadedAsync(refreshView);
117-
// reference = new(refreshView);
118-
//});
119-
120-
Assert.NotNull(reference);
121-
122-
// Several GCs required on iOS
123-
await AssertionExtensions.WaitForGC(reference);
124-
}
125-
126-
[Fact("Batata 2")]
127-
public async Task MultiCommandsShouldNotLeak()
128-
{
129-
SetupBuilder();
130-
131-
// Long-lived ICommand, like a Singleton ViewModel
132-
var command = new MyCommand();
133-
var command2 = new MyCommand();
134-
WeakReference reference = null;
135-
var navPage = new NavigationPage(new ContentPage());
136-
137-
await CreateHandlerAndAddToWindow<WindowHandlerStub>(new Window(navPage), async window =>
138-
{
139-
var layout = new Grid();
140-
var refreshView = new RefreshView
141-
{
142-
Command = command,
143-
};
144-
var label = new Label();
145-
refreshView.Content = label;
146-
layout.Add(refreshView);
147-
148-
var page2 = new ContentPage
149-
{
150-
Content = refreshView
151-
};
152-
153-
reference = new(refreshView);
154-
await navPage.PushAsync(page2);
155-
await OnLoadedAsync(refreshView);
156-
refreshView.Command = command2;
157-
await navPage.PopAsync();
158-
await OnUnloadedAsync(page2);
159-
_ = 1;
160-
});
161-
162-
}
163-
164-
class MyCommand : ICommand
165-
{
166-
public event EventHandler CanExecuteChanged;
167-
168-
public bool CanExecute(object parameter) => true;
169-
170-
public void Execute(object parameter) { }
171-
172-
public void FireCanExecuteChanged() => CanExecuteChanged?.Invoke(this, EventArgs.Empty);
173-
}
17450
}
17551
}

0 commit comments

Comments
 (0)