aboutsummaryrefslogtreecommitdiff
path: root/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
diff options
context:
space:
mode:
authorShadowghost <Shadowghost@users.noreply.github.com>2025-12-28 07:22:30 -0500
committerBond_009 <bond.009@outlook.com>2025-12-28 07:22:30 -0500
commit3c802a75054f316e04a5d914036f3164e8bf7e87 (patch)
tree685acd5c00c1bf0dcf04d3e2585a4af9147f7a4e /tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
parent928a8458dd62007abc0082f478432608e9153f6e (diff)
Backport pull request #15793 from jellyfin/release-10.11.z
Prefer US rating on fallback Original-merge: 156761405e7fd5308474a7e6301839ae7c694dfa Merged-by: crobibero <cody@robibe.ro> Backported-by: Bond_009 <bond.009@outlook.com>
Diffstat (limited to 'tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs')
-rw-r--r--tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
index 6d6bba4fc..e60522bf7 100644
--- a/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
+++ b/tests/Jellyfin.Server.Implementations.Tests/Localization/LocalizationManagerTests.cs
@@ -204,6 +204,25 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
}
[Theory]
+ [InlineData("TV-MA", "DE", 17, 1)] // US-only rating, DE country code
+ [InlineData("PG-13", "FR", 13, 0)] // US-only rating, FR country code
+ [InlineData("R", "JP", 17, 0)] // US-only rating, JP country code
+ public async Task GetRatingScore_FallbackPrioritizesUS_Success(string rating, string countryCode, int expectedScore, int? expectedSubScore)
+ {
+ var localizationManager = Setup(new ServerConfiguration()
+ {
+ MetadataCountryCode = countryCode
+ });
+ await localizationManager.LoadAll();
+
+ var score = localizationManager.GetRatingScore(rating);
+
+ Assert.NotNull(score);
+ Assert.Equal(expectedScore, score.Score);
+ Assert.Equal(expectedSubScore, score.SubScore);
+ }
+
+ [Theory]
[InlineData("Default", "Default")]
[InlineData("HeaderLiveTV", "Live TV")]
public void GetLocalizedString_Valid_Success(string key, string expected)