mirror of https://github.com/ppy/osu
Merge branch 'master' into fix-lounge-loading
This commit is contained in:
commit
580136a5e9
|
@ -76,5 +76,23 @@ public void TestRestoreDefaultValueButtonPrecision(float initialValue)
|
|||
AddStep("restore default", () => sliderBar.Current.SetDefault());
|
||||
AddUntilStep("restore button hidden", () => restoreDefaultValueButton.Alpha == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestWarningTextVisibility()
|
||||
{
|
||||
SettingsNumberBox numberBox = null;
|
||||
|
||||
AddStep("create settings item", () => Child = numberBox = new SettingsNumberBox());
|
||||
AddAssert("warning text not created", () => !numberBox.ChildrenOfType<SettingsNoticeText>().Any());
|
||||
|
||||
AddStep("set warning text", () => numberBox.WarningText = "this is a warning!");
|
||||
AddAssert("warning text created", () => numberBox.ChildrenOfType<SettingsNoticeText>().Single().Alpha == 1);
|
||||
|
||||
AddStep("unset warning text", () => numberBox.WarningText = default);
|
||||
AddAssert("warning text hidden", () => numberBox.ChildrenOfType<SettingsNoticeText>().Single().Alpha == 0);
|
||||
|
||||
AddStep("set warning text again", () => numberBox.WarningText = "another warning!");
|
||||
AddAssert("warning text shown again", () => numberBox.ChildrenOfType<SettingsNoticeText>().Single().Alpha == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public LocalisableString? WarningText
|
|||
{
|
||||
set
|
||||
{
|
||||
bool hasValue = string.IsNullOrWhiteSpace(value.ToString());
|
||||
bool hasValue = !string.IsNullOrWhiteSpace(value.ToString());
|
||||
|
||||
if (warningText == null)
|
||||
{
|
||||
|
@ -76,7 +76,7 @@ public LocalisableString? WarningText
|
|||
FlowContent.Add(warningText = new SettingsNoticeText(colours) { Margin = new MarginPadding { Bottom = 5 } });
|
||||
}
|
||||
|
||||
warningText.Alpha = hasValue ? 0 : 1;
|
||||
warningText.Alpha = hasValue ? 1 : 0;
|
||||
warningText.Text = value.ToString(); // TODO: Remove ToString() call after TextFlowContainer supports localisation (see https://github.com/ppy/osu-framework/issues/4636).
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue