Bug 1860205 - Add tests for negation of a round() node. r=firefox-style-system-reviewers,emilio

Depends on D192742

Differential Revision: https://phabricator.services.mozilla.com/D192760
This commit is contained in:
Jonathan Kew 2023-11-03 22:29:07 +00:00
parent 092e43b900
commit bd4c1c5cab

View File

@ -71,6 +71,46 @@ test_math_used("round(down, -10px, 5px)", "-10px");
test_math_used("round(up, -10px, 5px)", "-10px");
test_math_used("round(to-zero, -10px, 5px)", "-10px");
// Test negation of the round operation
test_math_used("calc(0px - round(23px, 10px))", "-20px");
test_math_used("calc(0px - round(18px, 10px))", "-20px");
test_math_used("calc(0px - round(15px, 10px))", "-20px");
test_math_used("calc(0px - round(13px, 10px))", "-10px");
test_math_used("calc(0px - round(-13px, 10px))", "10px");
test_math_used("calc(0px - round(-18px, 10px))", "20px");
// Test negation of nearest
test_math_used("calc(0px - round(nearest, 23px, 10px))", "-20px");
test_math_used("calc(0px - round(nearest, 18px, 10px))", "-20px");
test_math_used("calc(0px - round(nearest, 15px, 10px))", "-20px");
test_math_used("calc(0px - round(nearest, 13px, 10px))", "-10px");
test_math_used("calc(0px - round(nearest, -13px, 10px))", "10px");
test_math_used("calc(0px - round(nearest, -18px, 10px))", "20px");
// Test negation of down
test_math_used("calc(0px - round(down, 23px, 10px))", "-20px");
test_math_used("calc(0px - round(down, 18px, 10px))", "-10px");
test_math_used("calc(0px - round(down, 15px, 10px))", "-10px");
test_math_used("calc(0px - round(down, 13px, 10px))", "-10px");
test_math_used("calc(0px - round(down, -13px, 10px))", "20px");
test_math_used("calc(0px - round(down, -18px, 10px))", "20px");
// Test negation of up
test_math_used("calc(0px - round(up, 23px, 10px))", "-30px");
test_math_used("calc(0px - round(up, 18px, 10px))", "-20px");
test_math_used("calc(0px - round(up, 15px, 10px))", "-20px");
test_math_used("calc(0px - round(up, 13px, 10px))", "-20px");
test_math_used("calc(0px - round(up, -13px, 10px))", "10px");
test_math_used("calc(0px - round(up, -18px, 10px))", "10px");
// Test negation of to-zero
test_math_used("calc(0px - round(to-zero, 23px, 10px))", "-20px");
test_math_used("calc(0px - round(to-zero, 18px, 10px))", "-10px");
test_math_used("calc(0px - round(to-zero, 15px, 10px))", "-10px");
test_math_used("calc(0px - round(to-zero, 13px, 10px))", "-10px");
test_math_used("calc(0px - round(to-zero, -13px, 10px))", "10px");
test_math_used("calc(0px - round(to-zero, -18px, 10px))", "10px");
// Extreme cases:
// 0 step is NaN