Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Src/xWorks/RecordEditView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ bool ShowRecordOnIdle(object parameter)
}
else
{
// Switching from New with no record leaves the tree uninitialized.
EnsureDataTreeInitialized();
EnsureDataTreeVisible();
m_dataEntryForm.Hide();
m_dataEntryForm.Reset(); // in case user deleted the object it was based upon.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,29 @@ public void RegisteredRecordEditTools_ResolveToAvalonia_WhenUIModeIsNew(string t
toolValue);
}

// Switching from New to the WinForms view with no current record must still initialize
// the DataTree: leaving the tool (or closing the window) calls its PrepareToGoAway.
[Test]
public void FlipNewToLegacy_WithNoCurrentRecord_PrepareToGoAwaySucceeds()
{
m_propertyTable.SetProperty("UIMode", "New", true);
m_propertyTable.SetPropertyPersistence("UIMode", false);

LoadRecordEditView("ProdRestrictEdit");
DrainMediatorAndIdleQueues();

var control = m_propertyTable.GetValue<object>("currentContentControlObject", null) as RecordEditView;
Assert.That(control, Is.Not.Null);
Assert.That(control.Clerk.CurrentObject, Is.Null, "precondition: the list is empty");
Assert.That(GetPrivateFieldValue(control, "m_activeUIFramework"), Is.EqualTo(UIFramework.Avalonia));

m_propertyTable.SetProperty("UIMode", "Legacy", true);
DrainMediatorAndIdleQueues();
Assert.That(GetPrivateFieldValue(control, "m_activeUIFramework"), Is.EqualTo(UIFramework.Legacy));

Assert.That(control.PrepareToGoAway(), Is.True);
}

// LT-22811: View > Refresh and closing the Styles dialog reach the Avalonia view through
// RefreshDisplay, which recomposes it at Normal's new size.
[Test]
Expand Down
Loading