diff options
| author | Shadowghost <Shadowghost@users.noreply.github.com> | 2026-09-15 11:13:48 -0400 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2026-09-15 11:13:48 -0400 |
| commit | 8150ee2484dabed61718ef43d5c98cdd2c0fa01c (patch) | |
| tree | cb81b848e8931122d4771de780746be51a0e1d94 /tests/Jellyfin.Controller.Tests | |
| parent | 7baca5f2b891cbc92e48145e633e1417d9bf2de3 (diff) | |
Backport pull request #17842 from jellyfin/release-12.z
Fix versions of a video still listing separately from their group and preserve manual merges
Original-merge: cabec7ec28df671e3bb1c360c32db60b085f4084
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Cody Robibero <cody@robibe.ro>
Diffstat (limited to 'tests/Jellyfin.Controller.Tests')
| -rw-r--r-- | tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs b/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs index 86bac4256a..f9b29e576b 100644 --- a/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs +++ b/tests/Jellyfin.Controller.Tests/Entities/BaseItemTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Reflection; @@ -29,6 +30,23 @@ namespace Jellyfin.Controller.Tests.Entities; public class BaseItemTests { [Fact] + public void SetPrimaryVersionId_Null_RestoresTheItemsOwnPresentationKey() + { + var primaryId = Guid.NewGuid(); + var video = new Video { Id = Guid.NewGuid(), Path = "/Movies/Movie/Movie - 4K.mkv" }; + + // While it is a version, it presents as the primary so lists collapse the two together. + video.SetPrimaryVersionId(primaryId); + Assert.Equal(primaryId.ToString("N", CultureInfo.InvariantCulture), video.PresentationUniqueKey); + + // Promoting it back has to restore its own key, or it keeps collapsing onto - and staying + // hidden behind - a primary it no longer belongs to. + video.SetPrimaryVersionId(null); + Assert.Null(video.PrimaryVersionId); + Assert.Equal(video.Id.ToString("N", CultureInfo.InvariantCulture), video.PresentationUniqueKey); + } + + [Fact] public void GetItemByNameFolderName_ShortName_IsKeptAsIs() { SetupPassThroughFileSystem(); |
