Skip to content

Commit

Permalink
Merge branch 'master' into bezier-approximation-tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach authored Dec 7, 2023
2 parents 0f8d3cc + 5a45622 commit a3f3fa6
Show file tree
Hide file tree
Showing 82 changed files with 830 additions and 611 deletions.
8 changes: 1 addition & 7 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
"commands": [
"CodeFileSanity"
]
},
"java.openjdk": {
"version": "11.0.1-beta001",
"commands": [
"Java.OpenJDK"
]
}
}
}
}
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Setup JDK 11
uses: actions/setup-java@v3
with:
distribution: microsoft
java-version: 11

- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/deploy-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ jobs:
with:
dotnet-version: "6.0.x"

- name: Setup JDK 11
uses: actions/setup-java@v3
with:
distribution: microsoft
java-version: 11

- name: Restore .NET workloads
run: dotnet workload install android

Expand Down
2 changes: 1 addition & 1 deletion osu.Framework.Benchmarks/BenchmarkTextBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private void initialiseBuilder(bool withDifferentBaselines)

private class TestStore : ITexturedGlyphLookupStore
{
public ITexturedCharacterGlyph Get(string fontName, char character) => new TexturedCharacterGlyph(
public ITexturedCharacterGlyph Get(string? fontName, char character) => new TexturedCharacterGlyph(
new CharacterGlyph(character, character, character, character, character, null),
new DummyRenderer().CreateTexture(1, 1));

Expand Down
Binary file not shown.
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/linux-x64/native/libavutil.so
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/linux-x64/native/libswscale.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/osx/native/libavutil.56.dylib
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/osx/native/libswscale.5.dylib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-arm64/native/avutil-56.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-arm64/native/swscale-5.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x64/native/avcodec-58.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x64/native/avformat-58.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x64/native/avutil-56.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x64/native/swscale-5.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x86/native/avcodec-58.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x86/native/avformat-58.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x86/native/avutil-56.dll
Binary file not shown.
Binary file modified osu.Framework.NativeLibs/runtimes/win-x86/native/swscale-5.dll
Binary file not shown.
13 changes: 9 additions & 4 deletions osu.Framework.NativeLibs/scripts/ffmpeg/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ FFMPEG_FLAGS=(
--enable-avformat
--enable-swscale

# File and video formats
--enable-demuxer='mov,matroska,flv,avi' # mov = mp4, matroska = mkv & webm
--enable-parser='mpeg4video,h264,hevc,vp8,vp9'
--enable-decoder='flv,mpeg4,h264,hevc,vp8,vp9'
# Legacy video formats
--enable-demuxer='avi,flv,asf'
--enable-parser='mpeg4video'
--enable-decoder='flv,msmpeg4v1,msmpeg4v2,msmpeg4v3,mpeg4,vp6,vp6f,wmv2'

# Modern video formats
--enable-demuxer='mov,matroska' # mov = mp4, matroska = mkv & webm
--enable-parser='h264,hevc,vp8,vp9'
--enable-decoder='h264,hevc,vp8,vp9'
--enable-protocol=pipe
)

Expand Down
8 changes: 8 additions & 0 deletions osu.Framework.Tests.Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<!--
READ_MEDIA_* permissions are available only on API 33 or greater. Devices with older android versions
don't understand the new permissions, so request the old READ_EXTERNAL_STORAGE permission to get storage access.
Since the old permission has no effect on >= API 33, don't request it.
Care needs to be taken to ensure runtime permission checks target the correct permission for the API level.
-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
</manifest>
5 changes: 3 additions & 2 deletions osu.Framework.Tests/Bindables/BindableBoolTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.Globalization;
using NUnit.Framework;
using osu.Framework.Bindables;

Expand All @@ -26,7 +27,7 @@ public void TestSet(bool value)
public void TestParsingString(string value, bool expected)
{
var bindable = new BindableBool();
bindable.Parse(value);
bindable.Parse(value, CultureInfo.InvariantCulture);

Assert.AreEqual(expected, bindable.Value);
}
Expand All @@ -36,7 +37,7 @@ public void TestParsingString(string value, bool expected)
public void TestParsingBoolean(bool value)
{
var bindable = new BindableBool();
bindable.Parse(value);
bindable.Parse(value, CultureInfo.InvariantCulture);

Assert.AreEqual(value, bindable.Value);
}
Expand Down
3 changes: 2 additions & 1 deletion osu.Framework.Tests/Bindables/BindableColour4Test.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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.Globalization;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
Expand Down Expand Up @@ -41,7 +42,7 @@ public void TestSet(byte r, byte g, byte b, byte a)
public void TestParsingString(string value, Colour4 expected)
{
var bindable = new BindableColour4();
bindable.Parse(value);
bindable.Parse(value, CultureInfo.InvariantCulture);

Assert.AreEqual(expected, bindable.Value);
}
Expand Down
29 changes: 15 additions & 14 deletions osu.Framework.Tests/Bindables/BindableDictionaryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Bindables;
Expand Down Expand Up @@ -166,7 +167,7 @@ public void TestBindCollectionChangedNotRunIfParsingSequenceEqualEnumerable()

NotifyDictionaryChangedEventArgs<string, byte> triggeredArgs = null;
dict.BindCollectionChanged((_, args) => triggeredArgs = args);
dict.Parse(enumerable);
dict.Parse(enumerable, CultureInfo.InvariantCulture);

Assert.That(triggeredArgs, Is.Null);
}
Expand Down Expand Up @@ -900,7 +901,7 @@ public void TestParseWithNullClearsDictionary()
{
bindableStringByteDictionary.Add("a item", 0);

bindableStringByteDictionary.Parse(null);
bindableStringByteDictionary.Parse(null, CultureInfo.InvariantCulture);

Assert.IsEmpty(bindableStringByteDictionary);
}
Expand All @@ -914,7 +915,7 @@ public void TestParseWithArray()
new KeyValuePair<string, byte>("testB", 1),
};

