Skip to content

Commit 1ef0ab2

Browse files
Merge pull request #3450 from windows-toolkit/smokeTests
Created SmokeTest projects.
2 parents 92836d5 + 551a36a commit 1ef0ab2

File tree

53 files changed

+2164
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2164
-0
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.Markdown/Microsoft.Toolkit.Uwp.UI.Controls.Markdown.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,20 @@
4646
<Message Text="CSFiles: @(GeneratedCSFiles->'&quot;%(Identity)&quot;')" />
4747
<Exec Command="for %%f in (@(GeneratedCSFiles->'&quot;%(Identity)&quot;')) do echo #pragma warning disable &gt; %%f.temp &amp;&amp; type %%f &gt;&gt; %%f.temp &amp;&amp; move /y %%f.temp %%f &gt; NUL" />
4848
</Target>
49+
50+
<!--
51+
Required workaround for ProjectReference inclusion of the Controls package
52+
The UWP project system is including the Controls resources in the pri file because
53+
it doesn't know it'll be an independent package later during packing.
54+
Therefore, we need to remove these extra resources in the PRI pipeline so the
55+
Markdown pri file is properly generated and doesn't include duplicate references to Control resources.
56+
-->
57+
<Target Name="RemoveUnwantedPri" AfterTargets="GetPackagingOutputs">
58+
<!--<Message Text="Files Before: @(PackagingOutputs)" Importance="high" />-->
59+
<ItemGroup>
60+
<PackagingOutputs Remove="@(PackagingOutputs)" Condition="'%(PackagingOutputs.Filename)%(PackagingOutputs.Extension)' == 'Microsoft.Toolkit.Uwp.UI.Controls.pri'" />
61+
<PackagingOutputs Remove="@(PackagingOutputs)" Condition="$([System.String]::new('%(PackagingOutputs.TargetPath)').StartsWith('Microsoft.Toolkit.Uwp.UI.Controls\'))" />
62+
</ItemGroup>
63+
<!--<Message Text="Files After: @(PackagingOutputs)" Importance="high" />-->
64+
</Target>
4965
</Project>

SmokeTests/App.xaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Application
2+
x:Class="SmokeTest.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:SmokeTest">
6+
7+
</Application>

SmokeTests/App.xaml.cs

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System;
6+
using System.Collections.Generic;
7+
using System.IO;
8+
using System.Linq;
9+
using System.Runtime.InteropServices.WindowsRuntime;
10+
using Windows.ApplicationModel;
11+
using Windows.ApplicationModel.Activation;
12+
using Windows.Foundation;
13+
using Windows.Foundation.Collections;
14+
using Windows.UI.Xaml;
15+
using Windows.UI.Xaml.Controls;
16+
using Windows.UI.Xaml.Controls.Primitives;
17+
using Windows.UI.Xaml.Data;
18+
using Windows.UI.Xaml.Input;
19+
using Windows.UI.Xaml.Media;
20+
using Windows.UI.Xaml.Navigation;
21+
22+
namespace SmokeTest
23+
{
24+
/// <summary>
25+
/// Provides application-specific behavior to supplement the default Application class.
26+
/// </summary>
27+
public sealed partial class App : Application
28+
{
29+
/// <summary>
30+
/// Initializes the singleton application object. This is the first line of authored code
31+
/// executed, and as such is the logical equivalent of main() or WinMain().
32+
/// </summary>
33+
public App()
34+
{
35+
this.InitializeComponent();
36+
this.Suspending += OnSuspending;
37+
}
38+
39+
/// <summary>
40+
/// Invoked when the application is launched normally by the end user. Other entry points
41+
/// will be used such as when the application is launched to open a specific file.
42+
/// </summary>
43+
/// <param name="e">Details about the launch request and process.</param>
44+
protected override void OnLaunched(LaunchActivatedEventArgs e)
45+
{
46+
Frame rootFrame = Window.Current.Content as Frame;
47+
48+
// Do not repeat app initialization when the Window already has content,
49+
// just ensure that the window is active
50+
if (rootFrame == null)
51+
{
52+
// Create a Frame to act as the navigation context and navigate to the first page
53+
rootFrame = new Frame();
54+
55+
rootFrame.NavigationFailed += OnNavigationFailed;
56+
57+
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
58+
{
59+
// TODO: Load state from previously suspended application
60+
}
61+
62+
// Place the frame in the current Window
63+
Window.Current.Content = rootFrame;
64+
}
65+
66+
if (e.PrelaunchActivated == false)
67+
{
68+
if (rootFrame.Content == null)
69+
{
70+
// When the navigation stack isn't restored navigate to the first page,
71+
// configuring the new page by passing required information as a navigation
72+
// parameter
73+
rootFrame.Navigate(typeof(MainPage), e.Arguments);
74+
}
75+
76+
// Ensure the current window is active
77+
Window.Current.Activate();
78+
}
79+
}
80+
81+
/// <summary>
82+
/// Invoked when Navigation to a certain page fails
83+
/// </summary>
84+
/// <param name="sender">The Frame which failed navigation</param>
85+
/// <param name="e">Details about the navigation failure</param>
86+
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
87+
{
88+
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
89+
}
90+
91+
/// <summary>
92+
/// Invoked when application execution is being suspended. Application state is saved
93+
/// without knowing whether the application will be terminated or resumed with the contents
94+
/// of memory still intact.
95+
/// </summary>
96+
/// <param name="sender">The source of the suspend request.</param>
97+
/// <param name="e">Details about the suspend request.</param>
98+
private void OnSuspending(object sender, SuspendingEventArgs e)
99+
{
100+
var deferral = e.SuspendingOperation.GetDeferral();
101+
102+
// TODO: Save application state and stop any background activity
103+
deferral.Complete();
104+
}
105+
}
106+
}
1.4 KB
Loading
7.52 KB
Loading
2.87 KB
Loading
1.61 KB
Loading
1.23 KB
Loading

SmokeTests/Assets/StoreLogo.png

1.42 KB
Loading
3.13 KB
Loading

0 commit comments

Comments
 (0)