Revamp UI a whole lot

This commit is contained in:
2026-11-18 19:42:44 +01:00
parent 260abc2c98
commit fdde7f9d80
57 changed files with 2667 additions and 935 deletions
+7 -34
View File
@@ -179,7 +179,7 @@ public class ReadabilityTests
}
Assert.That(settings.Q<Label>(className: "settings-description").resolvedStyle.fontSize,
Is.EqualTo(size == UITextSize.Large ? 17 : 15), context);
foreach (var control in new VisualElement[] { settings.Q<Toggle>("ReducedMotionToggle"), settings.Q<Button>("TextSizeButton"), settings.Q<Button>("DensityButton"), settings.Q<Button>("SoundVolumeButton") })
foreach (var control in new VisualElement[] { settings.Q<Toggle>("ReducedMotionToggle"), settings.Q<Button>("TextSizeButton"), settings.Q<Button>("DensityButton"), settings.Q<SliderInt>("SoundVolumeSlider") })
{
Assert.That(control.focusable, Is.True, context);
control.Focus();
@@ -254,7 +254,7 @@ public class ReadabilityTests
}
[UnityTest]
public IEnumerator LongRuntimeHintsStayOnscreenScrollWithoutTakingFocusAndRefreshRetainedOwners()
public IEnumerator TooltipsNeverCreateAnAutomaticBottomPanel()
{
RequireGraphics();
var window = ScriptableObject.CreateInstance<TerminalFocusTestWindow>();
@@ -269,42 +269,15 @@ public class ReadabilityTests
UIPreferences.TextSize = UITextSize.Large;
Attach(root);
var owner = new Button { text = "Inspect live card" };
var lines = new string[24];
for (int i = 0; i < lines.Length; i++) lines[i] = "Compilation and equipment modify this card.";
owner.tooltip = string.Join("\n", lines);
owner.tooltip = "Compilation and equipment modify this card.";
root.Add(owner);
owner.Focus();
double waitUntil = EditorApplication.timeSinceStartup + 0.7;
double waitUntil = EditorApplication.timeSinceStartup + 0.35;
while (EditorApplication.timeSinceStartup < waitUntil) yield return null;
var hint = root.Q<ScrollView>(className: "runtime-hint");
Assert.That(hint, Is.Not.Null);
Assert.That(hint.resolvedStyle.display, Is.EqualTo(DisplayStyle.Flex));
Assert.That(hint.worldBound.xMin, Is.GreaterThanOrEqualTo(root.worldBound.xMin));
Assert.That(hint.worldBound.xMax, Is.LessThanOrEqualTo(root.worldBound.xMax));
Assert.That(hint.worldBound.yMin, Is.GreaterThanOrEqualTo(root.worldBound.yMin));
Assert.That(hint.worldBound.yMax, Is.LessThanOrEqualTo(root.worldBound.yMax));
Assert.That(hint.verticalScroller.highValue, Is.GreaterThan(0));
Assert.That(hint.focusable, Is.False);
Assert.That(hint.verticalScroller.slider.focusable, Is.False);
using (var pageDown = KeyDownEvent.GetPooled('\0', KeyCode.PageDown, EventModifiers.None)) owner.SendEvent(pageDown);
yield return null;
Assert.That(hint.scrollOffset.y, Is.GreaterThan(0));
Assert.That(root.Q(className: "runtime-hint"), Is.Null);
Assert.That(root.childCount, Is.EqualTo(1));
Assert.That(owner.tooltip, Is.EqualTo("Compilation and equipment modify this card."));
Assert.That(root.focusController.focusedElement, Is.SameAs(owner));
owner.tooltip = "Updated preview: 24 damage; 7 Shield; cost 1 Cycle.";
waitUntil = EditorApplication.timeSinceStartup + 0.3;
while (EditorApplication.timeSinceStartup < waitUntil) yield return null;
Assert.That(hint.Q<Label>("RuntimeHintText").text, Is.EqualTo(owner.tooltip));
Assert.That(hint.resolvedStyle.display, Is.EqualTo(DisplayStyle.Flex));
root.Clear();
var replacement = new Button { text = "Inspect another card", tooltip = "Current package readiness" };
root.Add(replacement);
replacement.Focus();
waitUntil = EditorApplication.timeSinceStartup + 0.7;
while (EditorApplication.timeSinceStartup < waitUntil) yield return null;
Assert.That(root.Q<ScrollView>(className: "runtime-hint"), Is.SameAs(hint));
Assert.That(hint.Q<Label>("RuntimeHintText").text, Is.EqualTo(replacement.tooltip));
LogAssert.NoUnexpectedReceived();
}
finally { window.Close(); }