Skip to content

Commit

Permalink
Merge branch 'main' into WindowLeaksOnWindows
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanpeppers committed Jul 1, 2024
2 parents 05d0df2 + fa46d10 commit 742767d
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 55 deletions.
6 changes: 3 additions & 3 deletions eng/scripts/appium-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ param
(
[string] $appiumVersion = '2.11.0',
[string] $windowsDriverVersion = '2.12.23',
[string] $androidDriverVersion = '3.7.0',
[string] $iOSDriverVersion = '7.16.1',
[string] $macDriverVersion = '1.17.3',
[string] $androidDriverVersion = '3.7.0',
[string] $iOSDriverVersion = '7.21.0',
[string] $macDriverVersion = '1.17.4',
[string] $logsDir = '../appium-logs'
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,15 @@ public CollectionViewVisibilityUITests(TestDevice device)
public override string Issue => "iOS application suspended at UICollectionViewFlowLayout.PrepareLayout() when using IsVisible = false";

// InitiallyInvisbleCollectionViewSurvivesiOSLayoutNonsense(src\Compatibility\ControlGallery\src\Issues.Shared\Issue12714.cs)
#if ANDROID
[Test]
[Category(UITestCategories.CollectionView)]
public void InitiallyInvisbleCollectionViewSurvivesiOSLayoutNonsense()
{
if (Device == TestDevice.Android)
{
App.WaitForElement(Show);
App.Click(Show);
App.WaitForNoElement(Success);
}
else
{
Assert.Ignore("This test is failing, requires research.");
}
App.WaitForElement(Show);
App.Click(Show);
App.WaitForNoElement(Success);
}
#endif
}
}
24 changes: 4 additions & 20 deletions src/Core/src/Platform/Windows/NavigationRootManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,33 +89,17 @@ public virtual void Connect(UIElement platformView)
_rootView.Content = null;
}

NavigationView rootNavigationView;
if (platformView is NavigationView nv)
_rootView.Content = platformView is NavigationView ? platformView : new RootNavigationView()
{
rootNavigationView = nv;
_rootView.Content = platformView;
}
else
{
if (_rootView.Content is RootNavigationView navView)
{
rootNavigationView = navView;
}
else
{
rootNavigationView = new RootNavigationView();
}

rootNavigationView.Content = platformView;
_rootView.Content = rootNavigationView;
}
Content = platformView
};

if (_disconnected && _platformWindow.TryGetTarget(out var platformWindow))
{
platformWindow.Activated += OnWindowActivated;
_disconnected = false;
}

_disconnected = false;
_rootView.OnWindowTitleBarContentSizeChanged += WindowRootViewOnWindowTitleBarContentSizeChanged;
}

Expand Down
48 changes: 40 additions & 8 deletions src/Essentials/src/FileSystem/FileSystem.uwp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,53 @@ namespace Microsoft.Maui.Storage
{
partial class FileSystemImplementation : IFileSystem
{
private readonly Lazy<string> _platformCacheDirectory = new(valueFactory: () =>
{
if (AppInfoUtils.IsPackagedApp)
{
return ApplicationData.Current.LocalCacheFolder.Path;
}
else
{
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppSpecificPath, "Cache");
if (!File.Exists(path))
{
Directory.CreateDirectory(path);
}
return path;
}
});

private readonly Lazy<string> _platformAppDataDirectory = new(valueFactory: () =>
{
if (AppInfoUtils.IsPackagedApp)
{
return ApplicationData.Current.LocalFolder.Path;
}
else
{
string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppSpecificPath, "Data");
if (!File.Exists(path))
{
Directory.CreateDirectory(path);
}
return path;
}
});

static string CleanPath(string path) =>
string.Join("_", path.Split(Path.GetInvalidFileNameChars()));

static string AppSpecificPath =>
Path.Combine(CleanPath(AppInfoImplementation.PublisherName), CleanPath(AppInfo.PackageName));

string PlatformCacheDirectory
=> AppInfoUtils.IsPackagedApp
? ApplicationData.Current.LocalCacheFolder.Path
: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppSpecificPath, "Cache");
string PlatformCacheDirectory => _platformCacheDirectory.Value;

string PlatformAppDataDirectory
=> AppInfoUtils.IsPackagedApp
? ApplicationData.Current.LocalFolder.Path
: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), AppSpecificPath, "Data");
string PlatformAppDataDirectory => _platformAppDataDirectory.Value;

Task<Stream> PlatformOpenAppPackageFileAsync(string filename)
{
Expand Down
24 changes: 10 additions & 14 deletions src/Essentials/test/DeviceTests/Tests/FileSystem_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Maui.Essentials.DeviceTests
[Category("FileSystem")]
public class FileSystem_Tests
{
const string bundleFileContents = "This file was in the app bundle.";
const string BundleFileContents = "This file was in the app bundle.";

[Fact]
public void CacheDirectory_Is_Valid()
Expand All @@ -23,23 +23,19 @@ public void AppDataDirectory_Is_Valid()
}

[Theory]
[InlineData("AppBundleFile.txt", bundleFileContents)]
[InlineData("AppBundleFile_NoExtension", bundleFileContents)]
[InlineData("Folder/AppBundleFile_Nested.txt", bundleFileContents)]
[InlineData("Folder\\AppBundleFile_Nested.txt", bundleFileContents)]
[InlineData("AppBundleFile.txt", BundleFileContents)]
[InlineData("AppBundleFile_NoExtension", BundleFileContents)]
[InlineData("Folder/AppBundleFile_Nested.txt", BundleFileContents)]
[InlineData("Folder\\AppBundleFile_Nested.txt", BundleFileContents)]
public async Task OpenAppPackageFileAsync_Can_Load_File(string filename, string contents)
{
using (var stream = await FileSystem.OpenAppPackageFileAsync(filename))
{
Assert.NotNull(stream);
using var stream = await FileSystem.OpenAppPackageFileAsync(filename);
Assert.NotNull(stream);

using (var reader = new StreamReader(stream))
{
var text = await reader.ReadToEndAsync();
using var reader = new StreamReader(stream);
var text = await reader.ReadToEndAsync();

Assert.Equal(contents, text);
}
}
Assert.Equal(contents, text);
}

[Fact]
Expand Down

0 comments on commit 742767d

Please sign in to comment.