Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
life-cycle-test.cpp
Go to the documentation of this file.
1/*
2 LifeCycle(Test) - checking the lifecycle callback hooks provided by AppState
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
20#include "lib/test/run.hpp"
21#include "lib/util.hpp"
22
23#include "include/lifecycle.h"
24
25
26
27
28namespace lumiera{
29namespace test {
30
33
34 void basicInitHook () { ++basicInit; }
36
37 CStr MY_DEADLY_EVENT = "dial M for murder";
38
39
40 namespace // register them to be invoked by lifecycle event id
41 {
44 }
45
46
51 class LifeCycle_test : public Test
52 {
53 virtual void
54 run (Arg)
55 {
56 CHECK (basicInit, "the basic-init callback hasn't been invoked automatically");
57 CHECK (1 == basicInit, "the basic-init callback has been invoked more than once");
58
59 CHECK (!customCallback);
61 CHECK ( 1 == customCallback);
62 }
63 };
64
65
66
67 LAUNCHER (LifeCycle_test, "function common");
68
69
70
71}} // namespace util::test
72
define and register a callback for a specific lifecycle event.
Definition lifecycle.h:69
static void trigger(Symbol eventLabel)
trigger lifecycle callbacks registered under the given label
Definition lifecycle.cpp:72
const char * CStr
Definition error.hpp:42
unsigned int uint
Definition integral.hpp:29
Installing and invoking of application lifecycle event callbacks.
LifecycleHook _schedule2(MY_DEADLY_EVENT, &myCallback)
LifecycleHook _schedule1(ON_BASIC_INIT, &basicInitHook)
uint basicInit(0)
uint customCallback(0)
Lumiera public interface.
Definition advice.hpp:102
CStr ON_BASIC_INIT
automatic static init. treated specially to run as soon as possible
Test runner and basic definitions for tests.
Simplistic test class runner.
#define LAUNCHER(_TEST_CLASS_, _GROUPS_)
Definition run.hpp:116
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...