Owner review 2, phase 5a (R8), fix round 4. A project the library no longer has now reads as Gone with no conflict to answer. The conflict stays recorded in sync.json, so Save both on a deleted project says Gone once and offers its copy. It no longer reopens the conflict dialog. Keep mine and Take the library's first check that the home still has the project. Neither is merged onto the last version a deleted project had, so the working state and the unsent versions stay as they were. Old files in versions/.replaced are pruned only after a push that ended well, never after one that stopped at a conflict. A file an earlier build set aside kept the time its version was written. It now counts as set aside no earlier than when this build first knew the folder (versions/.replaced.since), so an upgrade does not prune it by an old mtime. The Merge mark goes on the replayed version whose own change met a setting the conflict listed. A version that only rides along with a working-state conflict stays a commit. A first copy cancelled while paused or failed, which no handler runs, now has its partial media removed under the project's lease, as a running one does (ICancelledJobHandler). The space estimate counts a proxy held under its <id>-<sha16>.jpg name. The frames stamp carries a weighted SQL checksum of the hashes, so a hash replaced in place (a Verify) makes the workspace read the frames again. Desktop: a removal that cannot move a file puts back what it moved, so the copy stays whole and listed, and the failure is said. The Removed toast names a damaged copy as it is known, never by its folder id. One copy that cannot be listed no longer hides the others. A Main this Chronos cannot read (newer or damaged) is refused at once with the reason, and a damaged one offers Remove local copy. Save version is off on a Gone project, and Send/Delete there say the project was deleted in the library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
378 lines
21 KiB
C#
378 lines
21 KiB
C#
using System.IO;
|
|
using Chronos.App.Editor;
|
|
using Chronos.App.Infrastructure;
|
|
using Chronos.App.Workspace;
|
|
using Chronos.Core.Localization;
|
|
using Chronos.Core.Model;
|
|
using Chronos.Core.Project;
|
|
using Chronos.Data.Projects;
|
|
using Chronos.Data.Sync;
|
|
using Chronos.Ui.Controls;
|
|
using Chronos.Data.Workspaces;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.App.Tests.Workspace;
|
|
|
|
/// <summary>
|
|
/// The editor and the project menu of a workspace project as review 2's phase 5a found them wanting (owner review 2, R8):
|
|
/// saves that merge positions photo by photo and ask where both changed a setting, Take the library's as one undo step,
|
|
/// the chip read again after edits, conflicts that wait for the open dialog, Send first that shows the conflict it met,
|
|
/// Open project, read-only after a pull, a workspace inside a library, and how differences and authors read.
|
|
/// </summary>
|
|
[Category("workspace")]
|
|
public sealed class WorkspaceMenuTests(TestContext context)
|
|
{
|
|
private static ProjectSettings Exposure(ProjectSettings p, double ev) => p with { Exposure = p.Exposure with { ExposureOffsetEv = ev } };
|
|
|
|
[Test]
|
|
public async Task SavesMergeExclusionsPhotoByPhotoAndAskWhereBothChangedASetting()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var host = bed.Host();
|
|
var projectId = await bed.CheckoutAsync(host);
|
|
var (_, session) = await bed.OpenAsync(host, projectId);
|
|
var conflicts = new List<ProjectConflictException>();
|
|
session.ConflictFound += conflicts.Add;
|
|
await using (session)
|
|
{
|
|
var folder = host.Store.Find(projectId)!;
|
|
// A sync wrote another PC's exclusion of frame 5 while the editor's exclusion of frame 2 waited for its save.
|
|
var stored = folder.ReadBundle();
|
|
folder.WriteBundle(stored with { Project = stored.Project with { ExcludedFrames = [5] } });
|
|
Assert.True(session.SetExcluded([2], excluded: true));
|
|
Assert.True(await session.FlushAsync());
|
|
Assert.SequenceEqual([2, 5], folder.ReadBundle().Project.ExcludedFrames, "both exclusions are kept");
|
|
Assert.SequenceEqual([2, 5], session.Project.ExcludedFrames, "the editor shows the other one too");
|
|
Assert.Empty(conflicts);
|
|
|
|
// The same setting to another value meanwhile: asked, never decided for the editor.
|
|
stored = folder.ReadBundle();
|
|
folder.WriteBundle(stored with { Project = Exposure(stored.Project, 0.5) });
|
|
Assert.True(session.Edit(p => Exposure(p, 0.9)));
|
|
Assert.False(await session.FlushAsync(), "nothing is stored until the user chooses");
|
|
Assert.Count(1, conflicts);
|
|
var conflict = conflicts[0];
|
|
Assert.Contains(conflict.Differences, d => d.Path == "exposure.exposureOffsetEv");
|
|
Assert.Equal(0.5, folder.ReadBundle().Project.Exposure.ExposureOffsetEv);
|
|
var request = EditorViewModel.LibraryConflictRequest(conflict, "Harbour");
|
|
Assert.Equal(Loc.L("Editor.Workspace.Conflict.TakeHome"), request.SafeText);
|
|
Assert.Contains("0.9", request.Detail!);
|
|
Assert.True(session.ResolveConflict(keepMine: true));
|
|
Assert.True(await session.FlushAsync());
|
|
Assert.Equal(0.9, folder.ReadBundle().Project.Exposure.ExposureOffsetEv);
|
|
Assert.SequenceEqual([2, 5], folder.ReadBundle().Project.ExcludedFrames);
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task TakingTheLibrarysValuesIsOneUndoStepThatKeepsItsOtherChanges()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var here = bed.Host();
|
|
var there = bed.Host(name: "other-pc");
|
|
var mainId = await bed.CheckoutAsync(here);
|
|
await bed.CheckoutAsync(there);
|
|
var (sourceA, sessionA) = await bed.OpenAsync(there, mainId);
|
|
var (sourceB, sessionB) = await bed.OpenAsync(here, mainId);
|
|
var (uiA, uiB) = (new RecordingUi(), new RecordingUi());
|
|
await using (sessionA)
|
|
await using (sessionB)
|
|
using (var a = new ProjectMenuViewModel(there, sourceA, sessionA, uiA))
|
|
using (var b = new ProjectMenuViewModel(here, sourceB, sessionB, uiB))
|
|
{
|
|
// The other PC changes the exposure and the camera; this one the exposure only.
|
|
sessionA.Edit(p => Exposure(p, 0.1) with { Camera = p.Camera with { OffsetY = 0.2 } });
|
|
await a.SaveVersionAsync(null);
|
|
sessionB.Edit(p => Exposure(p, 0.7));
|
|
await b.SyncAsync();
|
|
var dialog = Assert.NotNull(uiB.Open as ConflictDialogViewModel);
|
|
Assert.Count(1, dialog.Differences);
|
|
|
|
dialog.TakeHomeCommand.Execute(null);
|
|
await WorkspaceTestBed.UntilAsync(() => uiB.Open is null, "take the library's settles it");
|
|
Assert.Equal((0.1, 0.2), (sessionB.Project.Exposure.ExposureOffsetEv, sessionB.Project.Camera.OffsetY));
|
|
var toast = uiB.Toasts[^1];
|
|
Assert.Equal(Loc.L("Editor.Workspace.TookLibrary"), toast.Title);
|
|
|
|
// Its Undo brings this PC's exposure back, not the camera the library alone changed; Ctrl+Z takes the take back alike.
|
|
toast.Action!();
|
|
Assert.Equal((0.7, 0.2), (sessionB.Project.Exposure.ExposureOffsetEv, sessionB.Project.Camera.OffsetY));
|
|
Assert.True(sessionB.Undo());
|
|
Assert.Equal(0.1, sessionB.Project.Exposure.ExposureOffsetEv);
|
|
Assert.True(sessionB.Undo());
|
|
Assert.Equal((0.7, 0.2), (sessionB.Project.Exposure.ExposureOffsetEv, sessionB.Project.Camera.OffsetY));
|
|
Assert.True(await sessionB.FlushAsync());
|
|
var working = here.Store.Find(mainId)!.ReadBundle().Project;
|
|
Assert.Equal((0.7, 0.2), (working.Exposure.ExposureOffsetEv, working.Camera.OffsetY), "the values brought back are stored");
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task TheChipFollowsEditsAndABackgroundConflictWaitsForTheOpenDialog()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var here = bed.Host();
|
|
var there = bed.Host(name: "other-pc");
|
|
var mainId = await bed.CheckoutAsync(here);
|
|
await bed.CheckoutAsync(there);
|
|
var (sourceA, sessionA) = await bed.OpenAsync(there, mainId);
|
|
var (sourceB, sessionB) = await bed.OpenAsync(here, mainId);
|
|
var (uiA, uiB) = (new RecordingUi(), new RecordingUi());
|
|
await using (sessionA)
|
|
await using (sessionB)
|
|
using (var a = new ProjectMenuViewModel(there, sourceA, sessionA, uiA))
|
|
using (var b = new ProjectMenuViewModel(here, sourceB, sessionB, uiB))
|
|
{
|
|
await b.RefreshAsync();
|
|
Assert.Equal(Loc.L("Editor.Workspace.State.InSync"), b.StateText);
|
|
sessionB.Edit(p => Exposure(p, 0.7));
|
|
await WorkspaceTestBed.UntilAsync(() => b.StateText == Loc.L("Editor.Workspace.State.Modified"), "the chip says the work is not saved as a version");
|
|
|
|
sessionA.Edit(p => Exposure(p, 0.1));
|
|
await a.SaveVersionAsync(null);
|
|
// The user types a note in Save version when an automatic sync (after an analysis) meets the conflict.
|
|
b.SaveVersionCommand.Execute(null);
|
|
var saving = Assert.NotNull(uiB.Open as SaveVersionDialogViewModel);
|
|
saving.Note = "Warmer";
|
|
await b.SyncAsync(quiet: true);
|
|
Assert.Same(saving, uiB.Open, "the open dialog stays");
|
|
Assert.Equal("Warmer", saving.Note);
|
|
Assert.Equal(WorkspaceState.Conflict, b.Status!.State);
|
|
await b.SyncAsync(quiet: true);
|
|
Assert.Count(1, uiB.Waiting, "asked once");
|
|
uiB.CloseDialog(saving);
|
|
Assert.NotNull(uiB.Open as ConflictDialogViewModel, "asked once the dialog closed");
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task SendFirstShowsTheConflictItMeetsAndRemovesNothing()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var here = bed.Host();
|
|
var there = bed.Host(name: "other-pc");
|
|
var mainId = await bed.CheckoutAsync(here);
|
|
await bed.CheckoutAsync(there);
|
|
var (sourceA, sessionA) = await bed.OpenAsync(there, mainId);
|
|
var (sourceB, sessionB) = await bed.OpenAsync(here, mainId);
|
|
var (uiA, uiB) = (new RecordingUi(), new RecordingUi());
|
|
await using (sessionA)
|
|
await using (sessionB)
|
|
using (var a = new ProjectMenuViewModel(there, sourceA, sessionA, uiA))
|
|
using (var b = new ProjectMenuViewModel(here, sourceB, sessionB, uiB))
|
|
{
|
|
sessionA.Edit(p => Exposure(p, 0.1));
|
|
await a.SaveVersionAsync(null);
|
|
sessionB.Edit(p => Exposure(p, 0.7));
|
|
Assert.True(await sessionB.FlushAsync());
|
|
|
|
b.RemoveCopyCommand.Execute(null);
|
|
await WorkspaceTestBed.UntilAsync(() => uiB.Open is RemoveCopyDialogViewModel, "the plan shows");
|
|
var removing = (RemoveCopyDialogViewModel)uiB.Open!;
|
|
removing.SendFirstCommand.Execute(null);
|
|
await WorkspaceTestBed.UntilAsync(() => uiB.Open is ConflictDialogViewModel, "the conflict is asked, not hidden behind Discard");
|
|
Assert.Equal(0, uiB.Closed, "the editor stays open");
|
|
Assert.NotNull(here.Store.Find(mainId), "nothing was removed");
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task SaveBothOfAProjectDeletedInTheLibrarySaysItIsGoneOnceAndOffersTheCopy()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var here = bed.Host();
|
|
var there = bed.Host(name: "other-pc");
|
|
var sideId = await bed.CheckoutAsync(here, newName: "Side");
|
|
await bed.CheckoutAsync(there, sideId);
|
|
var (sourceA, sessionA) = await bed.OpenAsync(there, sideId);
|
|
var (sourceB, sessionB) = await bed.OpenAsync(here, sideId);
|
|
var (uiA, uiB) = (new RecordingUi(), new RecordingUi());
|
|
await using (sessionA)
|
|
await using (sessionB)
|
|
using (var a = new ProjectMenuViewModel(there, sourceA, sessionA, uiA))
|
|
using (var b = new ProjectMenuViewModel(here, sourceB, sessionB, uiB))
|
|
{
|
|
sessionA.Edit(p => Exposure(p, 0.1));
|
|
await a.SaveVersionAsync(null);
|
|
sessionB.Edit(p => Exposure(p, 0.7));
|
|
await b.SyncAsync();
|
|
uiB.CloseDialog(Assert.NotNull(uiB.Open as ConflictDialogViewModel));
|
|
// Another PC deletes the project in the library while the choice is made here.
|
|
await bed.Archives.Projects.DeleteAsync(sideId, bed.Ct);
|
|
var before = uiB.Toasts.Count;
|
|
|
|
await b.ResolveAsync(ConflictChoice.SaveBoth);
|
|
Assert.Equal(WorkspaceState.Gone, b.Status!.State);
|
|
Assert.Null(b.Status.Conflict, "nothing is left to answer");
|
|
Assert.Null(uiB.Open, "the conflict is not asked again");
|
|
var said = uiB.Toasts.Skip(before).ToList();
|
|
Assert.Count(1, said.Where(t => t.Message == Loc.L("Errors.Workspace.DeletedAtHome")).ToList());
|
|
var copy = Assert.Contains(said, t => t.Action is not null);
|
|
Assert.Equal(b.Name, copy.Message, "the copy Save both made is offered");
|
|
Assert.False(b.SaveVersionCommand.CanExecute(null), "nothing can be sent to it");
|
|
Assert.Equal(0.7, sessionB.Project.Exposure.ExposureOffsetEv, "the work stays in the editor");
|
|
Assert.Equal(0.7, here.Store.Find(sideId)!.ReadBundle().Project.Exposure.ExposureOffsetEv);
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task OpenProjectOffersTheLibrarysOtherProjects()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var host = bed.Host();
|
|
var mainId = await bed.CheckoutAsync(host);
|
|
var vertical = await host.CreateProjectAsync(bed.SequenceId, "Vertical", null);
|
|
var (source, session) = await bed.OpenAsync(host, mainId);
|
|
var ui = new RecordingUi();
|
|
await using (session)
|
|
using (var menu = new ProjectMenuViewModel(host, source, session, ui))
|
|
{
|
|
menu.OpenProjectCommand.Execute(null);
|
|
await WorkspaceTestBed.UntilAsync(() => ui.Open is OpenInWorkspaceDialogViewModel, "the projects are listed");
|
|
var dialog = (OpenInWorkspaceDialogViewModel)ui.Open!;
|
|
Assert.SequenceEqual(["Vertical"], dialog.Projects.Select(p => p.Project.Name), "the open project is not offered");
|
|
dialog.IsNew = true;
|
|
dialog.NewName.Text = "Main";
|
|
Assert.False(dialog.CanOpen, "the open project's name is taken");
|
|
dialog.IsExisting = true;
|
|
dialog.SelectedProject = dialog.Projects[0];
|
|
dialog.OpenCommand.Execute(null);
|
|
await WorkspaceTestBed.UntilAsync(() => ui.Opened.Count == 1, "the project opens");
|
|
Assert.Equal((bed.SequenceId, vertical.Id), ui.Opened[0]);
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task APullOfANewerChronossSettingsTurnsTheEditorReadOnly()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var host = bed.Host();
|
|
var projectId = await bed.CheckoutAsync(host);
|
|
var (source, session) = await bed.OpenAsync(host, projectId);
|
|
var raised = 0;
|
|
source.ReadOnlyChanged += () => raised++;
|
|
await using (session)
|
|
{
|
|
Assert.False(session.IsReadOnly);
|
|
var folder = host.Store.Find(projectId)!;
|
|
var stored = folder.ReadBundle();
|
|
folder.WriteBundle(stored with { Project = stored.Project with { Version = ProjectSettings.CurrentVersion + 1 } });
|
|
await session.ReloadAsync();
|
|
Assert.True(session.IsReadOnly);
|
|
Assert.Equal(1, raised, "the editor is told, and shows it");
|
|
Assert.False(session.HasPendingSave, "no save that could never be stored waits");
|
|
Assert.False(session.Edit(p => Exposure(p, 0.4)));
|
|
Assert.True(await session.FlushAsync(), "operations that store the last edit go on");
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public async Task AWorkspaceInsideALibraryIsRefusedBeforeAnythingIsWritten()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var row = await bed.RowAsync();
|
|
var root = (await bed.Db.Archives.GetAsync(row.ArchiveId))!.RootPath;
|
|
var inside = Path.Combine(root, "Chronos", "data", "workspace");
|
|
var host = bed.Host(new AppSettings { WorkspaceFolder = inside });
|
|
Assert.Empty(await host.ListAsync());
|
|
Assert.Null(await host.FindAsync(Guid.NewGuid()));
|
|
var refused = await Assert.ThrowsAsync<WorkspaceException>(() => host.CheckoutAsync(bed.SequenceId, null, null));
|
|
Assert.Equal(Loc.L("Errors.Workspace.InsideLibraryEdit", inside), refused.Message);
|
|
Assert.False(Directory.Exists(inside), "nothing was written there");
|
|
}
|
|
|
|
[Test]
|
|
public void ACopyTheLibraryNoLongerHasCanOnlyBeDiscarded()
|
|
{
|
|
var plan = new WorkspaceRemovalPlan(Guid.NewGuid(), "Vertical", 3, 100, 0, false, false, true, Gone: true);
|
|
var dialog = new RemoveCopyDialogViewModel(plan, _ => Task.CompletedTask, () => Task.CompletedTask, () => false, _ => { });
|
|
Assert.False(dialog.RemoveCommand.CanExecute(null) || dialog.SendFirstCommand.CanExecute(null));
|
|
Assert.True(dialog.HasUnsent && dialog.DiscardCommand.CanExecute(null));
|
|
Assert.Equal(Loc.L("Errors.Workspace.ProjectGone"), dialog.RemoveToolTip);
|
|
|
|
// The chip keeps what the library said last when the working state is read again after an edit.
|
|
var basis = new BundleBase(Guid.NewGuid(), 2, new string('a', 64));
|
|
var gone = new WorkspaceStatus(WorkspaceState.Gone, false, 0, 0, true, false, false, null, basis, null);
|
|
var edited = new WorkspaceStatus(WorkspaceState.Modified, true, 0, 0, false, false, false, null, basis, null);
|
|
Assert.Equal(WorkspaceState.Gone, ProjectMenuViewModel.WithLocal(gone, edited).State);
|
|
// A conflict recorded here asks nothing of a project the library no longer has.
|
|
var recorded = new WorkspaceConflict(Guid.NewGuid(), 3, basis.VersionId, [], [], DateTimeOffset.UtcNow);
|
|
var stillGone = ProjectMenuViewModel.WithLocal(gone, edited with { State = WorkspaceState.Conflict, Conflict = recorded });
|
|
Assert.Equal((WorkspaceState.Gone, (WorkspaceConflict?)null), (stillGone.State, stillGone.Conflict));
|
|
var behind = gone with { State = WorkspaceState.Behind, Behind = 2, Offline = false };
|
|
Assert.Equal((WorkspaceState.Behind, 2), (ProjectMenuViewModel.WithLocal(behind, edited).State, ProjectMenuViewModel.WithLocal(behind, edited).Behind));
|
|
Assert.Equal(WorkspaceState.Modified, ProjectMenuViewModel.WithLocal(behind, edited with { Base = basis with { VersionId = Guid.NewGuid() } }).State,
|
|
"a base that moved since says nothing of how far the library is ahead");
|
|
// A version saved here that cannot be read outranks what the library said.
|
|
Assert.Equal(WorkspaceState.Damaged, ProjectMenuViewModel.WithLocal(behind, edited with { Damaged = 1 }).State);
|
|
}
|
|
|
|
[Test]
|
|
public void ADamagedVersionAndOneTooLargeReadAsSuch()
|
|
{
|
|
var damaged = new WorkspaceStatus(WorkspaceState.Damaged, false, 1, 0, false, false, false, null, null, null) { Damaged = 1 };
|
|
Assert.Equal((Loc.L("Editor.Workspace.State.Damaged"), StatusKind.Error), (WorkspaceText.State(damaged), WorkspaceText.Kind(damaged)));
|
|
Assert.Equal(Loc.L("Tooltips.Editor.Workspace.State.Damaged"), WorkspaceText.StateToolTip(damaged));
|
|
Assert.Equal(Loc.L("Errors.Workspace.Damaged"), WorkspaceText.Failure(new InvalidDataException("a version file cannot be read")));
|
|
|
|
// Too large: a version saved here (refused before it was written) and one the library refused say the same, with the limit.
|
|
var tooLarge = Loc.L("Errors.Workspace.VersionTooLarge", ProjectSidecars.MaxVersionBytes >> 20);
|
|
Assert.Contains("64", tooLarge);
|
|
Assert.Equal(tooLarge, WorkspaceText.Failure(new ProjectVersionTooLargeException("over the limit")));
|
|
Assert.Equal(tooLarge, WorkspaceText.Failure(new WorkspaceSyncException(PushOutcome.TooLarge, "over the limit")));
|
|
Assert.Equal(tooLarge, Chronos.App.Shell.ErrorText.For(new ProjectVersionTooLargeException("over the limit")));
|
|
Assert.Equal(Loc.L("Errors.Workspace.Refused"), WorkspaceText.Failure(new WorkspaceSyncException(PushOutcome.Invalid, "not this project's")));
|
|
}
|
|
|
|
[Test]
|
|
public void DifferencesNameTheirSettingsAndAuthorsReadAsThePc()
|
|
{
|
|
var lines = WorkspaceText.ConflictLines(
|
|
[
|
|
new SettingsDifference("hero", "{\"hero\":true}", "{\"hero\":true}"),
|
|
new SettingsDifference("pendingFrames.sha:ab12#0.keyframes", "[]", "[{\"x\":1}]"),
|
|
new SettingsDifference("pendingFrames.sha:cd34#0.excluded", "true", "false"),
|
|
], 10);
|
|
Assert.Count(3, lines);
|
|
Assert.Contains(lines, l => l.Contains(Loc.L("Server.Setting.HeroFrame"), StringComparison.Ordinal));
|
|
Assert.Contains(lines, l => l.Contains(Loc.L("Server.Setting.Keyframes"), StringComparison.Ordinal));
|
|
Assert.Contains(lines, l => l.Contains(Loc.L("Server.Setting.ExcludedFrames"), StringComparison.Ordinal));
|
|
Assert.False(lines.Any(l => l.Contains(Loc.L("Server.Setting.Other"), StringComparison.Ordinal)), "every line names its setting");
|
|
|
|
ProjectVersion Made(string? client, string? author = null) => new()
|
|
{
|
|
Id = Guid.NewGuid(),
|
|
ProjectId = Guid.NewGuid(),
|
|
Number = 1,
|
|
SettingsJson = "{}",
|
|
ContentHash = new string('0', 64),
|
|
ClientName = client,
|
|
Author = author,
|
|
};
|
|
Assert.Equal("STUDIO-PC", WorkspaceText.Author(Made("chronos@STUDIO-PC")));
|
|
Assert.Equal("STUDIO-PC", WorkspaceText.Author(Made("Chronos on STUDIO-PC")));
|
|
Assert.Equal("STUDIO-PC", WorkspaceText.Author(Made("STUDIO-PC")));
|
|
Assert.Equal("Alberto", WorkspaceText.Author(Made("STUDIO-PC", "Alberto")));
|
|
Assert.Equal(Environment.MachineName, WorkspaceHost.ClientName);
|
|
}
|
|
|
|
[Test]
|
|
public async Task CompareNamesExclusionsAsTheSettingTheyAre()
|
|
{
|
|
await using var bed = await WorkspaceTestBed.CreateAsync(context);
|
|
var host = bed.Host();
|
|
var projectId = await bed.CheckoutAsync(host);
|
|
var (source, session) = await bed.OpenAsync(host, projectId);
|
|
var ui = new RecordingUi();
|
|
await using (session)
|
|
using (var menu = new ProjectMenuViewModel(host, source, session, ui))
|
|
{
|
|
var head = (await host.HistoryAsync(projectId)).Versions[0];
|
|
Assert.True(session.SetExcluded([1, 3], excluded: true));
|
|
var lines = menu.Compare(head);
|
|
Assert.Count(1, lines);
|
|
Assert.Contains(Loc.L("Server.Setting.ExcludedFrames"), lines[0]);
|
|
}
|
|
}
|
|
}
|