mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-07 10:33:24 -08:00
Limited deck views (view top/bottom N cards, scry, surveil) made it ambiguous which card was the top or bottom of the library. Label the card itself with a small in-view marker instead of placing text above or below the whole zone, which became ambiguous once the grid used several columns or the window was resized. The marker stays on the part of its card that the column leaves visible: for a top view, the right end of the exposed strip of the first card; for a bottom view, the bottom-left corner of the last, fully visible card. The view logic now answers whether it is a limited library-end view and which edge it shows. The graphics zone draws and positions a marker on the first or last displayed card, and re-translates its tooltip with the rest of the zone view. Co-authored-by: Lukas Brübach <44814898+BruebachL@users.noreply.github.com>
This commit is contained in:
parent
80986266b9
commit
d9cd308a2e
6 changed files with 243 additions and 2 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include <libcockatrice/game/zones/hand_zone_logic.h>
|
||||
#include <libcockatrice/game/zones/view_zone_logic.h>
|
||||
#include <libcockatrice/utility/card_ref.h>
|
||||
#include <libcockatrice/utility/zone_names.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
@ -105,3 +106,30 @@ TEST(CardZoneLogicTest, ReorganizeSignalFiresOnAdd)
|
|||
|
||||
EXPECT_EQ(reorganizeSpy.count(), 1);
|
||||
}
|
||||
|
||||
TEST(CardZoneLogicTest, LibraryEdgeViewIsLimitedToOneEndOfTheLibrary)
|
||||
{
|
||||
HandZoneLogic deck(nullptr, QString::fromLatin1(ZoneNames::DECK), false, true, true);
|
||||
HandZoneLogic grave(nullptr, QString::fromLatin1(ZoneNames::GRAVE), false, true, true);
|
||||
|
||||
ZoneViewZoneLogic fullDeckView(nullptr, &deck, -1, false, false, false);
|
||||
EXPECT_FALSE(fullDeckView.isLibraryEdgeView());
|
||||
EXPECT_FALSE(fullDeckView.showsTopOfLibrary());
|
||||
EXPECT_FALSE(fullDeckView.showsBottomOfLibrary());
|
||||
|
||||
ZoneViewZoneLogic emptyDeckView(nullptr, &deck, 0, false, false, false);
|
||||
EXPECT_FALSE(emptyDeckView.isLibraryEdgeView());
|
||||
|
||||
ZoneViewZoneLogic topView(nullptr, &deck, 3, false, false, false);
|
||||
EXPECT_TRUE(topView.isLibraryEdgeView());
|
||||
EXPECT_TRUE(topView.showsTopOfLibrary());
|
||||
EXPECT_FALSE(topView.showsBottomOfLibrary());
|
||||
|
||||
ZoneViewZoneLogic bottomView(nullptr, &deck, 3, false, false, true);
|
||||
EXPECT_TRUE(bottomView.isLibraryEdgeView());
|
||||
EXPECT_FALSE(bottomView.showsTopOfLibrary());
|
||||
EXPECT_TRUE(bottomView.showsBottomOfLibrary());
|
||||
|
||||
ZoneViewZoneLogic graveView(nullptr, &grave, 3, false, false, false);
|
||||
EXPECT_FALSE(graveView.isLibraryEdgeView());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue