Improve file operations, layout memory, and drive status.
Add a sequential file-operations queue with pause, reorder, and optional auto-clear; persist window size and tree width; show free space; and clear leftover indexing status. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Explorer.Application;
|
||||
using Explorer.Domain;
|
||||
using Explorer.Domain.Abstractions;
|
||||
|
||||
namespace Explorer.Application.Tests;
|
||||
@@ -13,12 +14,14 @@ public class UiPreferencesStoreTests
|
||||
"theme=Light",
|
||||
"group-network=true",
|
||||
"group-cloud=false",
|
||||
"index-archives=true"
|
||||
"index-archives=true",
|
||||
"auto-clear-queue=true"
|
||||
]);
|
||||
Assert.Equal("Light", prefs.Theme);
|
||||
Assert.True(prefs.GroupNetworkPlaces);
|
||||
Assert.False(prefs.GroupCloudPlaces);
|
||||
Assert.True(prefs.IndexArchiveContents);
|
||||
Assert.True(prefs.AutoClearQueueWhenDone);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -29,6 +32,30 @@ public class UiPreferencesStoreTests
|
||||
Assert.False(prefs.GroupNetworkPlaces);
|
||||
Assert.False(prefs.GroupCloudPlaces);
|
||||
Assert.False(prefs.IndexArchiveContents);
|
||||
Assert.True(prefs.ShowHiddenFiles);
|
||||
Assert.False(prefs.ShowProtectedSystemLocations);
|
||||
Assert.False(prefs.AutoClearQueueWhenDone);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Parse_reads_window_layout()
|
||||
{
|
||||
var prefs = UiPreferencesStore.Parse(
|
||||
[
|
||||
"theme=Dark",
|
||||
"window-width=1440.5",
|
||||
"window-height=900",
|
||||
"window-left=12",
|
||||
"window-top=24",
|
||||
"window-maximized=true",
|
||||
"tree-width=320"
|
||||
]);
|
||||
Assert.Equal(1440.5, prefs.WindowWidth);
|
||||
Assert.Equal(900, prefs.WindowHeight);
|
||||
Assert.Equal(12, prefs.WindowLeft);
|
||||
Assert.Equal(24, prefs.WindowTop);
|
||||
Assert.True(prefs.WindowMaximized);
|
||||
Assert.Equal(320, prefs.TreeWidth);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -38,12 +65,18 @@ public class UiPreferencesStoreTests
|
||||
try
|
||||
{
|
||||
var store = new UiPreferencesStore(new PrefsEnv(dir));
|
||||
store.Save(new UiPreferences("Light", true, false, true));
|
||||
store.Save(new UiPreferences("Light", true, false, true, AutoClearQueueWhenDone: true, WindowWidth: 1100, WindowHeight: 720, TreeWidth: 300));
|
||||
var loaded = store.Load();
|
||||
Assert.Equal("Light", loaded.Theme);
|
||||
Assert.True(loaded.GroupNetworkPlaces);
|
||||
Assert.False(loaded.GroupCloudPlaces);
|
||||
Assert.True(loaded.IndexArchiveContents);
|
||||
Assert.True(loaded.ShowHiddenFiles);
|
||||
Assert.False(loaded.ShowProtectedSystemLocations);
|
||||
Assert.True(loaded.AutoClearQueueWhenDone);
|
||||
Assert.Equal(1100, loaded.WindowWidth);
|
||||
Assert.Equal(720, loaded.WindowHeight);
|
||||
Assert.Equal(300, loaded.TreeWidth);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -52,6 +85,28 @@ public class UiPreferencesStoreTests
|
||||
}
|
||||
}
|
||||
|
||||
public class LocationVisibilityTests
|
||||
{
|
||||
[Fact]
|
||||
public void Hides_protected_when_setting_is_off()
|
||||
{
|
||||
var prefs = UiPreferences.Default;
|
||||
var svi = LocationClassifier.Classify(
|
||||
@"C:\System Volume Information", "System Volume Information",
|
||||
AttributeFlags.Directory | AttributeFlags.Hidden | AttributeFlags.System, true);
|
||||
Assert.False(LocationVisibility.ShouldShow(svi, prefs));
|
||||
Assert.True(LocationVisibility.ShouldShow(svi, prefs with { ShowProtectedSystemLocations = true }));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Unknown_size_when_access_denied_and_zero()
|
||||
{
|
||||
var info = new LocationInfo(true, true, true, true, false);
|
||||
Assert.Equal(SizeKnowledge.Unknown, LocationVisibility.ResolveSizeKnowledge(info, true, 0, true));
|
||||
Assert.Equal(SizeKnowledge.Partial, LocationVisibility.ResolveSizeKnowledge(info, true, 1000, true));
|
||||
}
|
||||
}
|
||||
|
||||
file sealed class PrefsEnv : IAppEnvironment
|
||||
{
|
||||
public PrefsEnv(string dir)
|
||||
|
||||
Reference in New Issue
Block a user