Преглед на файлове

Update windowManagerTest.cpp

test to see if segfault triggers at this point in testing
marauder2k7 преди 2 години
родител
ревизия
0636ba5765
променени са 1 файла, в които са добавени 9 реда и са изтрити 10 реда
  1. 9 10
      Engine/source/testing/windowManagerTest.cpp

+ 9 - 10
Engine/source/testing/windowManagerTest.cpp

@@ -42,24 +42,29 @@ protected:
 
       // for tests in this class we probably only need the init_video an nothing else.
       SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_EVENTS | SDL_INIT_NOPARACHUTE);
+
+      pwm = static_cast<PlatformWindowManagerSDL*>(CreatePlatformWindowManager());
    }
 
    void SetUp() override
    {
    }
+
+   PlatformWindowManagerSDL* pwm;
+
+   void TearDown() override
+   {
+      delete pwm;
+   }
 };
 
 TEST_F(PlatformWindowManagerSDLTest, Constructor)
 {
-   PlatformWindowManagerSDL* pwm = static_cast<PlatformWindowManagerSDL*>(CreatePlatformWindowManager());
-
    ASSERT_TRUE(pwm) << "no monitor to test against!";
 }
 
 TEST_F(PlatformWindowManagerSDLTest, PrimaryRectTest)
 {
-   PlatformWindowManagerSDL* pwm = static_cast<PlatformWindowManagerSDL*>(CreatePlatformWindowManager());
-
    // Check out the primary desktop area...
    RectI primary = pwm->getPrimaryDesktopArea();
 
@@ -69,8 +74,6 @@ TEST_F(PlatformWindowManagerSDLTest, PrimaryRectTest)
 
 TEST_F(PlatformWindowManagerSDLTest, MonitorRectsValid)
 {
-   PlatformWindowManagerSDL* pwm = static_cast<PlatformWindowManagerSDL*>(CreatePlatformWindowManager());
-
    // Now try to get info about all the monitors.
    Vector<RectI> monitorRects;
    pwm->getMonitorRegions(monitorRects);
@@ -85,8 +88,6 @@ TEST_F(PlatformWindowManagerSDLTest, MonitorRectsValid)
 
 TEST_F(PlatformWindowManagerSDLTest, MonitorRectsAtLeastOne)
 {
-   PlatformWindowManagerSDL* pwm = static_cast<PlatformWindowManagerSDL*>(CreatePlatformWindowManager());
-
    // Now try to get info about all the monitors.
    Vector<RectI> monitorRects;
    pwm->getMonitorRegions(monitorRects);
@@ -97,8 +98,6 @@ TEST_F(PlatformWindowManagerSDLTest, MonitorRectsAtLeastOne)
 
 TEST_F(PlatformWindowManagerSDLTest, MonitorRectsOverflow)
 {
-   PlatformWindowManagerSDL* pwm = static_cast<PlatformWindowManagerSDL*>(CreatePlatformWindowManager());
-
    // Now try to get info about all the monitors.
    Vector<RectI> monitorRects;
    pwm->getMonitorRegions(monitorRects);