diff --git a/includes/tart.h b/includes/tart.h index dc19eb6..fa28bf6 100644 --- a/includes/tart.h +++ b/includes/tart.h @@ -3,6 +3,7 @@ #ifdef __cplusplus extern "C" { #endif +#include "../source/term.h" // #========================================================================# // | PreacherDHM:TART // | diff --git a/source/term.c b/source/term.c index 8700c5d..3e35b61 100644 --- a/source/term.c +++ b/source/term.c @@ -2,7 +2,8 @@ #include "../includes/tart.h" -#ifdef _WIN64 +// if windows is defined. + #include struct tart_vec2 term_current_size() { struct tart_vec2 ret; @@ -19,10 +20,3 @@ struct tart_vec2 term_current_size() { return ret; } -#else - -struct tart_vec2 term_current_size() { - struct tart_vec2 ret = {50,50}; - return ret; -} -#endif diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index 8a886ae..ce4718a 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -4,6 +4,7 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON) set( SOURCES main.cpp test_tart.cpp + test_term.cpp ) add_executable(${PROJECT_NAME} ${SOURCES} ) diff --git a/testing/main.cpp b/testing/main.cpp index c0de5b5..fe14d97 100644 --- a/testing/main.cpp +++ b/testing/main.cpp @@ -1,7 +1,9 @@ #include "test_tart.h" +#include "test_term.h" #include int main (int argc, char *argv[]) { INSTALLSHELF; tart_run(&__pickle_shelf__); + term_run(&__pickle_shelf__); return PICKLESHELF; } diff --git a/testing/test_term.cpp b/testing/test_term.cpp new file mode 100644 index 0000000..fbbd596 --- /dev/null +++ b/testing/test_term.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "test_term.h" +void term_run(struct pickle_shelf* shelf) { + struct pickle_shelf __pickle_shelf__ = *shelf; //start + + + CREATEJAR(Test_Term); + + PICKLE(Test_get_window_size) { + CONSOLE_SCREEN_BUFFER_INFO csbi; + + GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); + int columns = (unsigned int)(csbi.srWindow.Right - csbi.srWindow.Left + 1); + int rows = (unsigned int)(csbi.srWindow.Bottom - csbi.srWindow.Top + 1); + + std::cout << "\n"; + std::cout << term_current_size().x << "term_current_size()\n"; + std::cout << columns << " columns\n"; + + if(term_current_size().x != columns) + ASSERT("current_size.x is not the same as columns", false); + if(term_current_size().y != rows) + ASSERT("current_size.y is not the same as rows", false); + ASSERT("GOOD", true); + }(); + + ADDPICKLE(Test_Term, Test_get_window_size); + PUTJARONSHELF(Test_Term); + *shelf = __pickle_shelf__; // end +} diff --git a/testing/test_term.h b/testing/test_term.h new file mode 100644 index 0000000..80a739a --- /dev/null +++ b/testing/test_term.h @@ -0,0 +1,7 @@ +#ifndef TEST_TERM_H +#define TEST_TERM_H + +#include +#include +void term_run(struct pickle_shelf*); +#endif