added a SHIT ton of modules
This commit is contained in:
1 parent
b1634d195c
commit
361892bf0b
64 files changed
+5346
-482
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "../src/config/profiles.h"
|
||||
inline void test_hud_grid() {
|
||||
using namespace hud_editor;
|
||||
drag gesture;gesture.begin({23,37},{100,100});
|
||||
auto p=gesture.move({101,101},{100,30},{800,600},true,10);assert(p.x==20 && p.y==40);
|
||||
// Repeated sub-grid mouse movements must eventually move the snapped card.
|
||||
for(int i=1;i<=12;++i)p=gesture.move({100.f+i,100.f+i},{100,30},{800,600},true,10);
|
||||
assert(p.x==40 && p.y==50);
|
||||
p=gesture.move({112,112},{100,30},{800,600},false,10);assert(p.x==35 && p.y==49);
|
||||
p=gesture.move({2000,2000},{107,37},{800,600},true,10);assert(p.x==693 && p.y==563);
|
||||
p=gesture.move({-2000,-2000},{100,30},{800,600},true,10);assert(p.x==0 && p.y==0);
|
||||
p=gesture.move({110,110},{900,700},{800,600},true,10);assert(p.x==0 && p.y==0);
|
||||
const auto original=options;options={};module_manager manager;const auto defaults=config::capture(manager);
|
||||
options={false,false,24};auto custom=config::capture(manager);config::snapshot decoded;
|
||||
assert(config::decode(config::encode(custom),decoded));options={};config::apply(manager,defaults,decoded);
|
||||
assert(!options.snap && !options.show_grid && options.grid_size==24);
|
||||
decoded["[hud editor]"].settings["grid size"].numbers[0]=500;
|
||||
config::apply(manager,defaults,decoded);assert(options.grid_size==64);
|
||||
config::apply(manager,defaults,{});assert(options.snap && options.show_grid && options.grid_size==10);
|
||||
options=original;
|
||||
std::cout<<"PASS: HUD grid accumulated dragging, free movement, screen bounds and profile preferences\n";
|
||||
}
|
||||
Reference in new issue
Block a user