feat: show skip offer countdown and transitions
This commit is contained in:
@@ -314,6 +314,41 @@ int main(int argc, char **argv) {
|
||||
require(symlink(existingPath.c_str(), linkPath.c_str()) == 0 && rejected(linkPath), "symlink destination fails initialization");
|
||||
require([[NSData dataWithContentsOfFile:nativePath(existingPath)] isEqual:sentinel], "rejection never changes an existing destination");
|
||||
|
||||
const auto queueFirst = root + "/queue-first.jsonl", queueSecond = root + "/queue-second.jsonl";
|
||||
{
|
||||
playback::ProgressReports reports;
|
||||
reports.registerFile(firstURL, queueFirst);
|
||||
reports.registerFile(secondURL, queueSecond);
|
||||
reports.begin(firstURL);
|
||||
reports.observe(sample(PLAYER_PAUSED, 12));
|
||||
reports.begin(secondURL);
|
||||
reports.observe(sample(PLAYER_ENDED, 100));
|
||||
reports.begin(firstURL);
|
||||
reports.observe(sample(PLAYER_PAUSED, 24));
|
||||
reports.begin("miruro:unregistered:1");
|
||||
reports.observe(sample(PLAYER_PAUSED, 55));
|
||||
reports.finish();
|
||||
require(reports.error().empty(), "queue reports can revisit their owned session without reopening arbitrary files");
|
||||
}
|
||||
auto firstRows = records(queueFirst), secondRows = records(queueSecond);
|
||||
require(firstRows.count == 4 && secondRows.count == 2, "queue switches drain old reports and revisits append");
|
||||
expect(firstRows[0], @"progress", firstURL, 12, true);
|
||||
expect(firstRows[2], @"progress", firstURL, 24, true);
|
||||
expect(secondRows[0], @"ended", secondURL, 100, true);
|
||||
const auto replacedPath = root + "/replaced.jsonl";
|
||||
{
|
||||
ProgressReporter reporter(replacedPath, [] { return 100.; });
|
||||
reporter.begin(firstURL);
|
||||
reporter.observe(sample(PLAYER_PAUSED, 1));
|
||||
reporter.finish();
|
||||
require(rename(replacedPath.c_str(), (replacedPath + ".original").c_str()) == 0, "retain original inode while replacing path");
|
||||
require([sentinel writeToFile:nativePath(replacedPath) atomically:NO], "replace report with unrelated sentinel");
|
||||
bool refused = false;
|
||||
try { reporter.resume(); } catch (...) { refused = true; }
|
||||
require(refused && [[NSData dataWithContentsOfFile:nativePath(replacedPath)] isEqual:sentinel],
|
||||
"revisiting never appends to a replaced report inode");
|
||||
}
|
||||
|
||||
const auto concurrentPath = root + "/concurrent.jsonl";
|
||||
std::atomic<int> ready{0}, successes{0}, failures{0};
|
||||
std::atomic<bool> start{false};
|
||||
|
||||
Reference in New Issue
Block a user