4runr-os 2.0.8 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,24 +2,40 @@
|
|
|
2
2
|
* Layout Tests - Verify bulletproof layout on multiple terminal sizes
|
|
3
3
|
*/
|
|
4
4
|
import { computePhase1Layout } from './phase1Layout.js';
|
|
5
|
+
import { getTerminalGeometry } from '../../tui/geometry.js';
|
|
5
6
|
// Test terminal sizes (common real-world sizes)
|
|
6
7
|
const TEST_SIZES = [
|
|
7
|
-
{ width: 80, height: 24, name: 'Small (80x24)' },
|
|
8
8
|
{ width: 100, height: 30, name: 'Medium (100x30)' },
|
|
9
9
|
{ width: 120, height: 40, name: 'Large (120x40)' },
|
|
10
10
|
{ width: 160, height: 50, name: 'XLarge (160x50)' },
|
|
11
11
|
{ width: 200, height: 60, name: 'XXLarge (200x60)' },
|
|
12
|
+
{ width: 282, height: 61, name: 'CloudShell (282x61) - must clamp to 258' },
|
|
12
13
|
{ width: 280, height: 70, name: 'Ultrawide (280x70)' },
|
|
13
14
|
];
|
|
14
15
|
function validateLayout(width, height) {
|
|
15
|
-
|
|
16
|
+
// Simulate CloudShell environment for CloudShell test sizes
|
|
17
|
+
if (width === 282) {
|
|
18
|
+
process.env.AWS_EXECUTION_ENV = 'AWS-CloudShell';
|
|
19
|
+
}
|
|
20
|
+
// Create a mock screen object for geometry detection
|
|
21
|
+
const mockScreen = {
|
|
22
|
+
cols: width,
|
|
23
|
+
rows: height,
|
|
24
|
+
width: width,
|
|
25
|
+
height: height,
|
|
26
|
+
};
|
|
27
|
+
const result = computePhase1Layout(width, height, mockScreen);
|
|
16
28
|
const errors = [];
|
|
17
29
|
if (!result.ok || !result.layout) {
|
|
18
30
|
errors.push(`Layout failed: ${result.errorMessage}`);
|
|
19
31
|
return { ok: false, errors };
|
|
20
32
|
}
|
|
21
33
|
const layout = result.layout;
|
|
22
|
-
//
|
|
34
|
+
// Get the actual safe dimensions (after clamping)
|
|
35
|
+
const geo = getTerminalGeometry(mockScreen);
|
|
36
|
+
const safeWidth = geo.safeCols;
|
|
37
|
+
const safeHeight = geo.safeRows;
|
|
38
|
+
// Test 1: No panel exceeds safe screen bounds (after clamping)
|
|
23
39
|
const panels = [
|
|
24
40
|
{ name: 'posture', rect: layout.posture },
|
|
25
41
|
{ name: 'resources', rect: layout.resources },
|
|
@@ -32,11 +48,12 @@ function validateLayout(width, height) {
|
|
|
32
48
|
for (const panel of panels) {
|
|
33
49
|
const right = panel.rect.left + panel.rect.width;
|
|
34
50
|
const bottom = panel.rect.top + panel.rect.height;
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
// Use safeWidth/safeHeight (after clamping) instead of raw width/height
|
|
52
|
+
if (right > safeWidth) {
|
|
53
|
+
errors.push(`${panel.name} exceeds safe width: ${right} > ${safeWidth} (raw width: ${width})`);
|
|
37
54
|
}
|
|
38
|
-
if (bottom >
|
|
39
|
-
errors.push(`${panel.name} exceeds height: ${bottom} > ${height}`);
|
|
55
|
+
if (bottom > safeHeight) {
|
|
56
|
+
errors.push(`${panel.name} exceeds safe height: ${bottom} > ${safeHeight} (raw height: ${height})`);
|
|
40
57
|
}
|
|
41
58
|
if (panel.rect.width <= 0) {
|
|
42
59
|
errors.push(`${panel.name} has invalid width: ${panel.rect.width}`);
|
|
@@ -58,9 +75,20 @@ function validateLayout(width, height) {
|
|
|
58
75
|
}
|
|
59
76
|
}
|
|
60
77
|
}
|
|
61
|
-
// Test 3: Command line
|
|
62
|
-
if (layout.commandLine.width
|
|
63
|
-
errors.push(`Command line width
|
|
78
|
+
// Test 3: Command line doesn't exceed safe width (after clamping)
|
|
79
|
+
if (layout.commandLine.width > safeWidth) {
|
|
80
|
+
errors.push(`Command line width exceeds safe width: ${layout.commandLine.width} > ${safeWidth} (raw width: ${width})`);
|
|
81
|
+
}
|
|
82
|
+
// Test 4: For CloudShell (282 width), verify clamping is applied
|
|
83
|
+
if (width === 282) {
|
|
84
|
+
if (safeWidth > 260) {
|
|
85
|
+
errors.push(`CloudShell clamping failed: safeWidth ${safeWidth} should be <= 258 (got ${safeWidth})`);
|
|
86
|
+
}
|
|
87
|
+
console.log(` CloudShell test: raw=${width}, safe=${safeWidth}, clamped=${width - safeWidth} chars`);
|
|
88
|
+
}
|
|
89
|
+
// Cleanup environment variable
|
|
90
|
+
if (width === 282) {
|
|
91
|
+
delete process.env.AWS_EXECUTION_ENV;
|
|
64
92
|
}
|
|
65
93
|
return { ok: errors.length === 0, errors };
|
|
66
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase1Layout.test.js","sourceRoot":"","sources":["../../../../../src/ui/v3/ui/layout/phase1Layout.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAyB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"phase1Layout.test.js","sourceRoot":"","sources":["../../../../../src/ui/v3/ui/layout/phase1Layout.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAyB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,gDAAgD;AAChD,MAAM,UAAU,GAAG;IACjB,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACnD,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAClD,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACnD,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACpD,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,yCAAyC,EAAE;IAC3E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