+ dummy getters

This commit is contained in:
Johannes Theiner 2019-11-07 17:02:00 +01:00
parent 2f2e739d55
commit 145c7f4695
9 changed files with 162 additions and 25 deletions

View File

@ -5,4 +5,3 @@ Color::Color(unsigned char red, unsigned char green, unsigned char blue)
: red(red), green(green), blue(blue){
}

22
src/Font.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <string>
#include <utility>
#include "Font.h"
Font::Font(std::string name, int height, int width) {
this->name = std::move(name);
this->height = height;
this->width = width;
}
std::string Font::getName() {
return name;
}
int Font::getHeight() {
return height;
}
int Font::getWidth() {
return width;
}

View File

@ -1,12 +1,16 @@
#include <utility>
#ifndef LIBRARY_FONT_H
#define LIBRARY_FONT_H
class Font {
private:
Font();
std::string name;
int height;
int width;
public:
Font(std::string name, int height, int width);
std::string getName();
int getHeight();
int getWidth();
@ -14,4 +18,6 @@ public:
};
const static Font font_1 = Font("DummyFont", 10, 5);
#endif

View File

@ -1,5 +0,0 @@
#include "add.h"
int add(int a, int b){
return a + b;
}

View File

@ -1,6 +0,0 @@
#ifndef LIBRARY_ADD_H
#define LIBRARY_ADD_H
int add(int a, int b);
#endif

View File

@ -25,3 +25,23 @@ bool callEvent(EventType type) {
}
return true;
}
void setLayoutVersion(LayoutVersion newValue) {
}
void setCharactersPerLine(int newValue) {
}
void setCharactersPerRow(int newValue) {
}
void setMousePosition(int x, int y) {
}
void buttonPressed(KeyCode keyCode) {
}

View File

@ -9,6 +9,14 @@ void initialize(int pid) {
impl.sharedMemorySize = 0;
}
bool setPixel(int x, int y, Color color) {
return true;
}
Color getPixel(int x, int y) {
return {255, 0, 0};
}
bool registerEvent(EventType type, std::function<void()> handler) {
int signum = SIGUSR1 + impl.eventTable.size();
@ -28,3 +36,99 @@ bool registerEvent(EventType type, std::function<void()> handler) {
return true;
}
bool setText(std::string text) {
return false;
}
std::string getText() {
return "Hallo Welt";
}
LayoutVersion getLayoutVersion() {
return V1;
}
void reset() {
}
int getWidth() {
return 360;
}
void setWidth(int newValue) {
}
int getHeight() {
return 360;
}
void setHeight(int newValue) {
}
GraphicMode getMode() {
return TrueColor;
}
void setMode(GraphicMode newValue) {
}
int getRedrawInterval() {
return 10;
}
void setRedrawInterval(int newValue) {
}
int getTimerInterruptInterval() {
return 5;
}
void setTimerInterruptInterval(int newValue) {
}
Color getBackgroundColor() {
return black;
}
void setBackgroundColor(Color newValue) {
}
Color getForegroundColor() {
return white;
}
void setForegroundColor(Color newValue) {
}
int getCharactersPerRow() {
return 5;
}
int getCharactersPerColumn() {
return 5;
}
Font getFont() {
return font_1;
}
void setFont(Font newValue) {
}
std::pair<int, int> getMousePosition() {
return {10, 50};
}
KeyCode getLastPressedKey() {
return KeyCode(50);
}

View File

@ -1,11 +0,0 @@
#include <catch2/catch.hpp>
#include "../src/add.h"
TEST_CASE("add works") {
SECTION("equals") {
REQUIRE(add(2, 2) == 4);
}
SECTION("not equals") {
REQUIRE(add(2, 2) != 5);
}
}

8
test/public_test.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <catch2/catch.hpp>
#include "../src/vkvm.h"
TEST_CASE("add works") {
SECTION("equals") {
REQUIRE(getText() == "Hallo Welt");
}
}