Skip to content

Commit 69ec49d

Browse files
committed
added runner project
1 parent be2e8be commit 69ec49d

39 files changed

+1168
-7
lines changed

samples/NuGet.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="NuGet official package source" value="https://api.nuget.org/v3/index.json" />
5+
<add key="uno dev" value="https://pkgs.dev.azure.com/uno-platform/1dd81cbd-cb35-41de-a570-b0df3571a196/_packaging/unoplatformdev/nuget/v3/index.json" />
6+
<add key="test-device-runners" value="https://pkgs.dev.azure.com/mattleibow/OpenSource/_packaging/test-device-runners/nuget/v3/index.json" />
7+
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
8+
</packageSources>
9+
</configuration>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:CommunityToolkit.Maui.DeviceTests"
5+
x:Class="CommunityToolkit.Maui.DeviceTests.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Resources/Styles/Colors.xaml" />
10+
<ResourceDictionary Source="Resources/Styles/Styles.xaml" />
11+
</ResourceDictionary.MergedDictionaries>
12+
</ResourceDictionary>
13+
</Application.Resources>
14+
</Application>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace CommunityToolkit.Maui.DeviceTests;
2+
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
9+
MainPage = new AppShell();
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<Shell
3+
x:Class="CommunityToolkit.Maui.DeviceTests.AppShell"
4+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6+
xmlns:local="clr-namespace:CommunityToolkit.Maui.DeviceTests"
7+
Shell.FlyoutBehavior="Disabled">
8+
9+
<ShellContent
10+
Title="Home"
11+
ContentTemplate="{DataTemplate local:MainPage}"
12+
Route="MainPage" />
13+
14+
</Shell>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace CommunityToolkit.Maui.DeviceTests;
2+
3+
public partial class AppShell : Shell
4+
{
5+
public AppShell()
6+
{
7+
InitializeComponent();
8+
}
9+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
5+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
6+
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
7+
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>CommunityToolkit.Maui.DeviceTests</RootNamespace>
10+
<UseMaui>true</UseMaui>
11+
<SingleProject>true</SingleProject>
12+
<ImplicitUsings>enable</ImplicitUsings>
13+
14+
<!-- Display name -->
15+
<ApplicationTitle>CommunityToolkit.Maui.DeviceTests</ApplicationTitle>
16+
17+
<!-- App Identifier -->
18+
<ApplicationId>com.companyname.communitytoolkit.maui.devicetests</ApplicationId>
19+
<ApplicationIdGuid>b9372eea-e8b8-45fb-b785-6ffb8eb6c099</ApplicationIdGuid>
20+
21+
<!-- Versions -->
22+
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
23+
<ApplicationVersion>1</ApplicationVersion>
24+
25+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
26+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
27+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
28+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
29+
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
30+
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
31+
</PropertyGroup>
32+
33+
<ItemGroup>
34+
<!-- App Icon -->
35+
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
36+
37+
<!-- Splash Screen -->
38+
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
39+
40+
<!-- Images -->
41+
<MauiImage Include="Resources\Images\*" />
42+
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />
43+
44+
<!-- Custom Fonts -->
45+
<MauiFont Include="Resources\Fonts\*" />
46+
47+
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
48+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
49+
</ItemGroup>
50+
51+
<ItemGroup>
52+
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
53+
<PackageReference Include="DeviceRunners.VisualRunners.Maui" Version="0.1.0-preview.1" />
54+
<PackageReference Include="DeviceRunners.VisualRunners.Xunit" Version="0.1.0-preview.1" />
55+
<PackageReference Include="DeviceRunners.XHarness.Maui" Version="0.1.0-preview.1" />
56+
<PackageReference Include="DeviceRunners.XHarness.Xunit" Version="0.1.0-preview.1" />
57+
<PackageReference Include="DeviceRunners.UITesting.Maui" Version="0.1.0-preview.1" />
58+
<PackageReference Include="DeviceRunners.UITesting.Xunit" Version="0.1.0-preview.1" />
59+
<PackageReference Include="xunit" Version="2.5.0-pre.44" />
60+
<PackageReference Include="xunit.runner.utility" Version="2.5.0-pre.44" />
61+
</ItemGroup>
62+
63+
<ItemGroup>
64+
<ProjectReference Include="..\..\CommunityToolkit.Maui.Core\CommunityToolkit.Maui.Core.csproj" />
65+
<ProjectReference Include="..\..\CommunityToolkit.Maui\CommunityToolkit.Maui.csproj" />
66+
</ItemGroup>
67+
</Project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="CommunityToolkit.Maui.DeviceTests.MainPage">
5+
6+
<ScrollView>
7+
<VerticalStackLayout
8+
Spacing="25"
9+
Padding="30,0"
10+
VerticalOptions="Center">
11+
12+
<Image
13+
Source="dotnet_bot.png"
14+
SemanticProperties.Description="Cute dot net bot waving hi to you!"
15+
HeightRequest="200"
16+
HorizontalOptions="Center" />
17+
18+
<Label
19+
Text="Hello, World!"
20+
SemanticProperties.HeadingLevel="Level1"
21+
FontSize="32"
22+
HorizontalOptions="Center" />
23+
24+
<Label
25+
Text="Welcome to .NET Multi-platform App UI"
26+
SemanticProperties.HeadingLevel="Level2"
27+
SemanticProperties.Description="Welcome to dot net Multi platform App U I"
28+
FontSize="18"
29+
HorizontalOptions="Center" />
30+
31+
<Button
32+
x:Name="CounterBtn"
33+
Text="Click me"
34+
SemanticProperties.Hint="Counts the number of times you click"
35+
Clicked="OnCounterClicked"
36+
HorizontalOptions="Center" />
37+
38+
</VerticalStackLayout>
39+
</ScrollView>
40+
41+
</ContentPage>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace CommunityToolkit.Maui.DeviceTests;
2+
3+
public partial class MainPage : ContentPage
4+
{
5+
int count = 0;
6+
7+
public MainPage()
8+
{
9+
InitializeComponent();
10+
}
11+
12+
private void OnCounterClicked(object sender, EventArgs e)
13+
{
14+
count++;
15+
16+
if (count == 1)
17+
CounterBtn.Text = $"Clicked {count} time";
18+
else
19+
CounterBtn.Text = $"Clicked {count} times";
20+
21+
SemanticScreenReader.Announce(CounterBtn.Text);
22+
}
23+
}
24+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using CommunityToolkit.Maui.DeviceTests.Tests;
2+
using DeviceRunners.UITesting;
3+
using DeviceRunners.VisualRunners;
4+
using DeviceRunners.XHarness;
5+
using Microsoft.Extensions.Logging;
6+
7+
namespace CommunityToolkit.Maui.DeviceTests;
8+
public static class MauiProgram
9+
{
10+
public static MauiApp CreateMauiApp()
11+
{
12+
var builder = MauiApp.CreateBuilder();
13+
builder
14+
.ConfigureUITesting()
15+
.UseXHarnessTestRunner(conf => conf
16+
.AddTestAssembly(typeof(MauiProgram).Assembly)
17+
.AddXunit())
18+
.UseVisualTestRunner(conf => conf
19+
.AddTestAssembly(typeof(MauiProgram).Assembly)
20+
.AddXunit())
21+
.UseMauiApp<App>()
22+
.ConfigureFonts(fonts =>
23+
{
24+
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
25+
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
26+
});
27+
28+
#if DEBUG
29+
builder.Logging.AddDebug();
30+
#endif
31+
32+
return builder.Build();
33+
}
34+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.INTERNET" />
6+
</manifest>

0 commit comments

Comments
 (0)