#include "Qt/plot/Latency_Eager_Plot.h" #include #include #include #include #include namespace renderive { namespace { TEST(Renderive_Qt, WidgetLifecycleDrivesAndStopsKernelScene) { auto* application = qobject_cast(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{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(); }