bindableStringByteDictionary.Parse(array);
bindableStringByteDictionary.Parse(array, CultureInfo.InvariantCulture);

CollectionAssert.AreEquivalent(array, bindableStringByteDictionary);
}
Expand All @@ -926,13 +927,13 @@ public void TestParseWithDisabledDictionaryThrowsInvalidOperationException()

Assert.Multiple(() =>
{
Assert.Throws(typeof(InvalidOperationException), () => bindableStringByteDictionary.Parse(null));
Assert.Throws(typeof(InvalidOperationException), () => bindableStringByteDictionary.Parse(null, CultureInfo.InvariantCulture));
Assert.Throws(typeof(InvalidOperationException), () => bindableStringByteDictionary.Parse(new[]
{
new KeyValuePair<string, byte>("test", 0),
new KeyValuePair<string, byte>("testabc", 1),
new KeyValuePair<string, byte>("asdasdasdasd", 1),
}));
}, CultureInfo.InvariantCulture));
});
}

Expand All @@ -941,13 +942,13 @@ public void TestParseWithInvalidArgumentTypesThrowsArgumentException()
{
Assert.Multiple(() =>
{
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(1));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(""));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(new object()));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(1.1));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(1.1f));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse("test123"));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(29387L));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(1, CultureInfo.InvariantCulture));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse("", CultureInfo.InvariantCulture));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(new object(), CultureInfo.InvariantCulture));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(1.1, CultureInfo.InvariantCulture));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(1.1f, CultureInfo.InvariantCulture));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse("test123", CultureInfo.InvariantCulture));
Assert.Throws(typeof(ArgumentException), () => bindableStringByteDictionary.Parse(29387L, CultureInfo.InvariantCulture));
});
}

Expand All @@ -967,7 +968,7 @@ public void TestParseWithNullNotifiesClearSubscribers()
var triggeredArgs = new List<NotifyDictionaryChangedEventArgs<string, byte>>();
bindableStringByteDictionary.CollectionChanged += (_, args) => triggeredArgs.Add(args);

bindableStringByteDictionary.Parse(null);
bindableStringByteDictionary.Parse(null, CultureInfo.InvariantCulture);

Assert.That(triggeredArgs, Has.Count.EqualTo(1));
Assert.That(triggeredArgs.First().Action, Is.EqualTo(NotifyDictionaryChangedAction.Remove));
Expand All @@ -988,7 +989,7 @@ public void TestParseWithItemsNotifiesAddRangeAndClearSubscribers()
var triggeredArgs = new List<NotifyDictionaryChangedEventArgs<string, byte>>();
bindableStringByteDictionary.CollectionChanged += (_, args) => triggeredArgs.Add(args);

bindableStringByteDictionary.Parse(array);
bindableStringByteDictionary.Parse(array, CultureInfo.InvariantCulture);

Assert.That(triggeredArgs, Has.Count.EqualTo(2));
Assert.That(triggeredArgs.First().Action, Is.EqualTo(NotifyDictionaryChangedAction.Remove));
Expand Down
38 changes: 35 additions & 3 deletions osu.Framework.Tests/Bindables/BindableDoubleTest.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// 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.Globalization;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Utils;

