Compile fix for unit test cases where no windowwrapper is needed

This commit is contained in:
Alexander Bock
2015-10-27 15:03:46 -05:00
parent 327e2560be
commit 1149a0d380
5 changed files with 158 additions and 2 deletions

View File

@@ -0,0 +1,64 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* 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. *
****************************************************************************************/
#ifndef __DUMMYWINDOWWRAPPER_H__
#define __DUMMYWINDOWWRAPPER_H__
#include <openspace/engine/wrapper/windowwrapper.h>
namespace openspace {
class DummyWindowWrapper : public WindowWrapper {
public:
void setBarrier(bool enabled) override;
void clearAllWindows() override;
bool windowHasResized() const override;
double time() const override;
double averageDeltaTime() const override;
uint32_t mouseButtons(int maxNumber = 8) const override;
glm::vec2 mousePosition() const override;
glm::ivec2 currentWindowSize() const override;
glm::ivec2 currentWindowResolution() const override;
bool isRegularRendering() const override;
glm::mat4 viewProjectionMatrix() const override;
void setNearFarClippingPlane(float near, float far) override;
glm::ivec4 viewportPixelCoordinates() const override;
bool isExternalControlConnected() const override;
void sendMessageToExternalControl(const std::vector<char>& message) const override;
// true for single viewport, single window; false otherwise
bool isSimpleRendering() const override;
void takeScreenshot() const override;
//virtual void forEachWindow(std::function<void (void)> function) = 0;
};
} // namespace openspace
#endif // __DUMMYWINDOWWRAPPER_H__

View File

@@ -29,6 +29,7 @@
#include <cstdint>
#include <functional>
#include <vector>
namespace openspace {

View File

@@ -34,6 +34,7 @@ set(OPENSPACE_SOURCE
${OPENSPACE_BASE_DIR}/src/engine/logfactory.cpp
${OPENSPACE_BASE_DIR}/src/engine/moduleengine.cpp
${OPENSPACE_BASE_DIR}/src/engine/openspaceengine.cpp
${OPENSPACE_BASE_DIR}/src/engine/wrapper/dummywindowwrapper.cpp
${OPENSPACE_BASE_DIR}/src/engine/wrapper/sgctwindowwrapper.cpp
${OPENSPACE_BASE_DIR}/src/interaction/controller.cpp
${OPENSPACE_BASE_DIR}/src/interaction/deviceidentifier.cpp
@@ -99,6 +100,7 @@ set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/engine/logfactory.h
${OPENSPACE_BASE_DIR}/include/openspace/engine/moduleengine.h
${OPENSPACE_BASE_DIR}/include/openspace/engine/openspaceengine.h
${OPENSPACE_BASE_DIR}/include/openspace/engine/wrapper/dummywindowwrapper.h
${OPENSPACE_BASE_DIR}/include/openspace/engine/wrapper/sgctwindowwrapper.h
${OPENSPACE_BASE_DIR}/include/openspace/engine/wrapper/windowwrapper.h
${OPENSPACE_BASE_DIR}/include/openspace/interaction/controller.h

View File

@@ -0,0 +1,89 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2015 *
* *
* 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 <openspace/engine/wrapper/dummywindowwrapper.h>
namespace openspace {
void DummyWindowWrapper::setBarrier(bool enabled) {}
void DummyWindowWrapper::clearAllWindows() {}
bool DummyWindowWrapper::windowHasResized() const {
return false;
}
double DummyWindowWrapper::time() const {
return 0.0;
}
double DummyWindowWrapper::averageDeltaTime() const {
return 0.0;
}
glm::vec2 DummyWindowWrapper::mousePosition() const {
return glm::vec2(0.f);
}
uint32_t DummyWindowWrapper::mouseButtons(int maxNumber) const {
return 0;
}
glm::ivec2 DummyWindowWrapper::currentWindowSize() const {
return glm::ivec2(0);
}
glm::ivec2 DummyWindowWrapper::currentWindowResolution() const {
return glm::ivec2(0);
}
bool DummyWindowWrapper::isRegularRendering() const {
return true;
}
glm::mat4 DummyWindowWrapper::viewProjectionMatrix() const {
return glm::mat4(1.f);
}
void DummyWindowWrapper::setNearFarClippingPlane(float near, float far) {}
glm::ivec4 DummyWindowWrapper::viewportPixelCoordinates() const {
return glm::ivec4(0);
}
bool DummyWindowWrapper::isExternalControlConnected() const {
return false;
}
void DummyWindowWrapper::sendMessageToExternalControl(const std::vector<char>& message) const {
}
bool DummyWindowWrapper::isSimpleRendering() const {
return true;
}
void DummyWindowWrapper::takeScreenshot() const {}
} // namespace openspace

View File

@@ -36,7 +36,7 @@
//#include <test_luaconversions.inl>
//#include <test_powerscalecoordinates.inl>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/window.h>
#include <openspace/engine/wrapper/dummywindowwrapper.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/util/constants.h>
#include <openspace/util/factorymanager.h>
@@ -54,7 +54,7 @@ namespace {
int main(int argc, char** argv) {
std::vector<std::string> args;
openspace::OpenSpaceEngine::create(argc, argv, new openspace::Window, args);
openspace::OpenSpaceEngine::create(argc, argv, new openspace::DummyWindowWrapper, args);
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();