Make the background FX drain visible: a busy cursor over the panel and a footer readout that names its direction, driven off fxReclaimActivity
This commit is contained in:
@@ -12,10 +12,13 @@
|
||||
// * countWidth <= 0 hides the count label and the Tail sits right after the toggle.
|
||||
// * Hit-test: Toggle / Tail returned for in-bounds points, None outside AND on the count
|
||||
// label (a passive readout, never a control); half-open bounds; suppressed box claims none.
|
||||
// * Readout: the count and its pluralization at Idle, each drain direction's pre-emption
|
||||
// of it, the two directions reading differently, and both strings fitting the box.
|
||||
|
||||
#include "../src/core/ui/footer_bar.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
using namespace reasampler;
|
||||
using namespace reasampler::ui;
|
||||
@@ -259,6 +262,49 @@ static void testActiveSegmentStaysLiveEvenWhenUnroutable() {
|
||||
CHECK(modeSegmentEnabled(/*isActiveSegment=*/true, /*transportRunning=*/false, /*routable=*/false));
|
||||
}
|
||||
|
||||
// --- The readout: count, and the drain's pre-emption of it -------------------
|
||||
|
||||
static void testIdleReadsTheCountAndNeitherDrainString() {
|
||||
// Idle is the whole no-work-moving family — an empty queue, an item inside its park
|
||||
// debounce, one held by the transport, one held by an open undo block. The readout
|
||||
// cannot tell them apart and must show the count in every one of them.
|
||||
CHECK(footerReadout(FxDrainState::Idle, 0) == "0 tracks");
|
||||
CHECK(footerReadout(FxDrainState::Idle, 1) == "1 track");
|
||||
CHECK(footerReadout(FxDrainState::Idle, 2) == "2 tracks");
|
||||
CHECK(footerReadout(FxDrainState::Idle, 4) != kFxParkingReadout);
|
||||
CHECK(footerReadout(FxDrainState::Idle, 4) != kFxRestoringReadout);
|
||||
}
|
||||
|
||||
static void testEachDirectionPreEmptsTheCount() {
|
||||
// The drain wins the slot at every count, including the singular that would otherwise
|
||||
// read differently — a caller cannot land on the count text while one is moving.
|
||||
CHECK(footerReadout(FxDrainState::Online, 0) == kFxRestoringReadout);
|
||||
CHECK(footerReadout(FxDrainState::Online, 1) == kFxRestoringReadout);
|
||||
CHECK(footerReadout(FxDrainState::Offline, 1) == kFxParkingReadout);
|
||||
CHECK(footerReadout(FxDrainState::Offline, 7) == kFxParkingReadout);
|
||||
// Independent of what the constants happen to say: neither direction may render the
|
||||
// idle box, or the indicator would be invisible however they are later reworded.
|
||||
CHECK(footerReadout(FxDrainState::Online, 1) != footerReadout(FxDrainState::Idle, 1));
|
||||
CHECK(footerReadout(FxDrainState::Offline, 4) != footerReadout(FxDrainState::Idle, 4));
|
||||
}
|
||||
|
||||
static void testTheTwoDirectionsReadDifferently() {
|
||||
// Restoring the entering mode's chains and parking the leaving mode's are different
|
||||
// acts; one shared word for both would misname whichever it was not written for.
|
||||
CHECK(footerReadout(FxDrainState::Online, 3) != footerReadout(FxDrainState::Offline, 3));
|
||||
}
|
||||
|
||||
static void testDrainReadoutsFitTheCountBox() {
|
||||
// They borrow the count box, so neither may be long enough to make the kit's
|
||||
// end-ellipsis the normal case. Twelve glyphs is the default 64px box's rough capacity
|
||||
// at the panel's smallest font; a longer string wants a wider box, not a silent
|
||||
// truncation.
|
||||
CHECK(std::string(kFxParkingReadout).size() <= 12);
|
||||
CHECK(std::string(kFxRestoringReadout).size() <= 12);
|
||||
CHECK(!std::string(kFxParkingReadout).empty());
|
||||
CHECK(!std::string(kFxRestoringReadout).empty());
|
||||
}
|
||||
|
||||
int main() {
|
||||
testWideFooterAllPlaced();
|
||||
testOffsetFooterAnchorsLeft();
|
||||
@@ -277,6 +323,10 @@ int main() {
|
||||
testActiveSegmentStaysLiveWhileTheTransportRuns();
|
||||
testInactiveSegmentGoesDeadWhenUnroutable();
|
||||
testActiveSegmentStaysLiveEvenWhenUnroutable();
|
||||
testIdleReadsTheCountAndNeitherDrainString();
|
||||
testEachDirectionPreEmptsTheCount();
|
||||
testTheTwoDirectionsReadDifferently();
|
||||
testDrainReadoutsFitTheCountBox();
|
||||
|
||||
if (g_fail == 0) std::printf("footer_bar: all tests passed\n");
|
||||
else std::printf("footer_bar: %d CHECK(s) FAILED\n", g_fail);
|
||||
|
||||
Reference in New Issue
Block a user