-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-Displays-allocation
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
osu.Framework.Tests/Visual/Sprites/TestSceneSpriteTextSizing.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using NUnit.Framework; | ||
using osu.Framework.Graphics.Sprites; | ||
|
||
namespace osu.Framework.Tests.Visual.Sprites | ||
{ | ||
public class TestSceneSpriteTextSizing : FrameworkTestScene | ||
{ | ||
[Test] | ||
public void TestNewSizeImmediatelyAvailableAfterTextChange() | ||
{ | ||
SpriteText text = null!; | ||
float initialSize = 0; | ||
|
||
AddStep("add initial text and get size", () => | ||
{ | ||
Child = text = new SpriteText { Text = "First" }; | ||
initialSize = text.DrawWidth; | ||
}); | ||
|
||
float updatedSize = 0; | ||
AddStep("set new text and grab size", () => | ||
{ | ||
text.Text = "Second"; | ||
updatedSize = text.DrawWidth; | ||
}); | ||
|
||
AddAssert("updated size is not equal to the initial size", () => updatedSize, () => Is.Not.EqualTo(initialSize)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters