结构优化
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <QApplication>
|
||||
#include <stdexcept>
|
||||
#include "../Renderive/architecture/Plot.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "../Renderive/plot/Latency_Eager_Plot.h"
|
||||
#include "../Renderive/base/Memory.h"
|
||||
namespace {
|
||||
void* callback_allocate(void*, std::size_t size, std::size_t alignment) {
|
||||
@@ -10,19 +11,18 @@ void callback_deallocate(void*, void* address, std::size_t size, std::size_t ali
|
||||
std::pmr::new_delete_resource()->deallocate(address, size, alignment);
|
||||
}
|
||||
}
|
||||
int main(int argc, char** argv) {
|
||||
QApplication app(argc, argv);
|
||||
TEST(Memory_Plot_Late_Config, RejectsCallbacksAfterPlotCreatesMemory) {
|
||||
renderive::start_render_scheduler();
|
||||
renderive::Plot plot;
|
||||
renderive::Latency_Eager_Plot plot;
|
||||
plot.init();
|
||||
renderive::Memory_Callbacks callbacks;
|
||||
callbacks.allocate = callback_allocate;
|
||||
callbacks.deallocate = callback_deallocate;
|
||||
try {
|
||||
renderive::set_memory_callbacks(callbacks);
|
||||
}
|
||||
catch (const std::logic_error&) {
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
EXPECT_THROW(renderive::set_memory_callbacks(callbacks), std::logic_error);
|
||||
}
|
||||
int main(int argc, char** argv) {
|
||||
qputenv("QT_QPA_PLATFORM", "offscreen");
|
||||
QApplication app(argc, argv);
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user