Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/storymodeHS14/test/core/class/OrxonoxInterfaceTest.cc @ 10100

Last change on this file since 10100 was 9649, checked in by landauf, 11 years ago

added ability to set the root-context explicitly (and also to destroy it before the class-hierarchy is destroyed).
currently it's not possible to set the root context explicitly during startup of the game because it is already used by static initialization

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1#include <gtest/gtest.h>
2#include "core/class/OrxonoxInterface.h"
3#include "core/class/OrxonoxClass.h"
4#include "core/object/Context.h"
5
6namespace orxonox
7{
8    namespace
9    {
10        class Interface1 : virtual public OrxonoxInterface
11        {
12        };
13        class Interface2 : virtual public OrxonoxInterface
14        {
15        };
16        class Interface3 : virtual public OrxonoxInterface
17        {
18        };
19
20        class TestClass1 : public Interface1, public Interface2, public Interface3
21        {
22        };
23
24        class TestClass2 : public OrxonoxClass, public Interface1, public Interface2, public Interface3
25        {
26        };
27
28        // Fixture
29        class OrxonoxInterfaceTest : public ::testing::Test
30        {
31            public:
32                virtual void SetUp()
33                {
34                    Context::setRootContext(new Context(NULL));
35                }
36
37                virtual void TearDown()
38                {
39                    Context::setRootContext(NULL);
40                }
41        };
42    }
43
44    TEST_F(OrxonoxInterfaceTest, CanCreate1)
45    {
46        TestClass1* test = new TestClass1();
47        ASSERT_TRUE(test != NULL);
48        delete test;
49    }
50
51    TEST_F(OrxonoxInterfaceTest, CanCreate2)
52    {
53        TestClass2* test = new TestClass2();
54        ASSERT_TRUE(test != NULL);
55        delete test;
56    }
57}
Note: See TracBrowser for help on using the repository browser.