Skip to content

Commit

Permalink
Merge branch 'unoplatform:master' into DevTKSSdocs(CTKConvertersUpdate)
Browse files Browse the repository at this point in the history
  • Loading branch information
DevTKSS authored Jan 12, 2025
2 parents 33d3a86 + cdf4548 commit 8d48614
Show file tree
Hide file tree
Showing 37 changed files with 573 additions and 101 deletions.
4 changes: 4 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@
<NetPreviousWpf>$(NetPrevious)-windows</NetPreviousWpf>
<NetCurrentWpf>$(NetCurrent)-windows</NetCurrentWpf>

<NetPreviousWinAppSDK>$(NetPrevious)-windows10.0.19041.0</NetPreviousWinAppSDK>
<NetCurrentWinAppSDK>$(NetCurrent)-windows10.0.19041.0</NetCurrentWinAppSDK>

<NetMobilePreviousAndCurrent>$(NetPreviousNetCoreMobile);$(NetCurrentNetCoreMobile)</NetMobilePreviousAndCurrent>
<NetAndroidPreviousAndCurrent>$(NetPrevious)-android;$(NetCurrent)-android</NetAndroidPreviousAndCurrent>
<NetWpfPreviousAndCurrent>$(NetPreviousWpf);$(NetCurrentWpf)</NetWpfPreviousAndCurrent>
<NetWasmPreviousAndCurrent>$(NetPrevious);$(NetCurrent)</NetWasmPreviousAndCurrent>
<NetSkiaPreviousAndCurrent>$(NetPrevious);$(NetCurrent)</NetSkiaPreviousAndCurrent>
<NetReferencePreviousAndCurrent>$(NetPrevious);$(NetCurrent)</NetReferencePreviousAndCurrent>
<NetWinAppSDKPreviousAndCurrent>$(NetPreviousWinAppSDK);$(NetCurrentWinAppSDK)</NetWinAppSDKPreviousAndCurrent>
<NetUnitTests>$(NetPrevious)</NetUnitTests>

<NetUWPOrWinUI>uap10.0.19041</NetUWPOrWinUI>
Expand Down
4 changes: 3 additions & 1 deletion src/SamplesApp/SamplesApp.Windows/SamplesApp.Windows.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>$(NetPrevious)-windows10.0.19041.0</TargetFramework>
<TargetFramework>$(NetPreviousWinAppSDK)</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>SamplesApp.Windows</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
Expand All @@ -19,6 +19,8 @@
<WindowsSdkPackageVersion>10.0.19041.53</WindowsSdkPackageVersion>
</PropertyGroup>

<Import Project="../../targetframework-override.props" />

