two test cases for iswamanager

This commit is contained in:
Michael Nilsson
2016-03-31 16:45:32 -04:00
parent 3967e513d2
commit df1f79bc62
4 changed files with 89 additions and 30 deletions
+1
View File
@@ -37,6 +37,7 @@
//#include <test_luaconversions.inl>
//#include <test_powerscalecoordinates.inl>
#include <test_screenspaceimage.inl>
#include <test_iswamanager.inl>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
+82
View File
@@ -0,0 +1,82 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2016 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "gtest/gtest.h"
#define private public
#include <modules/iswa/util/iswamanager.h>
#define private private
#include <openspace/util/time.h>
/*
* For each test the following is run:
* Constructor() -> setUp() -> test -> tearDown() -> Deconstructor()
*/
namespace openspace {
class ISWAManagerTest : public testing::Test{
protected:
ISWAManagerTest()
{
ISWAManager::initialize();
}
~ISWAManagerTest(){
ISWAManager::deinitialize();
}
void reset() {}
//std::shared_ptr<ISWAManager> iSWAManager;
};
TEST_F(ISWAManagerTest, initialize){
ISWAManager::deinitialize();
ASSERT_TRUE(!ISWAManager::isInitialized()) << "iSWAManager is initialized before initialize call";
ISWAManager::initialize();
ASSERT_TRUE(ISWAManager::isInitialized()) << "iSWAManager is not initialized after initialize call";
ASSERT_NE(&ISWAManager::ref(), nullptr) << "iSWAManager ref() is not a nullptr";
EXPECT_EQ(&ISWAManager::ref(), &ISWAManager::ref()) << "iSWAManager ref() returns the same object twice";
}
TEST_F(ISWAManagerTest, iSWAurl){
OsEng.loadSpiceKernels();
Time::ref().setTime(double(100000.0));
Time::ref().preSynchronization();
Time::ref().postSynchronizationPreDraw();
std::string url = ISWAManager::ref().iSWAurl(7);
std::string expectedUrl = "http://iswa2.ccmc.gsfc.nasa.gov/IswaSystemWebApp/iSWACygnetStreamer?timestamp=2000-01-02%2015:45:35&window=-1&cygnetId=7";
EXPECT_EQ(expectedUrl, url);
}
}//namespace openspace
+6 -4
View File
@@ -21,12 +21,13 @@
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#define private public
#include "gtest/gtest.h"
// make private variables public, only for testing!!
//Make private variables public for testing
#define private public
#include <modules/base/rendering/screenspaceimage.h>
#define private private
/*
* For each test the following is run:
* Constructor() -> setUp() -> test -> tearDown() -> Deconstructor()
@@ -57,6 +58,7 @@ protected:
TEST_F(ScreenSpaceRenderableTest, initialize){
bool isReady = _ssr.isReady();
_ssr._texturePath;
ASSERT_TRUE(!isReady) << "ScreenSpaceImage is ready before initialize";
// cannot test initialize, crashes at createplane becasue of opengl functions. needs mocking