mirror of
https://github.com/hyprwm/hyprutils.git
synced 2024-12-22 16:39:48 +01:00
28 lines
No EOL
507 B
C++
28 lines
No EOL
507 B
C++
#include <hyprutils/signal/Signal.hpp>
|
|
#include <hyprutils/memory/WeakPtr.hpp>
|
|
#include "shared.hpp"
|
|
|
|
using namespace Hyprutils::Signal;
|
|
using namespace Hyprutils::Memory;
|
|
|
|
int main(int argc, char** argv, char** envp) {
|
|
int ret = 0;
|
|
|
|
CSignal signal;
|
|
int data = 0;
|
|
auto listener = signal.registerListener([&](std::any d) { data = 1; });
|
|
|
|
signal.emit();
|
|
|
|
EXPECT(data, 1);
|
|
|
|
data = 0;
|
|
|
|
listener.reset();
|
|
|
|
signal.emit();
|
|
|
|
EXPECT(data, 0);
|
|
|
|
return ret;
|
|
} |