Skip to content

Commit

Permalink
test: Add unit test for landscape mode paper sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Oct 23, 2023
1 parent 2d38673 commit 8f5ddc5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spec/measurements_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SILE = require("core.sile")
SU.warn = function () end

describe("The papersize parser", function()
local parse = SILE.paperSizeParser
local parse = SILE.papersize
it("should return the correct values for a6", function()
local a6 = { 297.6377985, 419.52756359999995 }
assert.is.same(parse("a6"), a6)
Expand All @@ -14,6 +14,11 @@ describe("The papersize parser", function()
assert.is.same(parse("2in x 4in"), size)
assert.is.same(parse("144 x 288"), size)
end)
it("should flip x and y page geometry for landscape mode", function()
local size = { 288, 144 }
assert.is.same(parse("2in x 4in", true), size)
assert.is.same(parse("144 x 288", true), size)
end)
it("error if unable to parse", function()
assert.has.errors(function () parse("notapaper") end)
assert.has.errors(function () parse(nil) end)
Expand Down

0 comments on commit 8f5ddc5

Please sign in to comment.