namespace osu.Framework.Tests.Bindables
{
Expand Down Expand Up @@ -53,7 +55,7 @@ public void TestDefaultCheck(double value, double def, double? precision = null)
public void TestParsingString(string value, double expected)
{
var bindable = new BindableDouble();
bindable.Parse(value);
bindable.Parse(value, CultureInfo.InvariantCulture);

Assert.AreEqual(expected, bindable.Value);
}
Expand All @@ -66,7 +68,7 @@ public void TestParsingString(string value, double expected)
public void TestParsingStringWithRange(string value, double minValue, double maxValue, double expected)
{
var bindable = new BindableDouble { MinValue = minValue, MaxValue = maxValue };
bindable.Parse(value);
bindable.Parse(value, CultureInfo.InvariantCulture);

Assert.AreEqual(expected, bindable.Value);
}
Expand All @@ -81,7 +83,7 @@ public void TestParsingStringWithRange(string value, double minValue, double max
public void TestParsingDouble(double value)
{
var bindable = new BindableDouble();
bindable.Parse(value);
bindable.Parse(value, CultureInfo.InvariantCulture);

Assert.AreEqual(value, bindable.Value);
}
Expand All @@ -98,5 +100,35 @@ public void TestPropagationToPlainBindable()
number.MinValue = 0;
number.MaxValue = 10;
}

[TestCase("1.4", "en-US", 1.4)]
[TestCase("1,4", "de-DE", 1.4)]
[TestCase("1.400,01", "de-DE", 1400.01)]
[TestCase("1 234,57", "ru-RU", 1234.57)]
[TestCase("1,094", "fr-FR", 1.094)]
[TestCase("1,400.01", "zh-CN", 1400.01)]
public void TestParsingStringLocale(string value, string locale, double expected)
{
var bindable = new BindableDouble();
bindable.Parse(value, CultureInfo.GetCultureInfo(locale));
Assert.AreEqual(expected, bindable.Value);
}

[TestCase(1.4, "en-US", "1.4")]
[TestCase(1.4, "de-DE", "1,4")]
[TestCase(1400.01, "de-DE", "1400,01")]
[TestCase(1234.57, "ru-RU", "1234,57")]
[TestCase(1.094, "fr-FR", "1,094")]
[TestCase(1400.01, "zh-CN", "1400.01")]
public void TestParsingNumberLocale(double value, string locale, string expected)
{
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(locale);

var bindable = new BindableDouble(value);
string? asString = bindable.ToString();
Assert.AreEqual(expected, asString);
Assert.DoesNotThrow(() => bindable.Parse(asString, CultureInfo.CurrentCulture));
Assert.AreEqual(value, bindable.Value, Precision.DOUBLE_EPSILON);
}
}
}
13 changes: 7 additions & 6 deletions osu.Framework.Tests/Bindables/BindableEnumTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Globalization;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Bindables;
Expand Down Expand Up @@ -32,8 +33,8 @@ public void TestParsing(TestEnum expected, params object[] values)

foreach (object value in values.Append(expected))
{
bindable.Parse(value);
nullable.Parse(value);
bindable.Parse(value, CultureInfo.InvariantCulture);
nullable.Parse(value, CultureInfo.InvariantCulture);

Assert.AreEqual(expected, bindable.Value);
Assert.AreEqual(expected, nullable.Value);
Expand All @@ -47,8 +48,8 @@ public void TestUnparsaebles(object value)
var bindable = new Bindable<TestEnum>();
var nullable = new Bindable<TestEnum?>();

Assert.Throws<ArgumentException>(() => bindable.Parse(value));
Assert.Throws<ArgumentException>(() => nullable.Parse(value));
Assert.Throws<ArgumentException>(() => bindable.Parse(value, CultureInfo.InvariantCulture));
Assert.Throws<ArgumentException>(() => nullable.Parse(value, CultureInfo.InvariantCulture));
}

[Test]
Expand All @@ -57,8 +58,8 @@ public void TestEmptyString()
var bindable = new Bindable<TestEnum>();
var nullable = new Bindable<TestEnum?>();

Assert.Throws<ArgumentException>(() => bindable.Parse(string.Empty));
nullable.Parse(string.Empty);
Assert.Throws<ArgumentException>(() => bindable.Parse(string.Empty, CultureInfo.InvariantCulture));
nullable.Parse(string.Empty, CultureInfo.InvariantCulture);

Assert.That(nullable.Value, Is.Null);
}
Expand Down
Loading

0 comments on commit a3f3fa6

Please sign in to comment.