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

WinUI Navigation Handler #801

Merged
merged 6 commits into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .nuspec/Microsoft.Maui.Controls.MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) != true ">
<Compile Remove="**\*.Windows.cs" />
<None Include="**\*.Windows.cs" />
<Compile Remove="**\Windows\*.cs" />
<None Include="**\Windows\*.cs" />
<Compile Remove="**\Windows\**\*.cs" />
<None Include="**\Windows\**\*.cs" />
<Compile Remove="**\*.uwp.cs" />
<None Include="**\*.uwp.cs" />
</ItemGroup>

<ItemGroup Condition=" $(TargetFramework.StartsWith('uap10.0')) ">
<Compile Remove="**\*.uwp.cs" />
<None Include="**\*.uwp.cs" />
</ItemGroup>

<PropertyGroup>
<!-- Windows -->
<WindowsProjectFolder>Platform\Windows\</WindowsProjectFolder>
Expand Down Expand Up @@ -64,7 +70,6 @@
<DefineConstants>$(DefineConstants);MACCATALYST;IOS</DefineConstants>
</PropertyGroup>


<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
Expand All @@ -79,6 +84,9 @@
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<DefineConstants>WINDOWS;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" $(TargetFramework.StartsWith('uap10.0')) ">
<DefineConstants>WINDOWS_UWP;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) == true ">
<PackageReference Include="Microsoft.ProjectReunion" />
<PackageReference Include="Microsoft.ProjectReunion.Foundation" />
Expand Down
236 changes: 0 additions & 236 deletions Compatibility.ControlGallery.sln

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.Maui.Controls.Internals;
using System.Threading.Tasks;
using System.Net.Http;
using Microsoft.Maui.Handlers;

namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Android
{
Expand Down Expand Up @@ -56,7 +57,7 @@ protected override void OnCreate(Bundle bundle)
FormsMaps.Init(this, bundle);

#if ENABLE_TEST_CLOUD
Handlers.ViewHandler
ViewHandler
.ViewMapper[nameof(IView.AutomationId)] = (h, v) =>
{
((global::Android.Views.View)h.NativeView).ContentDescription = v.AutomationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<NoWarn>0114;0108;0109;4014;0649;0169;0472;0414;0168;0219;0429</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('uap10.0'))">
<DefineConstants>$(DefineConstants);__UWP__</DefineConstants>
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="BuildNumber.txt" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<NoWarn>0114;0108;0109;4014;0649;0169;0472;0414;0168;0219;0429</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('uap10.0'))">
<DefineConstants>$(DefineConstants);__UWP__</DefineConstants>
<DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="BuildNumber.txt" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public CellTypeList()

Navigation.PushAsync(cellNav.Page);
_last = cellNav;
#if !__WINDOWS__
#if !WINDOWS
SelectedItem = null;
#endif
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -34,7 +34,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
Expand All @@ -47,7 +47,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
Expand All @@ -57,7 +57,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
Expand All @@ -70,7 +70,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
Expand All @@ -80,7 +80,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public override void TearDown()

void Back()
{
#if __IOS__ || __WINDOWS__
#if __IOS__ || WINDOWS
RunningApp.Tap(q => q.Marked("Toggle"));
#else
RunningApp.Back();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void FlyoutPage1_Appearing(object sender, EventArgs e)
}


#if UITEST && __WINDOWS__
#if UITEST && WINDOWS
[Test]
public void OnAppearingEvents()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected override void Init()
}
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS

string Cell;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void Init()
});
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS

[Test]
public void TabbedModalNavigation()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void ModalPopped(object sender, ModalPoppedEventArgs e)
DisplayAlert("Popped", Message, Cancel);
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS
[Test]
public void ModalNavigation()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected override void OnDisappearing()
base.OnDisappearing();
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS
[Test]
public void LabelsInListViewTemplatesShouldBeCollected()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void RefreshModel()
}
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS
[Test]
public void LabelsInListViewTemplatesShouldBeCollected()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void Bugzilla51825Test()

// Windows App Driver and the Search Bar are a bit buggy
// It randomly doesn't enter the first letter
#if !__WINDOWS__
#if !WINDOWS
Assert.AreEqual("Hello", label.ReadText());
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void HandleLongPress(object sender, EventArgs e)
}
}

#if UITEST && !__WINDOWS__
#if UITEST && !WINDOWS

// This test won't work on Windows right now because we can only test desktop, so touch events
// (like LongPress) don't really work. The test should work manually on a touch screen, though.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public string DateString(String format, String date)
public void TimePicker24H()
{
RunningApp.Tap(x => x.Marked("TimePicker"));
#if !__WINDOWS__
#if !WINDOWS
Assert.AreEqual("0.0.0 A", TimeString("H.m.s t", "0, 0"));
Assert.AreEqual("13:05 PM", TimeString("HH:mm tt", "13, 5"));
Assert.AreEqual("12 PM", TimeString("HH tt", "12, 0"));
Expand All @@ -70,7 +70,7 @@ public void TimePicker24H()
#endif
}

