Commit 9fd710d7 authored by Catgolin's avatar Catgolin
Browse files

test(camera): updated specifications for the printer: the print() method...

test(camera): updated specifications for the printer: the print() method should take the object to print and the camera on which the object should be printed
parent 5916e029
Pipeline #463158 failed with stage
in 44 seconds
......@@ -7,6 +7,11 @@ import Point from "../../src/geometry/points/point";
import Segment from "../../src/geometry/curves/segment";
import Line from "../../src/geometry/curves/line";
// import ScreenPoint from "../../src/vue/screenPoint";
// import RoundPointPrinter from "../../src/vue/printers/roundPointPrinter";
// import StraightSegmentPrinter from "../../src/vue/printers/straightSegmentPrinter";
// import StraightLinePrinter from "../../src/vue/printers/straightLinePrinter";
// import DashedSegmentPrinter from "../../src/vue/printers/dashedSegmentPrinter";
describe("Printing objects on the canvas", function () {
/** @var {{width: {number}, height: {number}, getContext: {function}} */
......@@ -238,15 +243,21 @@ describe("Printing objects on the canvas", function () {
function () {
expect(camera.getPrinterFor(point)).to.be.an.instanceof(RoundPointPrinter);
expect(camera.getPrinterFor(point).print).to.be.a("function");
expect(camera.getPrinterFor(point).print()).to.throw("Expected object to be a Point, got undefined");
expect(camera.getPrinterFor(point).print()).to.throw("Expected first parameter to be a Point, got undefined");
expect(camera.getPrinterFor(point).print(point)).to.throw("Expected second parameter to be a Camera, got undefined");
expect(camera.getPrinterFor(point).print(point, camera)).not.to.throw;
expect(camera.printObject(point)).not.to.throw;
}
);
it("should get the StraightSegmentPrinter",
function () {
const segment = new Segment(center, point);
expect(camera.getPrinterFor(segment)).to.be.an.instanceof(StraightSegentPrinter);
expect(camera.getPrinterFor(segment).print()).to.throw("Expected object to be a Segment, got undefined");
expect(camera.getPrinterFor(segment)).to.be.an.instanceof(StraightSegmentPrinter);
expect(camera.getPrinterFor(segment).print(point)).to.throw("Expected first parameter to be a Segment, got Point");
expect(camera.getPrinterFor(segment).print(segment)).to.throw("Expected second parameter to be a Camera, got undefined");
expect(camera.getPrinterFor(segment).print(segment, camera)).not.to.throw;
expect(camera.printObject(segment)).not.to.throw;
}
);
......@@ -254,7 +265,10 @@ describe("Printing objects on the canvas", function () {
function () {
const line = new Line(Math.random(), Math.random(), Math.random());
expect(camera.getPrinterFor(line)).to.be.an.instanceof(StraightLinePrinter);
expect(camera.getPrinterFor(line).print()).to.throw("Expected object to be a Line, got undefined");
expect(camera.getPrinterFor(line).print()).to.throw("Expected first parameter to be a Line, got undefined");
expect(camera.getPrinterFor(line).print(line)).to.throw("Expected second parameter to be a Camera, got undefined");
expect(camera.getPrinterFor(line).print(line, camera)).not.to.throw;
expect(camera.printObject(line)).not.to.throw;
}
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment