-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'unoplatform:master' into DevTKSSdocs(CTKConvertersUpdate)
- Loading branch information
Showing
37 changed files
with
573 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/Pointers/PointerEvent_Timestamp.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
70 changes: 70 additions & 0 deletions
70
src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Input/Pointers/PointerEvent_Timestamp.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ators.Tests/XamlCodeGeneratorTests/Out/WNWSRAE/XamlCodeGenerator_GlobalStaticResources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
|
||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...ators.Tests/XamlCodeGeneratorTests/Out/WNWSRAE/XamlCodeGenerator_LocalizationResources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// <auto-generated /> | ||
[assembly: global::System.Reflection.AssemblyMetadata("UnoHasLocalizationResources", "False")] |
Oops, something went wrong.