chore: initial commit

This commit is contained in:
fallenoak 2023-01-02 13:17:18 -06:00
commit 70b00c5c38
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
965 changed files with 264882 additions and 0 deletions

45
test/CMakeLists.txt Normal file
View file

@ -0,0 +1,45 @@
if(WHOA_SYSTEM_MAC)
file(GLOB PRIVATE_SOURCES "Test.cpp" "stub/Mac.mm" "gx/*.cpp" "util/*.cpp")
set_source_files_properties(${PRIVATE_SOURCES}
PROPERTIES COMPILE_FLAGS "-x objective-c++"
)
add_executable(WhoaTest ${PRIVATE_SOURCES})
target_link_libraries(WhoaTest
PRIVATE
client
event
gx
util
"-framework AppKit"
"-framework Carbon"
"-framework IOKit"
)
endif()
if(WHOA_SYSTEM_LINUX)
file(GLOB PRIVATE_SOURCES "Test.cpp" "gx/*.cpp" "util/*.cpp")
add_executable(WhoaTest ${PRIVATE_SOURCES})
target_link_libraries(WhoaTest
PRIVATE
client
event
gx
util
)
endif()
target_include_directories(WhoaTest
PRIVATE
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/vendor/catch2-2.13.10
)
# Windows executables yet to be done
if(WHOA_SYSTEM_MAC OR WHOA_SYSTEM_LINUX)
install(TARGETS WhoaTest DESTINATION "bin")
endif()

2
test/Test.cpp Normal file
View file

@ -0,0 +1,2 @@
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

24
test/gx/CCamera.cpp Normal file
View file

@ -0,0 +1,24 @@
#include "catch.hpp"
#include "gx/CCamera.hpp"
TEST_CASE("CAngle::ClampTo2Pi", "[gx]") {
SECTION("does not modify given angle 0.0f") {
float angle = 0.0f;
REQUIRE(CAngle::ClampTo2Pi(angle) == angle);
}
SECTION("does not modify given angle 1.570796371f") {
float angle = 1.570796371f;
REQUIRE(CAngle::ClampTo2Pi(angle) == angle);
}
SECTION("does not modify given angle 2.094395161f") {
float angle = 2.094395161f;
REQUIRE(CAngle::ClampTo2Pi(angle) == angle);
}
SECTION("does not modify given angle 6.283185482f") {
float angle = 6.283185482f;
REQUIRE(CAngle::ClampTo2Pi(angle) == angle);
}
}

85
test/stub/Mac.mm Normal file
View file

@ -0,0 +1,85 @@
#include "gx/gll/GLLayerView.h"
#include "app/mac/MacClient.h"
#include "app/mac/View.h"
void AssignEngineViewCallbacks(GLWindowCallbacks* callbacks) {
}
Class GetEngineViewClass() {
return nullptr;
}
double MacClient::GetMouseSpeed() {
return 0.0;
}
void MacClient::SetMouseCoalescingEnabled(bool enabled) {
}
@implementation GLLayerView
- (BOOL)acceptsFirstResponder {
return YES;
}
- (GLWindowCallbacks*)callbacks {
return nullptr;
}
- (void)drawRect:(NSRect)dirtyRect {
}
- (id)initWithFrame:(NSRect)frame glWindow:(GLWindow*)window {
return self;
}
- (void)setGLWindow:(GLWindow*)window {
}
- (CGDirectDisplayID)findMyDisplay {
return 0;
}
- (void)keyDown:(NSEvent*)event {
}
- (void)keyUp:(NSEvent*)event {
}
- (void)mouseDown:(NSEvent*)event {
}
- (void)mouseDragged:(NSEvent*)event {
}
- (void)mouseMoved:(NSEvent*)event {
}
- (void)mouseUp:(NSEvent*)event {
}
- (void)otherMouseDown:(NSEvent*)event {
}
- (void)otherMouseDragged:(NSEvent*)event {
}
- (void)otherMouseUp:(NSEvent*)event {
}
- (void)rightMouseDown:(NSEvent*)event {
}
- (void)rightMouseDragged:(NSEvent*)event {
}
- (void)rightMouseUp:(NSEvent*)event {
}
- (void)scrollWheel:(NSEvent*)event {
}
- (void)update {
}
@end