<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
Expand Down
7 changes: 7 additions & 0 deletions src/SamplesApp/UITests.Shared/UITests.Shared.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -4266,6 +4266,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Input\Pointers\PointerEvent_Timestamp.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Input\XamlUICommandTests.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -8238,6 +8242,9 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Input\Pointers\PointerEventArgsTests.xaml.cs">
<DependentUpon>PointerEventArgsTests.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Input\Pointers\PointerEvent_Timestamp.xaml.cs">
<DependentUpon>PointerEvent_Timestamp.xaml</DependentUpon>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Windows_UI_Xaml_Input\Pointers\DragCoordinates_Automated.xaml.cs">
<DependentUpon>DragCoordinates_Automated.xaml</DependentUpon>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static void SleepOnTouchDown(object sender, PointerRoutedEventArgs e)
{
// Ugly hack: The test engine does not allows us to perform a custom gesture (hold for 300 ms then drag)
// So we just freeze the UI thread enough to simulate the delay ...
const int holdDelay = 300 /* GestureRecognizer.DragWithTouchMinDelayTicks */ + 50 /* safety */;
const int holdDelay = 300 /* GestureRecognizer.DragWithTouchMinDelayMicroseconds */ + 50 /* safety */;
Thread.Sleep(holdDelay);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override void OnPointerPressed(PointerRoutedEventArgs e)
{
// Ugly hack: The test engine does not allows us to perform a custom gesture (hold for 300 ms then drag)
// So we just freeze the UI thread enough to simulate the delay ...
const int holdDelay = 300 /* GestureRecognizer.DragWithTouchMinDelayTicks */ + 50 /* safety */;
const int holdDelay = 300 /* GestureRecognizer.DragWithTouchMinDelayMicroseconds */ + 50 /* safety */;
Thread.Sleep(holdDelay);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<UserControl
x:Class="UITests.Shared.Windows_UI_Xaml_Input.Pointers.PointerEvent_Timestamp"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Sample.Shared.Tests"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="400"
mc:Ignorable="d">

<Grid Padding="20" RowSpacing="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border
x:Name="TestBorder"
Width="100"
Height="100"
Background="Red" />

<ListView Grid.Row="1" ItemsSource="{x:Bind Logs}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="x:String">
<TextBlock Margin="8" Text="{x:Bind}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Uno.UI.Samples.Controls;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System.Collections.ObjectModel;

namespace UITests.Shared.Windows_UI_Xaml_Input.Pointers
{
[SampleControlInfo(
"Pointers",
Description =
"Click the red rectangle repeatedly. You should see tickmarks in the logs (✔️) indicating that time delta matches timestamp delta.",
IsManualTest = true)]
public sealed partial class PointerEvent_Timestamp : UserControl
{
private ulong? _lastTimestamp;
private uint? _lastFrameId;
private double? _lastElapsedTime;
private readonly Stopwatch _stopwatch = new();

public PointerEvent_Timestamp()
{
this.InitializeComponent();
TestBorder.PointerPressed += PointerEventArgsTests_PointerPressed;
_stopwatch.Start();
Unloaded += (s, e) => _stopwatch.Stop();
}

public ObservableCollection<string> Logs { get; } = new ObservableCollection<string>();

private void PointerEventArgsTests_PointerPressed(object sender, PointerRoutedEventArgs e)
{
var point = e.GetCurrentPoint(TestBorder);
var timestamp = point.Timestamp;
var frameId = point.FrameId;
var time = _stopwatch.Elapsed.TotalMicroseconds;

var log = $"Timestamp: {timestamp}, FrameId: {frameId}" + Environment.NewLine;
if (_lastTimestamp.HasValue)
{
var timeDelta = (ulong)(time - _lastElapsedTime.Value);
var timestampDelta = (timestamp - _lastTimestamp.Value);
log += $"Time Δ: {timeDelta}";

// As long as the delta differs by less than 100ms, it probably is correct.
var seemsCorrect = Math.Abs((double)timeDelta - timestampDelta) < 50_000;
log += $", Timestamp Δ: {timestampDelta} {(seemsCorrect ? "✔️" : "❌")}";

var frameIdDelta = frameId - _lastFrameId.Value;
log += $", FrameId Δ: {frameIdDelta}";
}
_lastElapsedTime = time;
_lastTimestamp = timestamp;
_lastFrameId = frameId;
Logs.Add(log);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,16 @@ public MainPage()

await test.RunAsync();
}

[TestMethod]
public async Task When_Nested_With_Sibling_Ref_And_Event()
{
var test = new TestSetup(
xamlFileName: "ResourceDictionary_When_Nested_With_Sibling_Ref_And_Event.xaml",
subFolder: Path.Combine("SourceGenerators", "Uno.UI.SourceGenerators.Tests", "XamlCodeGeneratorTests", "TestCases"))
{
};

await Verify.AssertXamlGenerator(test);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// <autogenerated />
namespace MyProject
{
/// <summary>
/// Contains all the static resources defined for the application
/// </summary>
public sealed partial class GlobalStaticResources
{
static bool _initialized;
private static bool _stylesRegistered;
private static bool _dictionariesRegistered;
internal static global::Uno.UI.Xaml.XamlParseContext __ParseContext_ { get; } = new global::Uno.UI.Xaml.XamlParseContext()
{
AssemblyName = "TestProject",
}
;

static GlobalStaticResources()
{
Initialize();
}
public static void Initialize()
{
if (!_initialized)
{
_initialized = true;
global::Uno.UI.GlobalStaticResources.Initialize();
global::Uno.UI.GlobalStaticResources.RegisterDefaultStyles();
global::Uno.UI.GlobalStaticResources.RegisterResourceDictionariesBySource();
}
}
public static void RegisterDefaultStyles()
{
if(!_stylesRegistered)
{
_stylesRegistered = true;
RegisterDefaultStyles_ResourceDictionary_When_Nested_With_Sibling_Ref_And_Event_6d62c5ee15120ed189e095faf6d37e20();
}
}
// Register ResourceDictionaries using ms-appx:/// syntax, this is called for external resources
public static void RegisterResourceDictionariesBySource()
{
if(!_dictionariesRegistered)
{
_dictionariesRegistered = true;
}
}
// Register ResourceDictionaries using ms-resource:/// syntax, this is called for local resources
internal static void RegisterResourceDictionariesBySourceLocal()
{
}
static partial void RegisterDefaultStyles_ResourceDictionary_When_Nested_With_Sibling_Ref_And_Event_6d62c5ee15120ed189e095faf6d37e20();

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// <auto-generated />
[assembly: global::System.Reflection.AssemblyMetadata("UnoHasLocalizationResources", "False")]
Loading

0 comments on commit 8d48614

Please sign in to comment.