diff options
| author | Cody Robibero <cody@robibe.ro> | 2026-06-27 09:52:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-27 09:52:51 -0400 |
| commit | cbef19c313ba0f05f13e176ced6349122c4a7d88 (patch) | |
| tree | 6ebcae8bcd6ae765b9f6095ca20c5763c08f7541 /tests | |
| parent | fc13a7ca7d4fbd2753f10e201e42bd1eb1dabf66 (diff) | |
| parent | 1ea525a4083dbdc929605eb0eb5c6add93bc8392 (diff) | |
Merge pull request #16914 from danieltutuianu/fix/livetv-channel-icon-refresh
Live TV: re-fetch channel icons on guide refresh
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Jellyfin.LiveTv.Tests/LiveTvChannelImageHelperTests.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/Jellyfin.LiveTv.Tests/LiveTvChannelImageHelperTests.cs b/tests/Jellyfin.LiveTv.Tests/LiveTvChannelImageHelperTests.cs new file mode 100644 index 0000000000..f44cb88834 --- /dev/null +++ b/tests/Jellyfin.LiveTv.Tests/LiveTvChannelImageHelperTests.cs @@ -0,0 +1,51 @@ +using Jellyfin.LiveTv; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.LiveTv; +using MediaBrowser.Model.Entities; +using Xunit; + +namespace Jellyfin.LiveTv.Tests; + +public class LiveTvChannelImageHelperTests +{ + [Fact] + public void UpdateChannelImageIfNeeded_NoSource_DoesNotUpdate() + { + var channel = new LiveTvChannel { Name = "Test Channel" }; + + var updated = LiveTvChannelImageHelper.UpdateChannelImageIfNeeded(channel, null, null); + + Assert.False(updated); + Assert.False(channel.HasImage(ImageType.Primary)); + } + + [Fact] + public void UpdateChannelImageIfNeeded_WithUrl_AppliesUrl() + { + var channel = new LiveTvChannel { Name = "Test Channel" }; + + var updated = LiveTvChannelImageHelper.UpdateChannelImageIfNeeded( + channel, + null, + "https://example.com/icon.png"); + + Assert.True(updated); + Assert.True(channel.HasImage(ImageType.Primary)); + Assert.Equal("https://example.com/icon.png", channel.GetImagePath(ImageType.Primary)); + } + + [Fact] + public void UpdateChannelImageIfNeeded_SameUrl_StillUpdates() + { + var channel = new LiveTvChannel { Name = "Test Channel" }; + LiveTvChannelImageHelper.UpdateChannelImageIfNeeded(channel, null, "https://example.com/icon.png"); + + var updated = LiveTvChannelImageHelper.UpdateChannelImageIfNeeded( + channel, + null, + "https://example.com/icon.png"); + + Assert.True(updated); + Assert.Equal("https://example.com/icon.png", channel.GetImagePath(ImageType.Primary)); + } +} |
