Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/unit/core_utils_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
escapeString,
getInheritableProperty,
getModificationDate,
getRotationMatrix,
getSizeInBytes,
isWhiteSpace,
numberToString,
Expand Down Expand Up @@ -566,6 +567,20 @@ describe("core_utils", function () {
});
});

describe("getRotationMatrix", function () {
it("should get a rotation matrix for valid rotation values", function () {
expect(getRotationMatrix(90, 10, 20)).toEqual([0, 1, -1, 0, 10, 0]);
expect(getRotationMatrix(180, 10, 20)).toEqual([-1, 0, 0, -1, 10, 20]);
expect(getRotationMatrix(270, 10, 20)).toEqual([0, -1, 1, 0, 0, 20]);
});

it("throws an exception for invalid rotation values", function () {
expect(() => getRotationMatrix(42, 10, 20)).toThrow(
new Error("Invalid rotation")
);
});
});

describe("getSizeInBytes", function () {
it("should get the size in bytes to use to represent a positive integer", function () {
expect(getSizeInBytes(0)).toEqual(0);
Expand Down