Adds unlit color to hidden file system browser dialog elements.

This commit is contained in:
BinaryAlley committed 2026-11-15 13:53:23 +02:00
1 parent 3f7cc2c60f
commit b46dce745b
58 files changed
+855 -360

No files matched your search

@@ -58,7 +58,7 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
// Arrange
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // Two levels to get to the element that has a hidden element as child.
string encodedPath = Uri.EscapeDataString(testPath);
bool shouldIncludeHiddenElements = false;
try
@@ -82,13 +82,13 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
}
}
[Fact]
[SkipWhenHiddenAttributeNotSupportedFact]
public async Task GetDirectories_WhenCalledWithValidPathAndWithShouldIncludeHiddenElements_ShouldReturnDirectoriesWithHiddenElements()
{
// Arrange
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // Two levels to get to the element that has a hidden element as child.
string encodedPath = Uri.EscapeDataString(testPath);
bool shouldIncludeHiddenElements = true;
try
@@ -112,7 +112,8 @@ public class GetDirectoriesEndpointTests : IClassFixture<AuthenticatedLuminaApiF
DirectoryResponse firstDirectory = directories!.First();
Assert.Equal((s_isUnix ? "." : string.Empty) + "NestedDirectory_2", directories!.First().Name);
Assert.Equal(System.IO.Path.Combine(testPath, (s_isUnix ? "." : string.Empty) + "NestedDirectory_2" + System.IO.Path.DirectorySeparatorChar), directories.First().Path);
Assert.Single(directories); // only directories
Assert.True(firstDirectory.IsHidden);
Assert.Single(directories); // Only directories.
}
finally
{
@@ -80,7 +80,8 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
FileResponse firstDirectory = files!.First();
Assert.Equal("TestFile_2.txt", firstDirectory.Name);
Assert.Equal(System.IO.Path.Combine(testPath, "TestFile_2.txt"), firstDirectory.Path);
Assert.Single(files); // only files
Assert.False(firstDirectory.IsHidden);
Assert.Single(files); // Only files.
}
finally
{
@@ -94,7 +95,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
// Arrange
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // Two levels to get to the element that has a hidden element as child.
bool shouldIncludeHiddenElements = false;
try
{
@@ -112,6 +113,7 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
FileResponse firstDirectory = files!.First();
Assert.Equal("TestFile_2.txt", firstDirectory.Name);
Assert.Equal(System.IO.Path.Combine(testPath, "TestFile_2.txt"), firstDirectory.Path);
Assert.False(firstDirectory.IsHidden);
}
finally
{
@@ -119,13 +121,13 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
}
}
[Fact]
[SkipWhenHiddenAttributeNotSupportedFact]
public async Task GetFiles_WhenCalledWithValidPathAndWithShouldIncludeHiddenElements_ShouldReturnFilesWithHiddenElements()
{
// Arrange
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // Two levels to get to the element that has a hidden element as child.
bool shouldIncludeHiddenElements = true;
try
{
@@ -147,10 +149,12 @@ public class GetFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactory
FileResponse firstDirectory = files!.First();
Assert.Equal((s_isUnix ? "." : string.Empty) + "TestFile_1.txt", firstDirectory.Name);
Assert.Equal(System.IO.Path.Combine(testPath, (s_isUnix ? "." : string.Empty) + "TestFile_1.txt"), firstDirectory.Path);
Assert.True(firstDirectory.IsHidden);
FileResponse secondDirectory = files!.Last();
Assert.Equal("TestFile_2.txt", secondDirectory.Name);
Assert.Equal(System.IO.Path.Combine(testPath, "TestFile_2.txt"), secondDirectory.Path);
Assert.False(secondDirectory.IsHidden);
Assert.Equal(2, files.Count);
}
finally
@@ -80,7 +80,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
FileSystemTreeNodeResponse firstDirectory = files!.First();
Assert.Equal("TestFile_2.txt", firstDirectory.Name);
Assert.Equal(System.IO.Path.Combine(testPath, "TestFile_2.txt"), firstDirectory.Path);
Assert.Single(files); // only files
Assert.Single(files); // Only files.
}
finally
{
@@ -94,7 +94,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
// Arrange
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // Two levels to get to the element that has a hidden element as child.
bool shouldIncludeHiddenElements = false;
try
{
@@ -120,13 +120,13 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
}
}
[Fact]
[SkipWhenHiddenAttributeNotSupportedFact]
public async Task GetTreeFiles_WhenCalledWithValidPathAndWithShouldIncludeHiddenElements_ShouldReturnTreeFilesWithHiddenElements()
{
// Arrange
string testPath = _fileSystemStructureFixture.CreateFileSystemStructure();
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath;
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // two levels to get to the element that has a hidden element as child
testPath = System.IO.Path.GetDirectoryName(testPath) ?? testPath; // Two levels to get to the element that has a hidden element as child.
bool shouldIncludeHiddenElements = true;
try
{
@@ -148,10 +148,12 @@ public class GetTreeFilesEndpointTests : IClassFixture<AuthenticatedLuminaApiFac
FileSystemTreeNodeResponse firstDirectory = files!.First();
Assert.Equal((s_isUnix ? "." : string.Empty) + "TestFile_1.txt", firstDirectory.Name);
Assert.Equal(System.IO.Path.Combine(testPath, (s_isUnix ? "." : string.Empty) + "TestFile_1.txt"), firstDirectory.Path);
Assert.True(firstDirectory.IsHidden);
FileSystemTreeNodeResponse secondDirectory = files!.Last();
Assert.Equal("TestFile_2.txt", secondDirectory.Name);
Assert.Equal(System.IO.Path.Combine(testPath, "TestFile_2.txt"), secondDirectory.Path);
Assert.False(secondDirectory.IsHidden);
Assert.Equal(2, files.Count);
}
finally
@@ -39,7 +39,7 @@ public class GetDirectoriesEndpointTests : IClassFixture<LuminaWebFactory>
// Arrange
_apiFactory.ApiClientStub.Reset();
string path = @"C:\Users\test";
DirectoryDto[] expectedDirectories = [_directoryDtoFixture.Create(path: path, name: "test")];
DirectoryDto[] expectedDirectories = [_directoryDtoFixture.Create(path: path, name: "test", isHidden: true)];
string expectedEndpoint = $"directories/get-directories?path={Uri.EscapeDataString(path)}&shouldIncludeHiddenElements=True";
_apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, expectedDirectories);
AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
@@ -56,6 +56,7 @@ public class GetDirectoriesEndpointTests : IClassFixture<LuminaWebFactory>
using JsonDocument json = JsonDocument.Parse(content);
Assert.True(json.RootElement.GetProperty("success").GetBoolean());
Assert.Equal(expectedDirectories.Length, json.RootElement.GetProperty("data").GetArrayLength());
Assert.True(json.RootElement.GetProperty("data")[0].GetProperty("isHidden").GetBoolean());
Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled);
}
}
@@ -39,7 +39,7 @@ public class GetFilesEndpointTests : IClassFixture<LuminaWebFactory>
// Arrange
_apiFactory.ApiClientStub.Reset();
string path = @"C:\Users\test";
FileDto[] expectedFiles = [_fileDtoFixture.Create(path: path, name: "book.pdf")];
FileDto[] expectedFiles = [_fileDtoFixture.Create(path: path, name: "book.pdf", isHidden: true)];
string expectedEndpoint = $"files/get-files?path={Uri.EscapeDataString(path)}&shouldIncludeHiddenElements=True";
_apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, expectedFiles);
AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
@@ -56,6 +56,7 @@ public class GetFilesEndpointTests : IClassFixture<LuminaWebFactory>
using JsonDocument json = JsonDocument.Parse(content);
Assert.True(json.RootElement.GetProperty("success").GetBoolean());
Assert.Equal(expectedFiles.Length, json.RootElement.GetProperty("data").GetArrayLength());
Assert.True(json.RootElement.GetProperty("data")[0].GetProperty("isHidden").GetBoolean());
Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled);
}
}
@@ -39,7 +39,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<LuminaWebFactory>
// Arrange
_apiFactory.ApiClientStub.Reset();
string path = @"C:\Users\test";
FileSystemTreeNodeDto[] expectedNodes = [_fileSystemTreeNodeDtoFixture.Create(path: path, name: "test")];
FileSystemTreeNodeDto[] expectedNodes = [_fileSystemTreeNodeDtoFixture.Create(path: path, name: "test", isHidden: true)];
string expectedEndpoint = $"files/get-tree-files?path={Uri.EscapeDataString(path)}&shouldIncludeHiddenElements=True";
_apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, expectedNodes);
AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
@@ -56,6 +56,7 @@ public class GetTreeFilesEndpointTests : IClassFixture<LuminaWebFactory>
using JsonDocument json = JsonDocument.Parse(content);
Assert.True(json.RootElement.GetProperty("success").GetBoolean());
Assert.Equal(expectedNodes.Length, json.RootElement.GetProperty("data").GetArrayLength());
Assert.True(json.RootElement.GetProperty("data")[0].GetProperty("isHidden").GetBoolean());
Assert.Contains(expectedEndpoint, _apiFactory.ApiClientStub.GetEndpointsCalled);
}
}