~ somehow forgot to link library to unitTests

This commit is contained in:
Johannes Theiner 2020-01-08 21:57:41 +01:00
parent 463ec11332
commit 255698cba2
5 changed files with 7 additions and 26 deletions

View File

@ -34,6 +34,7 @@ enable_testing()
find_package(Catch2 REQUIRED)
add_executable(UnitTests ${SOURCES} ${HEADERS} ${TESTS})
target_link_libraries(UnitTests Catch2::Catch2)
target_link_libraries(UnitTests ${LIB_PATH}/lib/liblibrary.a)
include(CTest)
include(Catch)

View File

@ -1,4 +1,3 @@
#include "Color.hpp"
#include "DrawRender.hpp"
#include "vkvm.hpp"
#include <algorithm>
@ -28,7 +27,7 @@ void DrawRender::graphicsUpdate(int type) {
if(center.x + radius > windowWidth || center.x - radius < 0
|| center.y + radius > windowHeight || center.y - radius < 0) {
radius = utils::min(utils::min(center.x, windowWidth - center.x), utils::min(center.y, windowHeight - center.y));
radius = std::min(std::min(center.x, windowWidth - center.x), std::min(center.y, windowHeight - center.y));
}
oldCircle = Circle(center, radius, penWidth, false);

View File

@ -17,10 +17,10 @@ Rectangle::Rectangle(vkvm::Coordinates mouseLeftDownPostion, vkvm::Coordinates m
length = abs(mouseLeftDownPosition.x - mousePosition.x);
width = abs(mouseLeftDownPosition.y - mousePosition.y);
uperLeft.x = utils::min(mouseLeftDownPosition.x, mousePosition.x);
uperLeft.y = utils::min(mouseLeftDownPosition.y, mousePosition.y);
bottomRight.x = utils::max(mouseLeftDownPosition.x, mousePosition.x);
bottomRight.y = utils::max(mouseLeftDownPosition.y, mousePosition.y);
uperLeft.x = std::min(mouseLeftDownPosition.x, mousePosition.x);
uperLeft.y = std::min(mouseLeftDownPosition.y, mousePosition.y);
bottomRight.x = std::max(mouseLeftDownPosition.x, mousePosition.x);
bottomRight.y = std::max(mouseLeftDownPosition.y, mousePosition.y);
rectangle.resize(width);
for(y_draw = 0; y_draw < width; y_draw++) {

View File

@ -1,7 +1,3 @@
//
// Created by shaohuatong on 06.12.19.
//
#include "utils.hpp"
int utils::squareOfDistance(vkvm::Coordinates x, vkvm::Coordinates y) {
@ -10,16 +6,4 @@ int utils::squareOfDistance(vkvm::Coordinates x, vkvm::Coordinates y) {
int utils::getDistance(vkvm::Coordinates x, vkvm::Coordinates y) {
return (int)floor(sqrt(squareOfDistance(x, y)));
}
int utils::min(int x, int y) {
if(x <= y)
return x;
return y;
}
int utils::max(int x, int y) {
if(x<=y)
return y;
return x;
}

View File

@ -6,15 +6,12 @@
#define SIMPLE_DRAW_UTILS_HPP
#include "vkvm.hpp"
#include "internal.hpp"
#include "math.h"
#include <cmath>
class utils {
public:
static int squareOfDistance(vkvm::Coordinates x, vkvm::Coordinates y);
static int getDistance(vkvm::Coordinates x, vkvm::Coordinates y);
static int min(int x, int y);
static int max(int x, int y);
};