fix(overview): mining addresses visible at 0 balance; drag-reorder always applies
- Address list: a mining-flagged address stays visible even at 0 balance when "hide zero balances" is on (payout addresses shouldn't vanish). - Drag-reorder: persist dense sort orders (0..N-1) for the whole visible list on drop via App::reorderAddresses, instead of a pairwise swap that no-ops when both rows are still at the default un-ordered state. First drag now always takes effect, and explicit order keeps overriding the starred/type/balance sort. - Tests: 0-balance mining row survives hide-zero; ordered non-favorite outranks a favorite. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2491,6 +2491,27 @@ void testBalanceAddressListModel()
|
||||
EXPECT_EQ(rows.size(), static_cast<size_t>(1));
|
||||
EXPECT_EQ(rows[0].info->address, std::string("zs-high"));
|
||||
|
||||
// Mining-flagged addresses stay visible at 0 balance even with hide-zero on.
|
||||
dragonx::AddressInfo tMine;
|
||||
tMine.address = "R-miner"; tMine.label = "Payout"; tMine.balance = 0.0; tMine.type = "transparent";
|
||||
std::vector<dragonx::ui::AddressListInput> mineInputs = {
|
||||
{&addresses[0], true, false, false, false, "Vault", "", -1}, // funded
|
||||
{&tMine, false, false, false, /*mining=*/true, "Payout", "", -1}, // 0-balance mining
|
||||
};
|
||||
auto mineRows = dragonx::ui::BuildAddressListRows(mineInputs, "", /*hideZero=*/true, false);
|
||||
EXPECT_EQ(mineRows.size(), static_cast<size_t>(2));
|
||||
bool sawMiner = false;
|
||||
for (const auto& r : mineRows) if (r.info->address == std::string("R-miner")) sawMiner = true;
|
||||
EXPECT_TRUE(sawMiner);
|
||||
|
||||
// Explicit sort order overrides starred: a non-favorite ordered row outranks a favorite.
|
||||
std::vector<dragonx::ui::AddressListInput> ordInputs = {
|
||||
{&addresses[0], true, false, false, false, "Vault", "", 0}, // ordered (0)
|
||||
{&addresses[2], false, false, true, false, "Favorite", "", -1}, // favorite, unordered
|
||||
};
|
||||
auto ordRows = dragonx::ui::BuildAddressListRows(ordInputs, "", false, false);
|
||||
EXPECT_EQ(ordRows[0].info->address, std::string("zs-high"));
|
||||
|
||||
auto layout = dragonx::ui::ComputeAddressRowLayout(10.0f, 20.0f, 300.0f, 50.0f,
|
||||
12.0f, 16.0f, 6.0f, 4.0f, 2.0f);
|
||||
EXPECT_NEAR(layout.contentStartX, 22.0, 0.0001);
|
||||
|
||||
Reference in New Issue
Block a user