A game framework written with osu! in mind.
at master 67 lines 2.2 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using NUnit.Framework; 5using osu.Framework.Graphics; 6using osu.Framework.Graphics.Containers; 7using osu.Framework.Graphics.Shapes; 8using osu.Framework.Testing; 9using osu.Framework.Tests.Visual; 10using osuTK; 11 12namespace osu.Framework.Tests.Layout 13{ 14 [HeadlessTest] 15 public class TestSceneSpriteLayout : FrameworkTestScene 16 { 17 [Test] 18 public void TestChangeEdgeSmoothnessAfterDraw() 19 { 20 Box box = null; 21 22 AddStep("create test", () => 23 { 24 Child = box = new Box 25 { 26 Anchor = Anchor.Centre, 27 Origin = Anchor.Centre, 28 Size = new Vector2(100), 29 Rotation = 30 30 }; 31 }); 32 33 AddAssert("zero inflation", () => box.InflationAmount == Vector2.Zero); 34 AddStep("change edge smoothness", () => box.EdgeSmoothness = new Vector2(2)); 35 AddAssert("has inflation", () => box.InflationAmount.X > 0 && box.InflationAmount.Y > 0); 36 } 37 38 [Test] 39 public void TestParentScaleChangesInflationAmount() 40 { 41 Drawable parent = null; 42 Box box = null; 43 44 AddStep("create test", () => 45 { 46 Child = parent = new Container 47 { 48 Anchor = Anchor.Centre, 49 Origin = Anchor.Centre, 50 Size = new Vector2(100), 51 Rotation = 30, 52 Child = box = new Box 53 { 54 RelativeSizeAxes = Axes.Both, 55 EdgeSmoothness = new Vector2(2) 56 } 57 }; 58 }); 59 60 Vector2 capturedInflation = Vector2.Zero; 61 62 AddStep("capture inflation", () => capturedInflation = box.InflationAmount); 63 AddStep("change parent scale", () => parent.Scale = new Vector2(2)); 64 AddAssert("inflation changed", () => box.InflationAmount != capturedInflation); 65 } 66 } 67}