重整cmake
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
find_package(blend2d CONFIG REQUIRED)
|
||||
add_library(Renderive_render_2D STATIC)
|
||||
target_sources(Renderive_render_2D PRIVATE
|
||||
axis/Axis.cpp
|
||||
base/Types.cpp
|
||||
plot/Plot_Core.cpp
|
||||
plottable/Heatmaps.cpp
|
||||
plottable/Overlays.cpp
|
||||
plottable/Performance_Overlay.cpp
|
||||
plottable/Spectrum.cpp
|
||||
render/Blend2D_Cache.cpp
|
||||
renderable/Renderable.cpp
|
||||
)
|
||||
target_include_directories(Renderive_render_2D PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/..>"
|
||||
)
|
||||
target_compile_features(Renderive_render_2D PUBLIC cxx_std_20)
|
||||
target_link_libraries(Renderive_render_2D PUBLIC Renderive_Kernel blend2d::blend2d)
|
||||
if(MSVC)
|
||||
target_compile_options(Renderive_render_2D PRIVATE /utf-8)
|
||||
endif()
|
||||
if(RENDERIVE_BUILD_TESTS)
|
||||
find_package(GTest CONFIG REQUIRED)
|
||||
add_executable(Renderive_render_2D_Tests)
|
||||
target_sources(Renderive_render_2D_Tests PRIVATE
|
||||
tests/render_2D_Frame_Pipeline_Tests.cpp
|
||||
tests/render_2D_Integration_Tests.cpp
|
||||
)
|
||||
target_link_libraries(Renderive_render_2D_Tests PRIVATE Renderive_render_2D GTest::gtest_main)
|
||||
add_test(NAME Renderive_render_2D_Tests COMMAND Renderive_render_2D_Tests)
|
||||
endif()
|
||||
@@ -1,57 +0,0 @@
|
||||
#include "Qt/plot/Latency_Eager_Plot.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QTimer>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace renderive {
|
||||
namespace {
|
||||
|
||||
TEST(Renderive_Qt, WidgetLifecycleDrivesAndStopsKernelScene) {
|
||||
auto* application = qobject_cast<QApplication*>(QCoreApplication::instance());
|
||||
ASSERT_NE(application, nullptr);
|
||||
|
||||
Latency_Eager_Plot plot;
|
||||
plot.resize(240, 120);
|
||||
plot.init();
|
||||
auto x_axis = Frequency_Axis::Builder(plot.root_renderable(), Orientation::Horizontal)
|
||||
.set_x(20)
|
||||
.set_y(100)
|
||||
.set_pixel_length(200)
|
||||
.set_coord_range({0.0, 10.0})
|
||||
.build();
|
||||
auto y_axis = Axis::Builder(plot.root_renderable(), Orientation::Vertical)
|
||||
.set_x(20)
|
||||
.set_y(10)
|
||||
.set_pixel_length(90)
|
||||
.set_coord_range({1.0, 0.0})
|
||||
.build();
|
||||
auto spectrum = Spectrum::Builder(plot.root_renderable(), x_axis, y_axis)
|
||||
.set_frequency_range({0.0, 10.0})
|
||||
.set_frequency_point_size(8)
|
||||
.build();
|
||||
spectrum->update_samples(std::vector<double>{0.1, 0.3, 0.8, 0.5, 0.9, 0.4, 0.2, 0.7});
|
||||
|
||||
plot.show();
|
||||
QTimer::singleShot(150, application, &QCoreApplication::quit);
|
||||
EXPECT_EQ(application->exec(), 0);
|
||||
EXPECT_GT(plot.diagnostics().refresh.frame_count, 0u);
|
||||
plot.pause();
|
||||
plot.hide();
|
||||
application->processEvents();
|
||||
EXPECT_FALSE(plot.running());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace renderive
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
qputenv("QT_QPA_PLATFORM", "offscreen");
|
||||
QApplication application(argc, argv);
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user