-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move gl and nucleus unit tests to /unittests + make gl tests work aga…
…in with new qml gui approach.
- Loading branch information
Showing
38 changed files
with
229 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/***************************************************************************** | ||
* Alpine Terrain Renderer | ||
* Copyright (C) 2023 Adam Celarek | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*****************************************************************************/ | ||
|
||
#include "UnittestGLContext.h" | ||
|
||
#include <cstdio> | ||
|
||
#include <QGuiApplication> | ||
#include <QOffscreenSurface> | ||
#include <QOpenGLDebugLogger> | ||
#include <QTimer> | ||
#include <catch2/catch_test_macros.hpp> | ||
|
||
UnittestGLContext::UnittestGLContext() | ||
{ | ||
QSurfaceFormat surface_format; | ||
surface_format.setDepthBufferSize(24); | ||
surface_format.setOption(QSurfaceFormat::DebugContext); | ||
|
||
// Request OpenGL 3.3 core or OpenGL ES 3.0. | ||
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { | ||
qDebug("Requesting 3.3 core context"); | ||
surface_format.setVersion(3, 3); | ||
surface_format.setProfile(QSurfaceFormat::CoreProfile); | ||
} else { | ||
qDebug("Requesting 3.0 context"); | ||
surface_format.setVersion(3, 0); | ||
} | ||
QSurfaceFormat::setDefaultFormat(surface_format); | ||
m_context.setFormat(surface_format); | ||
|
||
surface.create(); | ||
const auto r = m_context.create(); | ||
assert(r); | ||
m_context.makeCurrent(&surface); | ||
|
||
QOpenGLDebugLogger logger; | ||
const auto debug_logger_supported = logger.initialize(); | ||
#ifndef __EMSCRIPTEN__ // not supported by webassembly and it's ok. errors are printed to the java script console | ||
CHECK(debug_logger_supported); | ||
#endif | ||
|
||
if (debug_logger_supported) { | ||
logger.disableMessages(QList<GLuint>({131185})); | ||
QObject::connect(&logger, &QOpenGLDebugLogger::messageLogged, [](const auto& message) { | ||
qDebug() << message; | ||
}); | ||
logger.startLogging(QOpenGLDebugLogger::SynchronousLogging); | ||
} | ||
} | ||
|
||
void UnittestGLContext::initialise() | ||
{ | ||
static UnittestGLContext s_instance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
############################################################################# | ||
# Alpine Terrain Renderer | ||
# Copyright (C) 2023 Adam Celarek <family name at cg tuwien ac at> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
############################################################################# | ||
|
||
cmake_minimum_required(VERSION 3.24) | ||
project(alpine-renderer-unittests_nucleus LANGUAGES CXX) | ||
|
||
alp_add_unittest(unittests_nucleus | ||
catch2_helpers.h | ||
test_Camera.cpp | ||
nucleus_utils_stopwatch.cpp | ||
test_DrawListGenerator.cpp | ||
test_helpers.h | ||
test_raster.cpp | ||
test_terrain_mesh_index_generator.cpp | ||
test_srs.cpp | ||
test_tile.cpp | ||
test_tile_conversion.cpp | ||
nucleus_tile_scheduler_util.cpp | ||
nucleus_tile_scheduler_tile_load_service.cpp | ||
nucleus_tile_scheduler_layer_assembler.cpp | ||
nucleus_tile_scheduler_quad_assembler.cpp | ||
nucleus_tile_scheduler_cache.cpp | ||
nucleus_tile_scheduler_scheduler.cpp | ||
nucleus_tile_scheduler_slot_limiter.cpp | ||
nucleus_tile_scheduler_rate_limiter.cpp | ||
RateTester.h RateTester.cpp | ||
test_zppbits.cpp | ||
cache_queries.cpp | ||
bits_and_pieces.cpp | ||
) | ||
|
||
target_sources(unittests_nucleus | ||
PRIVATE | ||
bits_and_pieces.cpp | ||
) | ||
|
||
qt_add_resources(unittests_nucleus "height_data" | ||
PREFIX "/map" | ||
BASE ${renderer_static_data_SOURCE_DIR} | ||
FILES ${renderer_static_data_SOURCE_DIR}/height_data.atb | ||
) | ||
qt_add_resources(unittests_nucleus "test_data" | ||
PREFIX "/test_data" | ||
BASE ${CMAKE_CURRENT_SOURCE_DIR}/data/ | ||
FILES | ||
data/170px-Jeune_bouquetin_de_face.jpg | ||
data/test-tile_ortho.jpeg | ||
data/test-tile.png | ||
) | ||
target_link_libraries(unittests_nucleus PUBLIC nucleus Catch2::Catch2 Qt::Test) | ||
target_compile_definitions(unittests_nucleus PUBLIC "ALP_TEST_DATA_DIR=\":/test_data/\"") | ||
|
||
if (ANDROID) | ||
add_android_openssl_libraries(unittests_nucleus) | ||
endif() | ||
|
File renamed without changes.
File renamed without changes.
Oops, something went wrong.