#if !__WINDOWS__
#if !WINDOWS
[Test]
public void TimePicker12H()
{
Expand Down Expand Up @@ -99,7 +99,7 @@ public void TimePickerOther()
public void DatePickerDMY()
{
RunningApp.Tap(x => x.Marked("DatePicker"));
#if !__WINDOWS__
#if !WINDOWS
Assert.AreEqual("31/1/99", DateString("d/M/y", "1999, 1, 31"));
Assert.AreEqual("02-29-00", DateString("MM-dd-yy", "2000, 2, 29"));
Assert.AreEqual("2010, Apr, Thu", DateString("yyy, MMM, ddd", "2010, 4, 15"));
Expand All @@ -118,7 +118,7 @@ public void DatePickerDMY()
public void DatePickerMissing()
{
RunningApp.Tap(x => x.Marked("DatePicker"));
#if !__WINDOWS__
#if !WINDOWS
Assert.AreEqual("October 97", DateString("MMMM yy", "1997, 10, 30"));
Assert.AreEqual("Monday", DateString("dddd", "2020, 7, 20"));
Assert.AreEqual("2002: Dec", DateString("yyyy: MMM", "2002, 12, 31"));
Expand All @@ -129,7 +129,7 @@ public void DatePickerMissing()
#endif
}

#if !__WINDOWS__
#if !WINDOWS
[Test]
public void DatePickerLetters()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ from Layout element in layout.InternalChildren
from Button button in element.InternalChildren
let text = button.Text
// UwpIgnore
#if __WINDOWS__
#if WINDOWS
where text != "Stepper" && text != "Entry"
#endif
select new object[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static class UITestHelper
{
public static bool IsWindowClosedException(this Exception exc)
{
#if __WINDOWS__
#if WINDOWS
return exc.Message?.Contains("Currently selected window has been closed") ?? false;
#else
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ public MiscPage()

int.TryParse(_stressTestItertionEntry.Text, out _stressTestIterationCount);

#if __UWP__
#if WINDOWS
Task.Run(runStressTest);
#else
ThreadPool.QueueUserWorkItem(delegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void button_Clicked(object sender, EventArgs e)
_pickerNormal.Items.Add("test " + _pickerNormal.Items.Count);
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS
[Test]
public void Issue1777Test()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected override void Init()
};
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS
[Test]
public void Issue1937Test ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected override void Init()

#if UITEST
[Test]
#if __WINDOWS__
#if WINDOWS
[Ignore("Focus Behavior is different on UWP")]
#endif
public void FocusAndUnFocusMultipleTimes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.Maui.Controls.Compatibility.ControlGallery.Issues
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 2399, "Label Renderer Dispose never called")]

#if __WINDOWS__
#if WINDOWS
// this test works fine when ran manually but when executed through the test runner
// it fails. Not sure the difference
[NUnit.Framework.Category(Compatibility.UITests.UITestCategories.ManualReview)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void ShouldShowMenu()
#if __ANDROID__
//show secondary menu
RunningApp.TapOverflowMenuButton();
#elif __WINDOWS__
#elif WINDOWS
RunningApp.Tap ("MoreButton");
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public void VariousSpanGesturePermutation()

do
{
#if __WINDOWS__
#if WINDOWS
RunningApp.TapCoordinates(target.X + target.Width - 10, target.Y + 2);
#else
RunningApp.TapCoordinates(target.X + target.CenterX, target.Y + 2);
Expand All @@ -267,7 +267,7 @@ public void VariousSpanGesturePermutation()
RunningApp.Tap($"TestSpan5");
RunningApp.TapCoordinates(target.X + 5, target.Y + 5);

#if __WINDOWS__
#if WINDOWS
RunningApp.TapCoordinates(target.X + target.Width - 10, target.Y + 2);
#else
RunningApp.TapCoordinates(target.X + target.CenterX, target.Y + 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override void Init()
Content = listView;
}

#if UITEST && !__WINDOWS__
#if UITEST && !WINDOWS

// This test won't work on Windows right now because we can only test desktop, so touch events
// (like LongPress) don't really work. The test should work manually on a touch screen, though.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected override async void Init()
await alertTask;
}

#if UITEST && __WINDOWS__
#if UITEST && WINDOWS
[Test]
public void Issue3139Test ()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class ListItemViewModel
new Command(() => MessagingCenter.Send(this, "Remove", this));
}

#if UITEST && !__WINDOWS__
#if UITEST && !WINDOWS
[Test]
public void TestRemovingContextMenuItems()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void TranslatingViewKeepsScrollViewPosition()
RunningApp.WaitForElement(_failedText);
RunningApp.Tap(_button1);
RunningApp.Tap(_button2);
#if __WINDOWS__
#if WINDOWS
var label = RunningApp.WaitForElement(_failedText);
Assert.AreEqual(0, label[0].Rect.Height);
Assert.AreEqual(0, label[0].Rect.Width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ protected override void Init()
}
#if UITEST

#if !__WINDOWS__
#if !WINDOWS
[Test]
public void ImageFromFileSourceAppearsAndDisappearsCorrectly()
{
Expand Down
Loading