~ somehow forgot to link library to unitTests
This commit is contained in:
parent
463ec11332
commit
255698cba2
@ -34,6 +34,7 @@ enable_testing()
|
|||||||
find_package(Catch2 REQUIRED)
|
find_package(Catch2 REQUIRED)
|
||||||
add_executable(UnitTests ${SOURCES} ${HEADERS} ${TESTS})
|
add_executable(UnitTests ${SOURCES} ${HEADERS} ${TESTS})
|
||||||
target_link_libraries(UnitTests Catch2::Catch2)
|
target_link_libraries(UnitTests Catch2::Catch2)
|
||||||
|
target_link_libraries(UnitTests ${LIB_PATH}/lib/liblibrary.a)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(Catch)
|
include(Catch)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include "Color.hpp"
|
|
||||||
#include "DrawRender.hpp"
|
#include "DrawRender.hpp"
|
||||||
#include "vkvm.hpp"
|
#include "vkvm.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -28,7 +27,7 @@ void DrawRender::graphicsUpdate(int type) {
|
|||||||
|
|
||||||
if(center.x + radius > windowWidth || center.x - radius < 0
|
if(center.x + radius > windowWidth || center.x - radius < 0
|
||||||
|| center.y + radius > windowHeight || center.y - 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);
|
oldCircle = Circle(center, radius, penWidth, false);
|
||||||
|
@ -17,10 +17,10 @@ Rectangle::Rectangle(vkvm::Coordinates mouseLeftDownPostion, vkvm::Coordinates m
|
|||||||
|
|
||||||
length = abs(mouseLeftDownPosition.x - mousePosition.x);
|
length = abs(mouseLeftDownPosition.x - mousePosition.x);
|
||||||
width = abs(mouseLeftDownPosition.y - mousePosition.y);
|
width = abs(mouseLeftDownPosition.y - mousePosition.y);
|
||||||
uperLeft.x = utils::min(mouseLeftDownPosition.x, mousePosition.x);
|
uperLeft.x = std::min(mouseLeftDownPosition.x, mousePosition.x);
|
||||||
uperLeft.y = utils::min(mouseLeftDownPosition.y, mousePosition.y);
|
uperLeft.y = std::min(mouseLeftDownPosition.y, mousePosition.y);
|
||||||
bottomRight.x = utils::max(mouseLeftDownPosition.x, mousePosition.x);
|
bottomRight.x = std::max(mouseLeftDownPosition.x, mousePosition.x);
|
||||||
bottomRight.y = utils::max(mouseLeftDownPosition.y, mousePosition.y);
|
bottomRight.y = std::max(mouseLeftDownPosition.y, mousePosition.y);
|
||||||
|
|
||||||
rectangle.resize(width);
|
rectangle.resize(width);
|
||||||
for(y_draw = 0; y_draw < width; y_draw++) {
|
for(y_draw = 0; y_draw < width; y_draw++) {
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
//
|
|
||||||
// Created by shaohuatong on 06.12.19.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
|
|
||||||
int utils::squareOfDistance(vkvm::Coordinates x, vkvm::Coordinates y) {
|
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) {
|
int utils::getDistance(vkvm::Coordinates x, vkvm::Coordinates y) {
|
||||||
return (int)floor(sqrt(squareOfDistance(x, 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;
|
|
||||||
}
|
}
|
@ -6,15 +6,12 @@
|
|||||||
#define SIMPLE_DRAW_UTILS_HPP
|
#define SIMPLE_DRAW_UTILS_HPP
|
||||||
|
|
||||||
#include "vkvm.hpp"
|
#include "vkvm.hpp"
|
||||||
#include "internal.hpp"
|
#include <cmath>
|
||||||
#include "math.h"
|
|
||||||
|
|
||||||
class utils {
|
class utils {
|
||||||
public:
|
public:
|
||||||
static int squareOfDistance(vkvm::Coordinates x, vkvm::Coordinates y);
|
static int squareOfDistance(vkvm::Coordinates x, vkvm::Coordinates y);
|
||||||
static int getDistance(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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user