fix(ui): keep diagnostic stop clear of Logo skip
This commit is contained in:
@@ -141,6 +141,30 @@ test('Logo native binding measures label around button center and releases its t
|
||||
button.emit('touch-end'); assert.equal(clicks, 1);
|
||||
view.dispose(); assert.equal(button.listenerCount('touch-end'), 0); assert.equal(button.active, false);
|
||||
});
|
||||
|
||||
test('diagnostic stop button is placed below Logo across different parent coordinates without changing its right-side x', () => {
|
||||
const { positionDiagnosticStopButtonBelow } = load();
|
||||
assert.equal(typeof positionDiagnosticStopButtonBelow, 'function');
|
||||
const logo = new Node('Spirit3103'), logoParent = new Node('logo-parent');
|
||||
const stop = new Node('StopButton'), canvas = new Node('Canvas');
|
||||
logo.parent = logoParent; stop.parent = canvas; stop.position = new Vec3(665, 310, 7);
|
||||
const logoTransform = new UITransform();
|
||||
Object.assign(logoTransform, { width: 208, height: 59, anchorX: 0.5, anchorY: 0.5 });
|
||||
logoTransform.convertToWorldSpaceAR = value => new Vec3(value.x + 671.37, value.y + 311.5, value.z);
|
||||
const stopTransform = new UITransform();
|
||||
Object.assign(stopTransform, { width: 220, height: 64, anchorX: 0.5, anchorY: 0.5 });
|
||||
const canvasTransform = new UITransform();
|
||||
canvasTransform.convertToNodeSpaceAR = value => new Vec3(value.x - 100, value.y - 40, value.z);
|
||||
logo.components.set(UITransform, logoTransform); stop.components.set(UITransform, stopTransform);
|
||||
canvas.components.set(UITransform, canvasTransform);
|
||||
const widget = new Widget(); stop.components.set(Widget, widget);
|
||||
|
||||
positionDiagnosticStopButtonBelow(stop, logo);
|
||||
|
||||
assert.equal(widget.enabled, false, 'runtime position must not be overwritten by the native Widget');
|
||||
assert.equal(stop.position.x, 665); assert.equal(stop.position.z, 7);
|
||||
assert.equal(stop.position.y, 198, 'button top is 12 px below the logo bottom in Canvas coordinates');
|
||||
});
|
||||
function fixture() {
|
||||
const refs = { loadingRoot: new Node(), loginRoot: new Node(), resultRoot: new Node(),
|
||||
statusOverlay: new Node(), statusLabel: new Label(), resultLabel: new Label() };
|
||||
@@ -321,7 +345,10 @@ test('minimum display ignores an early timer wake and cancellation clears its re
|
||||
} });
|
||||
async function started(emitDraw = true) {
|
||||
const component = new exports.LocalPlatformLogin(); const f = fixture();
|
||||
Object.assign(component, f.refs, { stopButton: new Node(), loadingPrefab: {}, loginPrefab: {} });
|
||||
const stopButton = new Node('StopButton'), canvas = new Node('Canvas');
|
||||
stopButton.parent = canvas; stopButton.components.set(UITransform, new UITransform());
|
||||
canvas.components.set(UITransform, new UITransform());
|
||||
Object.assign(component, f.refs, { stopButton, loadingPrefab: {}, loginPrefab: {} });
|
||||
const logo = new Node('Layer1_Logo'); const group = new Node('group-1');
|
||||
const bar = new Node('Spirit254'); bar.components.set(ProgressBar, new ProgressBar());
|
||||
const button = new Node('Spirit3103'), text = new Node('Spirit3104');
|
||||
|
||||
Reference in New Issue
Block a user