Skip to content

Commit

Permalink
Merge branch 'master' into logger-ensure-header-later
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach authored Jan 22, 2024
2 parents fde229c + 4cfa451 commit 8172b89
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,5 @@ fabric.properties
inspectcodereport.xml
inspectcode

.idea/.idea.osu-framework.Desktop/.idea/misc.xml
.idea/.idea.osu-framework.Desktop/.idea/misc.xml
.idea/.idea.osu-framework.Android/.idea/deploymentTargetDropDown.xml
21 changes: 19 additions & 2 deletions osu.Framework.Android/AndroidGameView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,25 @@ private void updateSafeArea()
usableScreenArea = usableScreenArea.Shrink(cutout.SafeInsetLeft, cutout.SafeInsetRight, cutout.SafeInsetTop, cutout.SafeInsetBottom);
}

if (OperatingSystem.IsAndroidVersionAtLeast(31) && RootWindowInsets != null)
{
var topLeftCorner = RootWindowInsets.GetRoundedCorner((int)RoundedCornerPosition.TopLeft);
var topRightCorner = RootWindowInsets.GetRoundedCorner((int)RoundedCornerPosition.TopRight);
var bottomLeftCorner = RootWindowInsets.GetRoundedCorner((int)RoundedCornerPosition.BottomLeft);
var bottomRightCorner = RootWindowInsets.GetRoundedCorner((int)RoundedCornerPosition.BottomRight);

int cornerInsetLeft = Math.Max(topLeftCorner?.Radius ?? 0, bottomLeftCorner?.Radius ?? 0);
int cornerInsetRight = Math.Max(topRightCorner?.Radius ?? 0, bottomRightCorner?.Radius ?? 0);
int cornerInsetTop = Math.Max(topLeftCorner?.Radius ?? 0, topRightCorner?.Radius ?? 0);
int cornerInsetBottom = Math.Max(bottomLeftCorner?.Radius ?? 0, bottomRightCorner?.Radius ?? 0);

var radiusInsetArea = screenArea.Width >= screenArea.Height
? screenArea.Shrink(cornerInsetLeft, cornerInsetRight, 0, 0)
: screenArea.Shrink(0, 0, cornerInsetTop, cornerInsetBottom);

usableScreenArea = usableScreenArea.Intersect(radiusInsetArea);
}

if (OperatingSystem.IsAndroidVersionAtLeast(24) && Activity.IsInMultiWindowMode)
{
// if we are in multi-window mode, the status bar is always visible (even if we request to hide it) and could be obstructing our view.
Expand All @@ -257,8 +276,6 @@ private void updateSafeArea()
usableScreenArea = usableScreenArea.Intersect(screenArea.Shrink(0, 0, statusBarHeight, 0));
}

// TODO: add rounded corners support (Android 12): https://developer.android.com/guide/topics/ui/look-and-feel/rounded-corners

// compute the location/area of this view on the screen.

int[] location = new int[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace TemplateGame.Game.Tests.Visual
{
public partial class TemplateGameTestScene : TestScene
public abstract partial class TemplateGameTestScene : TestScene
{
protected override ITestSceneTestRunner CreateRunner() => new TemplateGameTestSceneTestRunner();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace FlappyDon.Game.Tests.Visual
{
public partial class FlappyDonTestScene : TestScene
public abstract partial class FlappyDonTestScene : TestScene
{
protected override ITestSceneTestRunner CreateRunner() => new FlappyDonTestSceneTestRunner();

Expand Down
6 changes: 6 additions & 0 deletions osu.Framework.Tests/Clocks/InterpolatingFramedClockTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ public void NeverInterpolatesBackwardsOnInterpolationFail()
Assert.Greater(interpolatedCount, 10);
}

// Regularly failing on single-thread macOS CI, failing when test asserts interpolating.IsInterpolating = false
//
// CanSeekForwardsOnInterpolationFail
// Expected: False
// But was: True
[Test]
[FlakyTest]
public void CanSeekForwardsOnInterpolationFail()
{
const int sleep_time = 20;
Expand Down
25 changes: 25 additions & 0 deletions osu.Framework.Tests/FlakyTestAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using NUnit.Framework;

namespace osu.Framework.Tests
{
/// <summary>
/// An attribute to mark any flaky tests.
/// Will add a retry count unless environment variable `FAIL_FLAKY_TESTS` is set to `1`.
/// </summary>
public class FlakyTestAttribute : RetryAttribute
{
public FlakyTestAttribute()
: this(10)
{
}

public FlakyTestAttribute(int tryCount)
: base(Environment.GetEnvironmentVariable("OSU_TESTS_FAIL_FLAKY") == "1" ? 1 : tryCount)
{
}
}
}
6 changes: 3 additions & 3 deletions osu.Framework/Graphics/Containers/FlowContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ protected override void UpdateAfterChildren()
base.UpdateAfterChildren();

if (!childLayout.IsValid)
{
InvalidateLayout();
childLayout.Validate();
}

if (!layout.IsValid)
{
performLayout();

layout.Validate();
// It's important to only validate childLayout after performLayout() is called to ensure it doesn't get re-invalidated.
childLayout.Validate();
}
}

Expand Down
1 change: 1 addition & 0 deletions osu.Framework/Graphics/Sprites/SpriteIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private void updateTexture()
}

loadedIcon = loadableIcon;
Invalidate(Invalidation.DrawNode);
}

private bool shadow;
Expand Down

0 comments on commit 8172b89

Please sign in to comment.