[GUI] Update library page layout (#690)

* [GUI] Add horizontal game tiles

* [GUI] Update launching elements layout

* [GUI] Change cards format to squares
This commit is contained in:
Daniel Freak
2026-07-30 02:47:15 +03:00
committed by GitHub
parent 996de70f52
commit 77f22973cb
23 changed files with 542 additions and 414 deletions
@@ -0,0 +1,52 @@
// Copyright (C) 2026 SharpEmu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
using SharpEmu.GUI;
using System.Collections;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using Xunit;
namespace SharpEmu.Libs.Tests.GUI;
public sealed class LibraryTileCollectionTests
{
[Fact]
public void KeepsAddFolderTileAfterVisibleGames()
{
var games = new ObservableCollection<GameEntry>();
var tiles = new LibraryTileCollection(games);
var first = CreateGame("First");
var second = CreateGame("Second");
games.Add(first);
games.Add(second);
Assert.Equal(3, tiles.Count);
Assert.True(tiles is IList { IsReadOnly: true });
Assert.Same(first, tiles[0]);
Assert.Same(second, tiles[1]);
Assert.Same(AddFolderTile.Instance, tiles[2]);
}
[Fact]
public void ForwardsGameChangesAtTheirOriginalIndices()
{
var games = new ObservableCollection<GameEntry>();
var tiles = new LibraryTileCollection(games);
NotifyCollectionChangedEventArgs? change = null;
tiles.CollectionChanged += (_, args) => change = args;
var game = CreateGame("Game");
games.Add(game);
Assert.NotNull(change);
Assert.Equal(NotifyCollectionChangedAction.Add, change.Action);
Assert.Equal(0, change.NewStartingIndex);
Assert.Same(game, Assert.Single(change.NewItems!.Cast<GameEntry>()));
Assert.Same(AddFolderTile.Instance, tiles[1]);
}
private static GameEntry CreateGame(string name) =>
new(name, null, null, $"/games/{name}/eboot.bin", 0, null, null);
}