Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9649


Ignore:
Timestamp:
Aug 14, 2013, 6:42:28 PM (11 years ago)
Author:
landauf
Message:

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

Location:
code/branches/core6
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core6/src/libraries/core/Core.cc

    r9640 r9649  
    248248        safeObjectDelete(&configFileManager_);
    249249        ConsoleCommand::destroyAll();
     250        Context::setRootContext(NULL);
    250251        IdentifierManager::getInstance().destroyAllIdentifiers();
    251252        safeObjectDelete(&signalHandler_);
  • code/branches/core6/src/libraries/core/object/Context.cc

    r9629 r9649  
    3737namespace orxonox
    3838{
     39    Context* Context::rootContext_s = 0;
     40
    3941    Context::Context(Context* context) : Listable(this), parentContext_(context)
    4042    {
     
    5456    }
    5557
     58    /*static*/ void Context::setRootContext(Context* context)
     59    {
     60        if (Context::rootContext_s)
     61            delete Context::rootContext_s;
     62        Context::rootContext_s = context;
     63    }
     64
    5665    /*static*/ Context* Context::getRootContext()
    5766    {
    58         static Context rootContext(NULL);
    59         return &rootContext;
     67        if (!Context::rootContext_s)
     68            Context::rootContext_s = new Context(NULL);
     69        return Context::rootContext_s;
    6070    }
    6171
  • code/branches/core6/src/libraries/core/object/Context.h

    r9629 r9649  
    4646    {
    4747        public:
     48            static void setRootContext(Context* context);
    4849            static Context* getRootContext();
    4950
     
    7273            Context* parentContext_;
    7374            std::vector<ObjectListBase*> objectLists_;
     75
     76            static Context* rootContext_s;
    7477    };
    7578}
  • code/branches/core6/test/core/class/OrxonoxClassTest.cc

    r9601 r9649  
    11#include <gtest/gtest.h>
    22#include "core/class/OrxonoxClass.h"
     3#include "core/object/Context.h"
    34
    45namespace orxonox
     
    910        {
    1011        };
     12
     13        // Fixture
     14        class OrxonoxClassTest : public ::testing::Test
     15        {
     16            public:
     17                virtual void SetUp()
     18                {
     19                    Context::setRootContext(new Context(NULL));
     20                }
     21
     22                virtual void TearDown()
     23                {
     24                    Context::setRootContext(NULL);
     25                }
     26        };
    1127    }
    1228
    13     TEST(OrxonoxClassTest, CanCreate)
     29    TEST_F(OrxonoxClassTest, CanCreate)
    1430    {
    1531        TestClass* test = new TestClass();
  • code/branches/core6/test/core/class/OrxonoxInterfaceTest.cc

    r9601 r9649  
    22#include "core/class/OrxonoxInterface.h"
    33#include "core/class/OrxonoxClass.h"
     4#include "core/object/Context.h"
    45
    56namespace orxonox
     
    2425        {
    2526        };
     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        };
    2642    }
    2743
    28     TEST(OrxonoxInterfaceTest, CanCreate1)
     44    TEST_F(OrxonoxInterfaceTest, CanCreate1)
    2945    {
    3046        TestClass1* test = new TestClass1();
     
    3349    }
    3450
    35     TEST(OrxonoxInterfaceTest, CanCreate2)
     51    TEST_F(OrxonoxInterfaceTest, CanCreate2)
    3652    {
    3753        TestClass2* test = new TestClass2();
  • code/branches/core6/test/core/class/SubclassIdentifierTest.cc

    r9647 r9649  
    3232
    3333                    IdentifierManager::getInstance().createClassHierarchy();
     34
     35                    Context::setRootContext(new Context(NULL));
    3436                }
    3537
    3638                virtual void TearDown()
    3739                {
     40                    Context::setRootContext(NULL);
     41
    3842                    IdentifierManager::getInstance().destroyAllIdentifiers();
    3943                }
  • code/branches/core6/test/core/class/SuperTest.cc

    r9648 r9649  
    6262        };
    6363
    64         // Fixture
     64       // Fixture
    6565        class SuperTest : public ::testing::Test
    6666        {
     
    7676
    7777                    IdentifierManager::getInstance().createClassHierarchy();
     78
     79                    Context::setRootContext(new Context(NULL));
    7880                }
    7981
    8082                virtual void TearDown()
    8183                {
     84                    Context::setRootContext(NULL);
     85
    8286                    IdentifierManager::getInstance().destroyAllIdentifiers();
    8387                }
  • code/branches/core6/test/core/object/ClassFactoryTest.cc

    r9637 r9649  
    22#include "core/object/ClassFactory.h"
    33#include "core/BaseObject.h"
     4#include "core/object/Context.h"
    45
    56namespace orxonox
    67{
    7     TEST(ClassFactoryTest, CanFabricateObject)
     8    namespace
     9    {
     10        // Fixture
     11        class ClassFactoryTest : public ::testing::Test
     12        {
     13            public:
     14                virtual void SetUp()
     15                {
     16                    Context::setRootContext(new Context(NULL));
     17                }
     18
     19                virtual void TearDown()
     20                {
     21                    Context::setRootContext(NULL);
     22                }
     23        };
     24    }
     25
     26    TEST_F(ClassFactoryTest, CanFabricateObject)
    827    {
    928        Factory* factory = new ClassFactoryWithContext<BaseObject>();
  • code/branches/core6/test/core/object/ContextTest.cc

    r9629 r9649  
    1313                SubclassContext() : Context(NULL) { RegisterRootObject(SubclassContext); }
    1414        };
     15
     16        // Fixture
     17        class ContextTest : public ::testing::Test
     18        {
     19            public:
     20                virtual void SetUp()
     21                {
     22                    Context::setRootContext(new Context(NULL));
     23                }
     24
     25                virtual void TearDown()
     26                {
     27                    Context::setRootContext(NULL);
     28                }
     29        };
    1530    }
    1631
    17     TEST(ContextTest, CanCreateContext)
     32    TEST_F(ContextTest, CanCreateContext)
    1833    {
    1934        Context context(NULL);
    2035    }
    2136
    22     TEST(ContextTest, CanCreateSubclassContext)
     37    TEST_F(ContextTest, CanCreateSubclassContext)
    2338    {
    2439        SubclassContext context;
    2540    }
    2641
    27     TEST(ContextTest, ContextIsItsOwnContext)
     42    TEST_F(ContextTest, ContextIsItsOwnContext)
    2843    {
    2944        Context context(NULL);
     
    3146    }
    3247
    33     TEST(ContextTest, SubclassContextIsItsOwnContext)
     48    TEST_F(ContextTest, SubclassContextIsItsOwnContext)
    3449    {
    3550        SubclassContext context;
     
    3752    }
    3853
    39     TEST(ContextTest, SubclassAddsToItsOwnObjectList)
     54    TEST_F(ContextTest, SubclassAddsToItsOwnObjectList)
    4055    {
    4156        SubclassContext context;
  • code/branches/core6/test/core/object/IteratorTest.cc

    r9607 r9649  
    2323                MOCK_METHOD0(test, void());
    2424        };
     25
     26        // Fixture
     27        class IteratorTest : public ::testing::Test
     28        {
     29            public:
     30                virtual void SetUp()
     31                {
     32                    Context::setRootContext(new Context(NULL));
     33                }
     34
     35                virtual void TearDown()
     36                {
     37                    Context::setRootContext(NULL);
     38                }
     39        };
    2540    }
    2641
    27     TEST(IteratorTest, CanCreateIterator)
     42    TEST_F(IteratorTest, CanCreateIterator)
    2843    {
    2944        Iterator<TestInterface> it;
    3045    }
    3146
    32     TEST(IteratorTest, CanAssignIterator)
     47    TEST_F(IteratorTest, CanAssignIterator)
    3348    {
    3449        Iterator<TestInterface> it = ObjectList<TestInterface>::begin();
    3550    }
    3651
    37     TEST(IteratorTest, CanIterateOverEmptyList)
     52    TEST_F(IteratorTest, CanIterateOverEmptyList)
    3853    {
    3954        size_t i = 0;
     
    4358    }
    4459
    45     TEST(IteratorTest, CanCallObjects)
     60    TEST_F(IteratorTest, CanCallObjects)
    4661    {
    4762        TestClass test1;
  • code/branches/core6/test/core/object/ListableTest.cc

    r9627 r9649  
    77    namespace
    88    {
    9         class ListableTest : public Listable
     9        class ListableClassTest : public Listable
    1010        {
    1111            public:
    12                 ListableTest() { RegisterRootObject(ListableTest); }
     12            ListableClassTest() { RegisterRootObject(ListableClassTest); }
    1313        };
    1414
    15         class ListableSubclassTest : public ListableTest
     15        class ListableSubclassTest : public ListableClassTest
    1616        {
    1717            public:
     
    2828            return false;
    2929        }
    30     }
    31 
    32     TEST(ListableTest, CanCreate)
    33     {
    34         ListableTest* test = new ListableTest();
     30
     31        // Fixture
     32        class ListableTest : public ::testing::Test
     33        {
     34            public:
     35                virtual void SetUp()
     36                {
     37                    Context::setRootContext(new Context(NULL));
     38                }
     39
     40                virtual void TearDown()
     41                {
     42                    Context::setRootContext(NULL);
     43                }
     44        };
     45    }
     46
     47    TEST_F(ListableTest, CanCreate)
     48    {
     49        ListableClassTest* test = new ListableClassTest();
    3550        ASSERT_TRUE(test != NULL);
    3651        delete test;
    3752    }
    3853
    39     TEST(ListableTest, AddsToObjectList)
    40     {
    41         ListableTest test;
    42         EXPECT_EQ(1u, ObjectList<ListableTest>::size());
    43         EXPECT_TRUE(objectListContains<ListableTest>(&test));
    44     }
    45 
    46     TEST(ListableTest, AddsToAllObjectLists)
    47     {
    48         ListableSubclassTest test;
    49         EXPECT_EQ(1u, ObjectList<ListableTest>::size());
    50         EXPECT_TRUE(objectListContains<ListableTest>(&test));
     54    TEST_F(ListableTest, AddsToObjectList)
     55    {
     56        ListableClassTest test;
     57        EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
     58        EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
     59    }
     60
     61    TEST_F(ListableTest, AddsToAllObjectLists)
     62    {
     63        ListableSubclassTest test;
     64        EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
     65        EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
    5166        EXPECT_EQ(1u, ObjectList<ListableSubclassTest>::size());
    5267        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test));
    5368    }
    5469
    55     TEST(ListableTest, RemovesFromObjectList)
    56     {
    57         EXPECT_EQ(0u, ObjectList<ListableTest>::size());
    58         {
    59             ListableTest test;
    60             EXPECT_EQ(1u, ObjectList<ListableTest>::size());
    61             EXPECT_TRUE(objectListContains<ListableTest>(&test));
     70    TEST_F(ListableTest, RemovesFromObjectList)
     71    {
     72        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
     73        {
     74            ListableClassTest test;
     75            EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
     76            EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
    6277        }
    63         EXPECT_EQ(0u, ObjectList<ListableTest>::size());
    64     }
    65 
    66     TEST(ListableTest, RemovesFromAllObjectLists)
    67     {
    68         EXPECT_EQ(0u, ObjectList<ListableTest>::size());
     78        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
     79    }
     80
     81    TEST_F(ListableTest, RemovesFromAllObjectLists)
     82    {
     83        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
    6984        EXPECT_EQ(0u, ObjectList<ListableSubclassTest>::size());
    7085        {
    7186            ListableSubclassTest test;
    72             EXPECT_EQ(1u, ObjectList<ListableTest>::size());
    73             EXPECT_TRUE(objectListContains<ListableTest>(&test));
     87            EXPECT_EQ(1u, ObjectList<ListableClassTest>::size());
     88            EXPECT_TRUE(objectListContains<ListableClassTest>(&test));
    7489            EXPECT_EQ(1u, ObjectList<ListableSubclassTest>::size());
    7590            EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test));
    7691        }
    77         EXPECT_EQ(0u, ObjectList<ListableTest>::size());
     92        EXPECT_EQ(0u, ObjectList<ListableClassTest>::size());
    7893        EXPECT_EQ(0u, ObjectList<ListableSubclassTest>::size());
    7994    }
    8095
    81     TEST(ListableTest, CanAddObjectToContext)
     96    TEST_F(ListableTest, CanAddObjectToContext)
    8297    {
    8398        Context context(NULL);
     
    87102
    88103        // object is in new context
    89         EXPECT_EQ(1u, context.getObjectList<ListableTest>()->size());
    90         EXPECT_TRUE(objectListContains<ListableTest>(&test, &context));
     104        EXPECT_EQ(1u, context.getObjectList<ListableClassTest>()->size());
     105        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &context));
    91106        EXPECT_EQ(1u, context.getObjectList<ListableSubclassTest>()->size());
    92107        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &context));
    93108    }
    94109
    95     TEST(ListableTest, CanAddObjectToSubContext)
     110    TEST_F(ListableTest, CanAddObjectToSubContext)
    96111    {
    97112        Context baseContext(NULL);
     
    102117
    103118        // object is in both contexts
    104         EXPECT_EQ(1u, baseContext.getObjectList<ListableTest>()->size());
    105         EXPECT_TRUE(objectListContains<ListableTest>(&test, &baseContext));
     119        EXPECT_EQ(1u, baseContext.getObjectList<ListableClassTest>()->size());
     120        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &baseContext));
    106121        EXPECT_EQ(1u, baseContext.getObjectList<ListableSubclassTest>()->size());
    107122        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &baseContext));
    108123
    109         EXPECT_EQ(1u, subContext.getObjectList<ListableTest>()->size());
    110         EXPECT_TRUE(objectListContains<ListableTest>(&test, &subContext));
     124        EXPECT_EQ(1u, subContext.getObjectList<ListableClassTest>()->size());
     125        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext));
    111126        EXPECT_EQ(1u, subContext.getObjectList<ListableSubclassTest>()->size());
    112127        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext));
    113128    }
    114129
    115     TEST(ListableTest, CanChangeContext)
     130    TEST_F(ListableTest, CanChangeContext)
    116131    {
    117132        Context* rootContext = Context::getRootContext();
     
    120135
    121136        // object is in root context
    122         EXPECT_EQ(1u, rootContext->getObjectList<ListableTest>()->size());
    123         EXPECT_TRUE(objectListContains<ListableTest>(&test, rootContext));
     137        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
     138        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
    124139        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
    125140        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
    126141
    127142        // object is NOT in new context
    128         EXPECT_EQ(0u, newContext.getObjectList<ListableTest>()->size());
    129         EXPECT_FALSE(objectListContains<ListableTest>(&test, &newContext));
     143        EXPECT_EQ(0u, newContext.getObjectList<ListableClassTest>()->size());
     144        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &newContext));
    130145        EXPECT_EQ(0u, newContext.getObjectList<ListableSubclassTest>()->size());
    131146        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &newContext));
     
    134149
    135150        // object was removed from root context
    136         EXPECT_EQ(0u, rootContext->getObjectList<ListableTest>()->size());
    137         EXPECT_FALSE(objectListContains<ListableTest>(&test, rootContext));
     151        EXPECT_EQ(0u, rootContext->getObjectList<ListableClassTest>()->size());
     152        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, rootContext));
    138153        EXPECT_EQ(0u, rootContext->getObjectList<ListableSubclassTest>()->size());
    139154        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, rootContext));
    140155
    141156        // object is now in new context
    142         EXPECT_EQ(1u, newContext.getObjectList<ListableTest>()->size());
    143         EXPECT_TRUE(objectListContains<ListableTest>(&test, &newContext));
     157        EXPECT_EQ(1u, newContext.getObjectList<ListableClassTest>()->size());
     158        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &newContext));
    144159        EXPECT_EQ(1u, newContext.getObjectList<ListableSubclassTest>()->size());
    145160        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &newContext));
    146161    }
    147162
    148     TEST(ListableTest, CanChangeToSubContext)
     163    TEST_F(ListableTest, CanChangeToSubContext)
    149164    {
    150165        Context* rootContext = Context::getRootContext();
     
    153168
    154169        // object is in root context
    155         EXPECT_EQ(1u, rootContext->getObjectList<ListableTest>()->size());
    156         EXPECT_TRUE(objectListContains<ListableTest>(&test, rootContext));
     170        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
     171        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
    157172        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
    158173        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
    159174
    160175        // object is NOT in sub context
    161         EXPECT_EQ(0u, subContext.getObjectList<ListableTest>()->size());
    162         EXPECT_FALSE(objectListContains<ListableTest>(&test, &subContext));
     176        EXPECT_EQ(0u, subContext.getObjectList<ListableClassTest>()->size());
     177        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &subContext));
    163178        EXPECT_EQ(0u, subContext.getObjectList<ListableSubclassTest>()->size());
    164179        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &subContext));
     
    167182
    168183        // object is still in root context
    169         EXPECT_EQ(1u, rootContext->getObjectList<ListableTest>()->size());
    170         EXPECT_TRUE(objectListContains<ListableTest>(&test, rootContext));
     184        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
     185        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
    171186        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
    172187        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
    173188
    174189        // object is now also in sub context
    175         EXPECT_EQ(1u, subContext.getObjectList<ListableTest>()->size());
    176         EXPECT_TRUE(objectListContains<ListableTest>(&test, &subContext));
     190        EXPECT_EQ(1u, subContext.getObjectList<ListableClassTest>()->size());
     191        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext));
    177192        EXPECT_EQ(1u, subContext.getObjectList<ListableSubclassTest>()->size());
    178193        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext));
    179194    }
    180195
    181     TEST(ListableTest, CanChangeFromSubcontextToSubContext)
     196    TEST_F(ListableTest, CanChangeFromSubcontextToSubContext)
    182197    {
    183198        Context* rootContext = Context::getRootContext();
     
    189204
    190205        // object is in root context
    191         EXPECT_EQ(1u, rootContext->getObjectList<ListableTest>()->size());
    192         EXPECT_TRUE(objectListContains<ListableTest>(&test, rootContext));
     206        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
     207        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
    193208        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
    194209        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
    195210
    196211        // object is also in sub context 1
    197         EXPECT_EQ(1u, subContext1.getObjectList<ListableTest>()->size());
    198         EXPECT_TRUE(objectListContains<ListableTest>(&test, &subContext1));
     212        EXPECT_EQ(1u, subContext1.getObjectList<ListableClassTest>()->size());
     213        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext1));
    199214        EXPECT_EQ(1u, subContext1.getObjectList<ListableSubclassTest>()->size());
    200215        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext1));
    201216
    202217        // object is NOT in sub context 2
    203         EXPECT_EQ(0u, subContext2.getObjectList<ListableTest>()->size());
    204         EXPECT_FALSE(objectListContains<ListableTest>(&test, &subContext2));
     218        EXPECT_EQ(0u, subContext2.getObjectList<ListableClassTest>()->size());
     219        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &subContext2));
    205220        EXPECT_EQ(0u, subContext2.getObjectList<ListableSubclassTest>()->size());
    206221        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &subContext2));
     
    209224
    210225        // object is still in root context
    211         EXPECT_EQ(1u, rootContext->getObjectList<ListableTest>()->size());
    212         EXPECT_TRUE(objectListContains<ListableTest>(&test, rootContext));
     226        EXPECT_EQ(1u, rootContext->getObjectList<ListableClassTest>()->size());
     227        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, rootContext));
    213228        EXPECT_EQ(1u, rootContext->getObjectList<ListableSubclassTest>()->size());
    214229        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, rootContext));
    215230
    216231        // object was removed from sub context 1
    217         EXPECT_EQ(0u, subContext1.getObjectList<ListableTest>()->size());
    218         EXPECT_FALSE(objectListContains<ListableTest>(&test, &subContext1));
     232        EXPECT_EQ(0u, subContext1.getObjectList<ListableClassTest>()->size());
     233        EXPECT_FALSE(objectListContains<ListableClassTest>(&test, &subContext1));
    219234        EXPECT_EQ(0u, subContext1.getObjectList<ListableSubclassTest>()->size());
    220235        EXPECT_FALSE(objectListContains<ListableSubclassTest>(&test, &subContext1));
    221236
    222237        // object is now in sub context 2
    223         EXPECT_EQ(1u, subContext2.getObjectList<ListableTest>()->size());
    224         EXPECT_TRUE(objectListContains<ListableTest>(&test, &subContext2));
     238        EXPECT_EQ(1u, subContext2.getObjectList<ListableClassTest>()->size());
     239        EXPECT_TRUE(objectListContains<ListableClassTest>(&test, &subContext2));
    225240        EXPECT_EQ(1u, subContext2.getObjectList<ListableSubclassTest>()->size());
    226241        EXPECT_TRUE(objectListContains<ListableSubclassTest>(&test, &subContext2));
  • code/branches/core6/test/core/object/ObjectListIteratorTest.cc

    r9605 r9649  
    1616                MOCK_METHOD0(test, void());
    1717        };
     18
     19        // Fixture
     20        class ObjectListIteratorTest : public ::testing::Test
     21        {
     22            public:
     23                virtual void SetUp()
     24                {
     25                    Context::setRootContext(new Context(NULL));
     26                }
     27
     28                virtual void TearDown()
     29                {
     30                    Context::setRootContext(NULL);
     31                }
     32        };
    1833    }
    1934
    20     TEST(ObjectListIteratorTest, CanCreateIterator)
     35    TEST_F(ObjectListIteratorTest, CanCreateIterator)
    2136    {
    2237        ObjectListIterator<ListableTest> it;
    2338    }
    2439
    25     TEST(ObjectListIteratorTest, CanAssignIterator)
     40    TEST_F(ObjectListIteratorTest, CanAssignIterator)
    2641    {
    2742        ObjectListIterator<ListableTest> it = ObjectList<ListableTest>::begin();
    2843    }
    2944
    30     TEST(ObjectListIteratorTest, CanIterateOverEmptyList)
     45    TEST_F(ObjectListIteratorTest, CanIterateOverEmptyList)
    3146    {
    3247        size_t i = 0;
     
    3651    }
    3752
    38     TEST(ObjectListIteratorTest, CanIterateOverFullList)
     53    TEST_F(ObjectListIteratorTest, CanIterateOverFullList)
    3954    {
    4055        ListableTest test1;
     
    5368    }
    5469
    55     TEST(ObjectListIteratorTest, CanIterateReverseOverFullList)
     70    TEST_F(ObjectListIteratorTest, CanIterateReverseOverFullList)
    5671    {
    5772        ListableTest test1;
     
    7085    }
    7186
    72     TEST(ObjectListIteratorTest, CanCallObjects)
     87    TEST_F(ObjectListIteratorTest, CanCallObjects)
    7388    {
    7489        ListableTest test1;
Note: See TracChangeset for help on using the changeset viewer.