1#include "../Dialogs/DialogLayout.h"
2#include <cmath>
3#include <cstdlib>
4#include <iostream>
5
6namespace
7{
8 void Check(bool condition, const char* message)
9 {
10 if (!condition) { std::cerr << "FAIL: " << message << '\n'; std::exit(1); }
11 }
12
13 bool Near(float a, float b) { return std::fabs(a - b) < 0.01f; }
14
16 {
27 return sizes;
28 }
29}
30
32{
35 const float expectedX[] = {138, 139, 1149, 133, 1281, 712, 136, 306, 1538};
36 const float expectedY[] = {1018, 1015, 16, 16, 16, 429, 317, 0, 16};
38 {
39 Check(
Near(reference[
id].x, expectedX[
id]) &&
Near(reference[
id].y, expectedY[
id]),
40 "reference layout matches saved positions to the displayed pixel");
41 }
42
47
50 "wrap Camera below the first row when chat reaches its minimum");
53
54 for (const auto screen : {std::array<float, 3>{3440, 1351, 1.1f}, {1920, 1080, 1},
55 {2560, 1440, 1.5f}, {3840, 2160, 2}, {1366, 768, 1}, {800, 600, 1}})
56 {
57 const float width = screen[0] / screen[2], height = screen[1] / screen[2];
59 for (const auto& panel : layout)
60 Check(panel.x >= 0 && panel.y >= 0 && panel.x + panel.width <= width + 0.01f &&
61 panel.y + panel.height <= height + 0.01f, "panels remain inside the scaled viewport");
64 }
67 std::cout << "PASS: saved layout, chat shrink/wrap, docking, bottom anchors, resolution and UI scaling\n";
68}
constexpr float ReferenceHeight
Layout Defaults(float width, float height, Layout panels, float minimumChatWidth)
std::array< Panel, Count > Layout
constexpr float ReferenceWidth
bool Near(const Body &b, const Triangle &t, double extra)