ZaStoGram_desktop/Telegram/SourceFiles/test/test_launch_fuse.cpp
John Preston 4911100c2d [ai] Fuse real launches and assert document opens
Task: 2026/07/28/assert-open-hand-off-and-fuse-real-launches
2026-07-29 13:01:53 +04:00

49 lines
1.2 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "test/test_launch_fuse.h"
#include "test/test_agent.h"
#include "test/test_log.h"
namespace Test {
namespace {
[[nodiscard]] std::vector<BlockedLaunch> &Blocked() {
static auto result = std::vector<BlockedLaunch>();
return result;
}
} // namespace
bool BlockLaunch(const QString &function, const QString &argument) {
if (!Active()) {
return false;
}
Blocked().push_back({ function, argument });
Fire(u"launch_blocked"_q);
Fail(u"blocked launch: Platform::File::%1"_q.arg(function), argument);
return true;
}
const std::vector<BlockedLaunch> &BlockedLaunches() {
return Blocked();
}
void CheckNoBlockedLaunches(const QString &what) {
if (Blocked().empty()) {
Pass(what);
return;
}
auto details = QStringList();
for (const auto &entry : Blocked()) {
details.push_back(entry.function + u": "_q + entry.argument);
}
Note(u"%1: already failed - %2"_q.arg(what, details.join(u"; "_q)));
}
} // namespace Test