Best Python code snippet using responses
mock-firestore.js
Source:mock-firestore.js
1import MockFirebase from 'mock-cloud-firestore';2import { MOCK_USER_ID } from './constants';3import { cloneDeep } from 'lodash';4const fixtureData = {5 __collection__: {6 agents: { __doc__: {} },7 'third-parties': { __doc__: {} },8 users: {9 __doc__: {10 [MOCK_USER_ID]: {11 createdAt: '20 August 2019 at 17:07:06 UTC+8',12 displayName: 'Mock User',13 email: 'user@mock.com',14 __collection__: {15 agents: {16 __doc__: {17 GGRvO9ToyqlucCqrmXdw: {18 name: 'SmartKanban',19 __collection__: {20 boards: {21 __doc__: {22 'b-project': {23 id: 'b-project',24 name: 'Project',25 listIds: [26 'b-project-l-backlog',27 'b-project-l-next',28 'b-project-l-today',29 'b-project-l-doing',30 'b-project-l-done',31 'b-project-l-discarded'32 ],33 isClosed: false,34 isStarred: true,35 domainId: ''36 },37 'b-next': {38 id: 'b-next',39 name: 'Next',40 listIds: [41 'b-next-l-next',42 'b-next-l-doing',43 'b-next-l-today'44 ],45 isClosed: false,46 isStarred: true,47 domainId: ''48 },49 'b-today': {50 id: 'b-today',51 name: 'Today',52 listIds: [53 'b-today-l-today',54 'b-today-l-in-progress',55 'b-today-l-done'56 ],57 isClosed: false,58 isStarred: true,59 domainId: ''60 }61 }62 },63 cards: {64 __doc__: {65 'card-1': {66 id: 'card-1',67 name: 'card 1',68 listId: 'b-project-l-backlog',69 boardId: 'b-project',70 isClosed: false,71 description: ''72 },73 'card-2': {74 id: 'card-2',75 name: 'card 2',76 listId: 'b-project-l-doing',77 boardId: 'b-project',78 isClosed: false,79 description: ''80 },81 'card-3': {82 id: 'card-3',83 name: 'card 3',84 listId: 'b-project-l-today',85 boardId: 'b-project',86 isClosed: false,87 description: ''88 },89 'card-4': {90 id: 'card-4',91 name: 'card 4',92 listId: 'b-project-l-next',93 boardId: 'b-project',94 isClosed: false,95 description: ''96 },97 'card-5': {98 id: 'card-5',99 name: 'card 5',100 listId: 'b-project-l-next',101 boardId: 'b-project',102 isClosed: false,103 description: ''104 },105 'card-6': {106 id: 'card-6',107 name: 'card 6',108 listId: 'b-other-l-next',109 boardId: 'b-other',110 isClosed: false,111 description: ''112 },113 'card-7': {114 id: 'card-7',115 name: 'card 7',116 listId: 'b-project-l-today',117 boardId: 'b-project',118 isClosed: false,119 description: ''120 },121 'card-8': {122 id: 'card-8',123 name: 'card 8',124 listId: 'b-project-l-done',125 boardId: 'b-project',126 isClosed: false,127 description: ''128 },129 'card-9': {130 id: 'card-9',131 name: 'card 9',132 listId: 'b-other-l-done',133 boardId: 'b-other',134 isClosed: false,135 description: ''136 },137 'card-10': {138 id: 'card-10',139 name: 'card 10',140 listId: 'b-project-l-next',141 boardId: 'b-project',142 isClosed: false,143 description: ''144 },145 'card-11': {146 id: 'card-11',147 name: 'card 11',148 listId: 'b-project-l-today',149 boardId: 'b-project',150 isClosed: false,151 description: ''152 },153 'card-12': {154 id: 'card-12',155 name: 'card 12',156 listId: 'b-project-l-doing',157 boardId: 'b-project',158 isClosed: false,159 description: ''160 },161 'card-13': {162 id: 'card-13',163 name: 'card 13',164 listId: 'b-project-l-doing',165 boardId: 'b-project',166 isClosed: false,167 description: ''168 },169 'card-14': {170 id: 'card-14',171 name: 'card 14',172 listId: 'b-project-l-done',173 boardId: 'b-project',174 isClosed: false,175 description: ''176 },177 'card-15': {178 id: 'card-15',179 name: 'card 15',180 listId: 'b-project-l-done',181 boardId: 'b-project',182 isClosed: false,183 description: ''184 },185 'card-16': {186 id: 'card-16',187 name: 'card 16',188 listId: 'b-other-l-next',189 boardId: 'b-other',190 isClosed: false,191 description: ''192 },193 'card-17': {194 id: 'card-17',195 name: 'card 17',196 listId: 'b-other-l-next',197 boardId: 'b-other',198 isClosed: false,199 description: ''200 },201 'card-18': {202 id: 'card-18',203 name: 'card 18',204 listId: 'b-other-l-today',205 boardId: 'b-other',206 isClosed: false,207 description: ''208 },209 'card-19': {210 id: 'card-19',211 name: 'card 19',212 listId: 'b-other-l-today',213 boardId: 'b-other',214 isClosed: false,215 description: ''216 },217 'card-20': {218 id: 'card-20',219 name: 'card 20',220 listId: 'b-other-l-today',221 boardId: 'b-other',222 isClosed: false,223 description: ''224 },225 'card-21': {226 id: 'card-21',227 name: 'card 21',228 listId: 'b-other-l-doing',229 boardId: 'b-other',230 isClosed: false,231 description: ''232 },233 'card-22': {234 id: 'card-22',235 name: 'card 22',236 listId: 'b-other-l-doing',237 boardId: 'b-other',238 isClosed: false,239 description: ''240 },241 'card-23': {242 id: 'card-23',243 name: 'card 23',244 listId: 'b-other-l-doing',245 boardId: 'b-other',246 isClosed: false,247 description: ''248 },249 'card-24': {250 id: 'card-24',251 name: 'card 24',252 listId: 'b-other-l-done',253 boardId: 'b-other',254 isClosed: false,255 description: ''256 },257 'card-25': {258 id: 'card-25',259 name: 'card 25',260 listId: 'b-other-l-done',261 boardId: 'b-other',262 isClosed: false,263 description: ''264 },265 'card-26': {266 id: 'card-26',267 name: 'card 26',268 listId: 'b-project-l-backlog',269 boardId: 'b-project',270 isClosed: false,271 description: ''272 },273 'card-27': {274 id: 'card-27',275 name: 'card 27',276 listId: 'b-project-l-backlog',277 boardId: 'b-project',278 isClosed: false,279 description: ''280 },281 'card-28': {282 id: 'card-28',283 name: 'card 28',284 listId: 'b-other-l-backlog',285 boardId: 'b-other',286 isClosed: false,287 description: ''288 },289 'card-29': {290 id: 'card-29',291 name: 'card 29',292 listId: 'b-other-l-backlog',293 boardId: 'b-other',294 isClosed: false,295 description: ''296 },297 'card-30': {298 id: 'card-30',299 name: 'card 30',300 listId: 'b-other-l-backlog',301 boardId: 'b-other',302 isClosed: false,303 description: ''304 }305 }306 },307 domains: {308 __doc__: {309 WEkAT5DVhTlP24s8Bc0L: {310 name: 'Domain 1',311 description: 'This is a domain',312 boardIds: [313 'qY4mlACYKOVvWKozrL9f',314 'gyU21eTIafag5MkbUjNC'315 ]316 }317 }318 },319 lists: {320 __doc__: {321 // Project board lists322 'b-project-l-backlog': {323 id: 'b-project-l-backlog',324 name: 'Backlog',325 cardIds: ['card-1', 'card-26', 'card-27'],326 boardId: 'b-project',327 isClosed: false328 },329 'b-project-l-next': {330 id: 'b-project-l-next',331 name: 'Next',332 cardIds: ['card-4', 'card-5', 'card-10'],333 boardId: 'b-project',334 isClosed: false335 },336 'b-project-l-today': {337 id: 'b-project-l-today',338 name: 'Today',339 cardIds: ['card-3', 'card-7', 'card-11'],340 boardId: 'b-project',341 isClosed: false342 },343 'b-project-l-doing': {344 id: 'b-project-l-doing',345 name: 'Doing',346 cardIds: ['card-2', 'card-12', 'card-13'],347 boardId: 'b-project',348 isClosed: false349 },350 'b-project-l-done': {351 id: 'b-project-l-done',352 name: 'Done',353 cardIds: ['card-8', 'card-14', 'card-15'],354 boardId: 'b-project',355 isClosed: false356 },357 'b-project-l-discarded': {358 id: 'b-project-l-discarded',359 name: 'Discarded',360 cardIds: [],361 boardId: 'b-project',362 isClosed: false363 },364 // Other project board lists365 'b-other-l-backlog': {366 id: 'b-other-l-backlog',367 name: 'Backlog',368 cardIds: ['card-28', 'card-29', 'card-30'],369 boardId: 'b-project',370 isClosed: false371 },372 'b-other-l-next': {373 id: 'b-other-l-next',374 name: 'Next',375 cardIds: ['card-6', 'card-16', 'card-17'],376 boardId: 'b-other',377 isClosed: false378 },379 'b-other-l-today': {380 id: 'b-other-l-today',381 name: 'Today',382 cardIds: ['card-18', 'card-19', 'card-20'],383 boardId: 'b-other',384 isClosed: false385 },386 'b-other-l-doing': {387 id: 'b-other-l-doing',388 name: 'Doing',389 cardIds: ['card-21', 'card-22', 'card-23'],390 boardId: 'b-other',391 isClosed: false392 },393 'b-other-l-done': {394 id: 'b-other-l-done',395 name: 'Done',396 cardIds: ['card 9', 'card-24', 'card-25'],397 boardId: 'b-other',398 isClosed: false399 },400 'b-other-l-discarded': {401 id: 'b-other-l-discarded',402 name: 'Discarded',403 cardIds: [],404 boardId: 'b-other',405 isClosed: false406 },407 // Next board lists408 'b-next-l-next': {409 id: 'b-next-l-next',410 name: 'Next',411 cardIds: [412 'card-4',413 'card-5',414 'card-6',415 'card-10',416 'card-16',417 'card-17'418 ],419 boardId: 'b-next',420 isClosed: false421 },422 'b-next-l-today': {423 id: 'b-next-l-today',424 name: 'Today',425 cardIds: [426 'card-3',427 'card-7',428 'card-11',429 'card-18',430 'card-19',431 'card-20'432 ],433 boardId: 'b-next',434 isClosed: false435 },436 'b-next-l-doing': {437 id: 'b-next-l-doing',438 name: 'Doing',439 cardIds: [440 'card-2',441 'card-12',442 'card-13',443 'card-21',444 'card-22',445 'card-23'446 ],447 boardId: 'b-next',448 isClosed: false449 },450 'b-next-l-done': {451 id: 'b-next-l-done',452 name: 'Done',453 cardIds: [454 'card-8',455 'card-9',456 'card-14',457 'card-15',458 'card-24',459 'card-25'460 ],461 boardId: 'b-next',462 isClosed: false463 },464 // Today board lists465 'b-today-l-today': {466 id: 'b-today-l-today',467 name: 'Today',468 cardIds: [469 'card-3',470 'card-7',471 'card-11',472 'card-18',473 'card-19'474 ],475 boardId: 'b-today',476 isClosed: false477 },478 'b-today-l-in-progress': {479 id: 'b-today-l-in-progress',480 name: 'In Progress',481 cardIds: ['card-20'],482 boardId: 'b-today',483 isClosed: false484 },485 'b-today-l-done': {486 id: 'b-today-l-done',487 name: 'Done',488 cardIds: [489 'card-8',490 'card-9',491 'card-14',492 'card-15',493 'card-24',494 'card-25'495 ],496 boardId: 'b-today',497 isClosed: false498 }499 }500 }501 }502 }503 }504 },505 entries: { __doc__: {} },506 'third-parties': { __doc__: {} }507 }508 },509 Rwc20oNDgKQ32bwVOOKbPYzndrG3: {510 createdAt: '20 August 2019 at 12:16:11 UTC+8',511 displayName: 'Srdjan Krstic',512 email: 'srdjankrstic@gmail.com',513 __collection__: {514 agents: { __doc__: {} },515 entries: { __doc__: {} },516 'third-parties': { __doc__: {} }517 }518 }519 }520 }521 }522};523var mockFirebase = (function() {524 var _mockFirestore;525 function createMockFirestore() {526 return new MockFirebase(cloneDeep(fixtureData)).firestore();527 }528 return {529 getFirestore: function() {530 if (!_mockFirestore) {531 _mockFirestore = createMockFirestore();532 }533 return _mockFirestore;534 },535 reset: function() {536 _mockFirestore = null;537 }538 };539})();...
PDFWriterTests.js
Source:PDFWriterTests.js
1// Copyright 2020 Breakside Inc.2//3// Licensed under the Breakside Public License, Version 1.0 (the "License");4// you may not use this file except in compliance with the License.5// If a copy of the License was not distributed with this file, you may6// obtain a copy at7//8// http://breakside.io/licenses/LICENSE-1.0.txt9//10// Unless required by applicable law or agreed to in writing, software11// distributed under the License is distributed on an "AS IS" BASIS,12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13// See the License for the specific language governing permissions and14// limitations under the License.15// #import PDFKit16// #import TestKit17'use strict';18JSClass("PDFWriterTests", TKTestSuite, {19 testFormat: function(){20 var writer = PDFWriter.init();21 // Numbers22 TKAssertEquals(writer.format("%n", 0), "0");23 TKAssertEquals(writer.format("%n", 1), "1");24 TKAssertEquals(writer.format("%n", -1), "-1");25 TKAssertEquals(writer.format("%n", 1.2), "1.2");26 TKAssertEquals(writer.format("%n", -1.2), "-1.2");27 TKAssertEquals(writer.format("%n", 1.2345678987654), "1.2345678988");28 TKAssertEquals(writer.format("%n", -1.2345678987654), "-1.2345678988");29 TKAssertEquals(writer.format("%n", 1.2345678901234), "1.2345678901");30 TKAssertEquals(writer.format("%n", -1.2345678901234), "-1.2345678901");31 TKAssertEquals(writer.format("%n", 10000000000000), "9999999999.9999999999");32 TKAssertEquals(writer.format("%n", -10000000000000), "-9999999999.9999999999");33 TKAssertEquals(writer.format("%n", 5.0000000000001), "5");34 TKAssertEquals(writer.format("%n", -5.0000000000001), "-5");35 TKAssertEquals(writer.format("%n", 5.9999999999999), "6");36 TKAssertEquals(writer.format("%n", -5.9999999999999), "-6");37 TKAssertEquals(writer.format("%n", null), "0");38 TKAssertEquals(writer.format("%n", null / null), "0");39 TKAssertEquals(writer.format("%n", undefined), "0");40 TKAssertEquals(writer.format("%n", Infinity), "9999999999.9999999999");41 TKAssertEquals(writer.format("%n", -Infinity), "-9999999999.9999999999");42 // Bools43 TKAssertEquals(writer.format("%b", true), "true");44 TKAssertEquals(writer.format("%b", false), "false");45 TKAssertEquals(writer.format("%b", "asdf"), "false");46 TKAssertEquals(writer.format("%b", 0), "false");47 TKAssertEquals(writer.format("%b", 1), "false");48 TKAssertEquals(writer.format("%b", null), "false");49 TKAssertEquals(writer.format("%b", undefined), "false");50 TKAssertEquals(writer.format("%b", Infinity), "false");51 TKAssertEquals(writer.format("%b", null / null), "false");52 // TODO: Names53 TKAssertEquals(writer.format("%N", PDFName("Test")), "/Test");54 TKAssertEquals(writer.format("%N", PDFName("Hello, World!")), "/Hello,#20World!");55 TKAssertEquals(writer.format("%N", PDFName("\x01\x02\xA0\xFF")), "/#01#02#A0#FF");56 // TODO: regular strings57 // TODO: PDF strings58 },59 testEmptyDocument: function(){60 var stream = PDFWriterTestsStringStream.init();61 var writer = PDFWriter.initWithStream(stream);62 var isClosed = false;63 var doc = PDFDocument();64 writer.writeObject(doc);65 writer.close(function(){66 isClosed = true;67 });68 TKAssert(isClosed);69 var expected = [70 "%PDF-1.7",71 "1 0 obj",72 "<< /Type /Catalog >>",73 "endobj",74 "xref",75 "0 2",76 "0000000000 65535 f\r",77 "0000000009 00000 n\r",78 "trailer",79 "<< /Root 1 0 R /Size 2 >>",80 "startxref",81 "45",82 "%%EOF"83 ];84 TKAssertEquals(stream.string, expected.join("\n"));85 },86 testEmptyPage: function(){87 var stream = PDFWriterTestsStringStream.init();88 var writer = PDFWriter.initWithStream(stream);89 var isClosed = false;90 var doc = PDFDocument();91 var pages = PDFPages();92 var page = PDFPage();93 writer.indirect(pages, page);94 doc.Pages = pages;95 page.Parent = pages;96 pages.Kids = [page];97 pages.Count = 1;98 writer.writeObject(page);99 writer.writeObject(pages);100 writer.writeObject(doc);101 writer.close(function(){102 isClosed = true;103 });104 TKAssert(isClosed);105 var expected = [106 "%PDF-1.7",107 "2 0 obj",108 "<< /Parent 1 0 R /Type /Page >>",109 "endobj",110 "1 0 obj",111 "<< /Kids [ 2 0 R ] /Count 1 /Type /Pages >>",112 "endobj",113 "3 0 obj",114 "<< /Pages 1 0 R /Type /Catalog >>",115 "endobj",116 "xref",117 "0 4",118 "0000000000 65535 f\r",119 "0000000056 00000 n\r",120 "0000000009 00000 n\r",121 "0000000115 00000 n\r",122 "trailer",123 "<< /Root 3 0 R /Size 4 >>",124 "startxref",125 "164",126 "%%EOF"127 ];128 TKAssertEquals(stream.string, expected.join("\n"));129 },130 testStreamObject: function(){131 var stream = PDFWriterTestsStringStream.init();132 var writer = PDFWriter.initWithStream(stream);133 var isClosed = false;134 var doc = PDFDocument();135 var pages = PDFPages();136 var page = PDFPage();137 var content = PDFStream();138 writer.indirect(pages, page, content);139 page.Parent = pages;140 page.Contents = content;141 pages.Kids = [page];142 pages.Count = 1;143 doc.Pages = pages;144 content.Length = writer.createIndirect();145 writer.writeObject(doc);146 writer.writeObject(pages);147 writer.beginStreamObject(content);148 writer.writeStreamData("q 100 200 300 400 re f Q".utf8());149 writer.endStreamObject();150 content.Length.resolvedValue = 24;151 writer.writeObject(content.Length);152 writer.writeObject(page);153 writer.close(function(){154 isClosed = true;155 });156 TKAssert(isClosed);157 var expected = [158 "%PDF-1.7", // 9 9 (5)159 "5 0 obj", // 8 17160 "<< /Pages 1 0 R /Type /Catalog >>", // 34 51161 "endobj", // 7 58 (1)162 "1 0 obj", // 8 66163 "<< /Kids [ 2 0 R ] /Count 1 /Type /Pages >>", // 44 110164 "endobj", // 7 117 (3)165 "3 0 obj", // 8 125166 "<< /Length 4 0 R >>", // 20 145167 "stream", // 7 152168 "q 100 200 300 400 re f Q", // 25 177169 "endstream", // 10 187170 "endobj", // 7 194 (4)171 "4 0 obj", // 8 202172 "24", // 3 205173 "endobj", // 7 212 (2)174 "2 0 obj", // 8 220175 "<< /Parent 1 0 R /Contents 3 0 R /Type /Page >>", // 48 268176 "endobj", // 7 275 (xref)177 "xref",178 "0 6",179 "0000000000 65535 f\r",180 "0000000058 00000 n\r",181 "0000000212 00000 n\r",182 "0000000117 00000 n\r",183 "0000000194 00000 n\r",184 "0000000009 00000 n\r",185 "trailer",186 "<< /Root 5 0 R /Size 6 >>",187 "startxref",188 "275",189 "%%EOF"190 ];191 TKAssertEquals(stream.string, expected.join("\n"));192 },193 testNumber: function(){194 // zero195 var stream = PDFWriterTestsStringStream.init();196 var writer = PDFWriter.initWithStream(stream);197 var isClosed = false;198 var doc = PDFDocument();199 doc.XNumber = 0;200 writer.writeObject(doc);201 writer.close(function(){ isClosed = true; });202 TKAssert(isClosed);203 var expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 0 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "56", "%%EOF"];204 TKAssertEquals(stream.string, expected.join("\n"));205 // Positive Integer206 stream = PDFWriterTestsStringStream.init();207 writer = PDFWriter.initWithStream(stream);208 isClosed = false;209 doc = PDFDocument();210 doc.XNumber = 12;211 writer.writeObject(doc);212 writer.close(function(){ isClosed = true; });213 TKAssert(isClosed);214 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 12 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "57", "%%EOF"];215 TKAssertEquals(stream.string, expected.join("\n"));216 // Negative Integer217 stream = PDFWriterTestsStringStream.init();218 writer = PDFWriter.initWithStream(stream);219 isClosed = false;220 doc = PDFDocument();221 doc.XNumber = -12;222 writer.writeObject(doc);223 writer.close(function(){ isClosed = true; });224 TKAssert(isClosed);225 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber -12 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "58", "%%EOF"];226 TKAssertEquals(stream.string, expected.join("\n"));227 // Positive Real228 stream = PDFWriterTestsStringStream.init();229 writer = PDFWriter.initWithStream(stream);230 isClosed = false;231 doc = PDFDocument();232 doc.XNumber = 12.34;233 writer.writeObject(doc);234 writer.close(function(){ isClosed = true; });235 TKAssert(isClosed);236 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 12.34 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "60", "%%EOF"];237 TKAssertEquals(stream.string, expected.join("\n"));238 // Negative Real239 stream = PDFWriterTestsStringStream.init();240 writer = PDFWriter.initWithStream(stream);241 isClosed = false;242 doc = PDFDocument();243 doc.XNumber = -12.34;244 writer.writeObject(doc);245 writer.close(function(){ isClosed = true; });246 TKAssert(isClosed);247 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber -12.34 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "61", "%%EOF"];248 TKAssertEquals(stream.string, expected.join("\n"));249 // Decimal Rounding (Positive, Up)250 stream = PDFWriterTestsStringStream.init();251 writer = PDFWriter.initWithStream(stream);252 isClosed = false;253 doc = PDFDocument();254 doc.XNumber = 12.345678987654;255 writer.writeObject(doc);256 writer.close(function(){ isClosed = true; });257 TKAssert(isClosed);258 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 12.3456789877 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "68", "%%EOF"];259 TKAssertEquals(stream.string, expected.join("\n"));260 // Decimal Rounding (Positive, Down)261 stream = PDFWriterTestsStringStream.init();262 writer = PDFWriter.initWithStream(stream);263 isClosed = false;264 doc = PDFDocument();265 doc.XNumber = 12.345678912345;266 writer.writeObject(doc);267 writer.close(function(){ isClosed = true; });268 TKAssert(isClosed);269 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 12.3456789123 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "68", "%%EOF"];270 TKAssertEquals(stream.string, expected.join("\n"));271 // Decimal Rounding (Negative, Up)272 stream = PDFWriterTestsStringStream.init();273 writer = PDFWriter.initWithStream(stream);274 isClosed = false;275 doc = PDFDocument();276 doc.XNumber = -12.345678987654;277 writer.writeObject(doc);278 writer.close(function(){ isClosed = true; });279 TKAssert(isClosed);280 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber -12.3456789877 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "69", "%%EOF"];281 TKAssertEquals(stream.string, expected.join("\n"));282 // Decimal Rounding (Negative, Down)283 stream = PDFWriterTestsStringStream.init();284 writer = PDFWriter.initWithStream(stream);285 isClosed = false;286 doc = PDFDocument();287 doc.XNumber = -12.345678912345;288 writer.writeObject(doc);289 writer.close(function(){ isClosed = true; });290 TKAssert(isClosed);291 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber -12.3456789123 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "69", "%%EOF"];292 TKAssertEquals(stream.string, expected.join("\n"));293 // Decimal Rounding (To Zero)294 stream = PDFWriterTestsStringStream.init();295 writer = PDFWriter.initWithStream(stream);296 isClosed = false;297 doc = PDFDocument();298 doc.XNumber = 12.000000000001234;299 writer.writeObject(doc);300 writer.close(function(){ isClosed = true; });301 TKAssert(isClosed);302 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 12 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "57", "%%EOF"];303 TKAssertEquals(stream.string, expected.join("\n"));304 // NaN305 stream = PDFWriterTestsStringStream.init();306 writer = PDFWriter.initWithStream(stream);307 isClosed = false;308 doc = PDFDocument();309 doc.XNumber = null / null;310 writer.writeObject(doc);311 writer.close(function(){ isClosed = true; });312 TKAssert(isClosed);313 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 0 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "56", "%%EOF"];314 TKAssertEquals(stream.string, expected.join("\n"));315 // Infinity316 stream = PDFWriterTestsStringStream.init();317 writer = PDFWriter.initWithStream(stream);318 isClosed = false;319 doc = PDFDocument();320 doc.XNumber = 1 / 0;321 writer.writeObject(doc);322 writer.close(function(){ isClosed = true; });323 TKAssert(isClosed);324 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 9999999999.9999999999 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "76", "%%EOF"];325 TKAssertEquals(stream.string, expected.join("\n"));326 // Max327 stream = PDFWriterTestsStringStream.init();328 writer = PDFWriter.initWithStream(stream);329 isClosed = false;330 doc = PDFDocument();331 doc.XNumber = 1000000000000;332 writer.writeObject(doc);333 writer.close(function(){ isClosed = true; });334 TKAssert(isClosed);335 expected = ["%PDF-1.7", "1 0 obj", "<< /XNumber 9999999999.9999999999 /Type /Catalog >>", "endobj", "xref", "0 2", "0000000000 65535 f\r", "0000000009 00000 n\r", "trailer", "<< /Root 1 0 R /Size 2 >>", "startxref", "76", "%%EOF"];336 TKAssertEquals(stream.string, expected.join("\n"));337 }338});339JSClass("PDFWriterTestsStringStream", PDFWriterStream, {340 string: null,341 init: function(){342 this.string = "";343 },344 write: function(bytes, offset, length){345 for (; offset < length; ++offset){346 this.string += String.fromCharCode(bytes[offset]);347 }348 },349 close: function(callback){350 callback();351 }...
index.js
Source:index.js
1import React from 'react';2import { Switch } from 'react-router-dom';3import { useSelector } from 'react-redux';4import MyRoute from './MyRoute';5import Fotos from '../pages/Fotos';6import Login from '../pages/Login';7import Register from '../pages/Register';8import Page404 from '../pages/Page404';9import Funcao from '../pages/AbaConfiguracoes/Funcao';10import Cargo from '../pages/AbaConfiguracoes/Cargo';11import Congregacao from '../pages/AbaConfiguracoes/Congregacao';12import Classe from '../pages/AbaConfiguracoes/Classe';13import Departamento from '../pages/AbaConfiguracoes/Departamento';14import CadMembro from '../pages/AbaSecretaria/CadMembro';15import ListMembros from '../pages/AbaSecretaria/ListMembros';16import DetailMembro from '../pages/AbaSecretaria/DetailMembro';17import Caixa from '../pages/AbaCaixa/Caixa';18import CaixaEbd from '../pages/AbaEdb/CaixaEbd';19import RelatorioCaixa from '../pages/AbaCaixa/RelatorioCaixa';20import Abatimento from '../pages/AbaCaixa/Abatimento';21import RelatorioAbatimento from '../pages/AbaCaixa/RelatorioAbatimento';22import Dizimo from '../pages/AbaCaixa/Dizimo';23import RelatorioDizimo from '../pages/AbaCaixa/RelatorioDizimo';24import RelatorioDizimoGeral from '../pages/AbaCaixa/RelatorioDizimoGeral';25import CadAluno from '../pages/AbaEdb/CadAluno';26import ListAluno from '../pages/AbaEdb/ListAluno';27import DetailAluno from '../pages/AbaEdb/DetailAluno';28import Chamada from '../pages/AbaEdb/Chamada';29import RelatorioPresencaDiaria from '../pages/AbaEdb/RelatorioPresencaDiaria';30import RelatorioPresencaGeral from '../pages/AbaEdb/RelatorioPresencaGeral';31import PresencaDetalhada from '../pages/AbaEdb/PresencaDetalhada';32import ListaAniversario from '../pages/AbaSecretaria/ListaAniversario';33import EditPass from '../pages/AbaSecretaria/EditPass';34import RelatorioDiario from '../pages/AbaCaixa/RelatorioDiario';35import RelatorioCaixaEbd from '../pages/AbaEdb/RelatorioCaixaEbd';36import Configuracoes from '../pages/AbaConfiguracoes/Configuracoes';37import Ebd from '../pages/AbaEdb/Ebd';38import Secretaria from '../pages/AbaSecretaria/Secretaria';39import Tesoraria from '../pages/AbaCaixa/Tesoraria';40import Home from '../pages/Home';41import NovoVisitante from '../pages/AbaCulto/NovoVisitante';42import ListaVisitantes from '../pages/AbaCulto/ListaVisitantes';43import MediaCaixa from '../pages/AbaCaixa/MediaCaixa';44import Visitante from '../pages/AbaCulto/VIsitante';45import PedidoOracao from '../pages/AbaCulto/PedidoOracao';46import NovoPedido from '../pages/AbaCulto/NovoPedido';47import ListaPedido from '../pages/AbaCulto/ListaPedido';48import RelatorioDizimoDiario from '../pages/AbaCaixa/RelatorioDizimoDiario';49import CadCliente from '../pages/CadCliente';50import Orcamento from '../pages/Orcamento';51import Reserva from '../pages/Reserva';52import PainelPrincipal from '../pages/PainelPrincipal';53import ListaOrcamento from '../pages/ListaOrcamento';54import ListaReservas from '../pages/ListaReservas';55import PainelLimpeza from '../pages/PainelLimpeza';56import DetailReserva from '../pages/DetailReserva';57import ListaCliente from '../pages/ListaClientes';58import Estoque from '../pages/Estoque';59import Consumo from '../pages/Consumo';60import TipoQuarto from '../pages/TipoQuarto';61export default function Routes() {62 const idFuncao = useSelector((state) => state.auth.user.function_id);63 /*64 1 - Admistrador65 2 - Dirigente66 3 - Tesoureiro67 4 - Secretario68 5 - Coordenador69 6 - Tesoureiro EBD70 7 - Professor71 8 - Coordenador Congregacao72 9 - Tesoureiro Congregacao73 */74 return (75 <Switch>76 <MyRoute exact path="/" component={PainelPrincipal} isClosed={false} />77 <MyRoute path="/home" component={Home} isClosed={false} />78 <MyRoute path="/cadCliente/:id" component={CadCliente} isClosed={false} />79 <MyRoute path="/cadCliente" component={CadCliente} isClosed={false} />80 <MyRoute path="/orcamento/:id" component={Orcamento} isClosed={false} />81 <MyRoute path="/orcamento" component={Orcamento} isClosed={false} />82 <MyRoute83 path="/listaOrcamento"84 component={ListaOrcamento}85 isClosed={false}86 />87 <MyRoute path="/tipoQuarto/:id" component={TipoQuarto} isClosed={false} />88 <MyRoute path="/tipoQuarto" component={TipoQuarto} isClosed={false} />89 <MyRoute90 path="/listaReservas"91 component={ListaReservas}92 isClosed={false}93 />94 <MyRoute95 path="/painelLimpeza"96 component={PainelLimpeza}97 isClosed={false}98 />99 <MyRoute path="/reserva" component={Reserva} isClosed={false} />100 <MyRoute101 path="/detailReserva/:id"102 component={DetailReserva}103 isClosed={false}104 />105 <MyRoute106 path="/listaClientes"107 component={ListaCliente}108 isClosed={false}109 />110 <MyRoute111 path="/novoVisitante"112 component={NovoVisitante}113 isClosed={false}114 />115 <MyRoute116 path="/listaVisitantes"117 component={ListaVisitantes}118 isClosed={false}119 />120 <MyRoute path="/estoque" component={Estoque} isClosed={false} />121 <MyRoute path="/consumo" component={Consumo} isClosed={false} />122 <MyRoute123 path="/dizimoDiario"124 component={RelatorioDizimoDiario}125 isClosed={false}126 />127 <MyRoute path="/visitante" component={Visitante} isClosed={false} />128 <MyRoute path="/pedidoOracao" component={PedidoOracao} isClosed={false} />129 <MyRoute path="/novoPedido" component={NovoPedido} isClosed={false} />130 <MyRoute path="/listaPedido" component={ListaPedido} isClosed={false} />131 <MyRoute132 path="/configuracoes/"133 idFuncao={idFuncao}134 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}135 component={Configuracoes}136 isClosed137 />138 <MyRoute139 path="/ebd/"140 idFuncao={idFuncao}141 usuarioPermitido={[142 { id: 1 },143 { id: 2 },144 { id: 5 },145 { id: 6 },146 { id: 7 },147 { id: 8 },148 ]}149 component={Ebd}150 isClosed151 />152 <MyRoute153 path="/secretaria/"154 idFuncao={idFuncao}155 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}156 component={Secretaria}157 isClosed158 />159 <MyRoute160 path="/tesoraria/"161 idFuncao={idFuncao}162 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }]}163 component={Tesoraria}164 isClosed165 />166 <MyRoute path="/fotos/:id" component={Fotos} isClosed />167 <MyRoute path="/login/" component={Login} isClosed={false} />168 <MyRoute path="/register/" component={Register} isClosed={false} />169 <MyRoute170 path="/funcao/:id/edit"171 component={Funcao}172 idFuncao={idFuncao}173 usuarioPermitido={[{ id: 1 }]}174 isClosed175 />176 <MyRoute177 path="/funcao/"178 component={Funcao}179 idFuncao={idFuncao}180 usuarioPermitido={[{ id: 1 }]}181 isClosed182 />183 <MyRoute184 path="/cargo/:id/edit"185 component={Cargo}186 idFuncao={idFuncao}187 usuarioPermitido={[{ id: 1 }, { id: 4 }]}188 isClosed189 />190 <MyRoute191 path="/cargo/"192 component={Cargo}193 idFuncao={idFuncao}194 usuarioPermitido={[{ id: 1 }, { id: 4 }]}195 isClosed196 />197 <MyRoute198 path="/classe/:id/edit"199 component={Classe}200 idFuncao={idFuncao}201 usuarioPermitido={[{ id: 1 }, { id: 5 }, { id: 7 }]}202 isClosed203 />204 <MyRoute205 path="/classe/"206 component={Classe}207 idFuncao={idFuncao}208 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 5 }]}209 isClosed210 />211 <MyRoute212 path="/cadMembro/:id/edit"213 component={CadMembro}214 idFuncao={idFuncao}215 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}216 isClosed217 />218 <MyRoute219 path="/cadMembro/"220 component={CadMembro}221 idFuncao={idFuncao}222 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}223 isClosed224 />225 <MyRoute226 path="/editPass/"227 component={EditPass}228 idFuncao={idFuncao}229 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}230 isClosed231 />232 <MyRoute233 path="/departamento/:id/edit"234 component={Departamento}235 idFuncao={idFuncao}236 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}237 isClosed238 />239 <MyRoute240 path="/departamento/"241 component={Departamento}242 idFuncao={idFuncao}243 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}244 isClosed245 />246 <MyRoute247 path="/congregacao/:id/edit"248 component={Congregacao}249 idFuncao={idFuncao}250 usuarioPermitido={[{ id: 1 }, { id: 4 }]}251 isClosed252 />253 <MyRoute254 path="/congregacao/"255 component={Congregacao}256 idFuncao={idFuncao}257 usuarioPermitido={[{ id: 1 }, { id: 4 }]}258 isClosed259 />260 <MyRoute261 path="/listMembros/"262 component={ListMembros}263 idFuncao={idFuncao}264 usuarioPermitido={[{ id: 1 }, { id: 4 }]}265 isClosed266 />267 <MyRoute268 path="/listAniversario/"269 component={ListaAniversario}270 idFuncao={idFuncao}271 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 4 }]}272 isClosed273 />274 <MyRoute275 path="/detailMembro/:id"276 component={DetailMembro}277 isClosed={false}278 />279 <MyRoute280 path="/relatorioDiario"281 component={RelatorioDiario}282 idFuncao={idFuncao}283 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }, { id: 9 }]}284 isClosed285 />286 <MyRoute287 path="/caixa/:id/edit"288 component={Caixa}289 idFuncao={idFuncao}290 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }, { id: 9 }]}291 isClosed292 />293 <MyRoute294 path="/caixa/"295 component={Caixa}296 idFuncao={idFuncao}297 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }, { id: 9 }]}298 isClosed299 />300 <MyRoute301 path="/caixaEbd/:id/edit"302 component={CaixaEbd}303 idFuncao={idFuncao}304 usuarioPermitido={[305 { id: 1 },306 { id: 2 },307 { id: 5 },308 { id: 6 },309 { id: 8 },310 ]}311 isClosed312 />313 <MyRoute314 path="/caixaEbd/"315 component={CaixaEbd}316 idFuncao={idFuncao}317 usuarioPermitido={[318 { id: 1 },319 { id: 2 },320 { id: 5 },321 { id: 6 },322 { id: 8 },323 ]}324 isClosed325 />326 <MyRoute327 path="/relatorioCaixaEbd/"328 component={RelatorioCaixaEbd}329 idFuncao={idFuncao}330 usuarioPermitido={[331 { id: 1 },332 { id: 2 },333 { id: 5 },334 { id: 6 },335 { id: 8 },336 ]}337 isClosed338 />339 <MyRoute340 path="/abatimento/:id/edit"341 component={Abatimento}342 idFuncao={idFuncao}343 usuarioPermitido={[{ id: 1 }, { id: 3 }]}344 isClosed345 />346 <MyRoute347 path="/abatimento/"348 component={Abatimento}349 idFuncao={idFuncao}350 usuarioPermitido={[{ id: 1 }, { id: 3 }]}351 isClosed352 />353 <MyRoute354 path="/dizimo/:id/edit"355 component={Dizimo}356 idFuncao={idFuncao}357 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }, { id: 9 }]}358 isClosed359 />360 <MyRoute361 path="/dizimo/"362 component={Dizimo}363 idFuncao={idFuncao}364 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }, { id: 9 }]}365 isClosed366 />367 <MyRoute368 path="/relatorioCaixa/"369 component={RelatorioCaixa}370 idFuncao={idFuncao}371 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }, { id: 9 }]}372 isClosed373 />374 <MyRoute375 path="/relatorioDizimo/"376 component={RelatorioDizimo}377 idFuncao={idFuncao}378 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }]}379 isClosed380 />381 <MyRoute382 path="/mediaCaixa/"383 component={MediaCaixa}384 idFuncao={idFuncao}385 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }]}386 isClosed387 />388 <MyRoute389 path="/relatorioDizimoGeral/"390 component={RelatorioDizimoGeral}391 idFuncao={idFuncao}392 usuarioPermitido={[{ id: 1 }, { id: 2 }, { id: 3 }]}393 isClosed394 />395 <MyRoute396 path="/relatorioAbatimento/"397 component={RelatorioAbatimento}398 idFuncao={idFuncao}399 usuarioPermitido={[{ id: 1 }, { id: 3 }]}400 isClosed401 />402 <MyRoute403 path="/cadAluno/:id/edit"404 component={CadAluno}405 idFuncao={idFuncao}406 usuarioPermitido={[{ id: 1 }, { id: 5 }]}407 isClosed408 />409 <MyRoute410 path="/cadAluno/"411 component={CadAluno}412 idFuncao={idFuncao}413 usuarioPermitido={[{ id: 1 }, { id: 5 }]}414 isClosed415 />416 <MyRoute417 path="/listAluno/"418 component={ListAluno}419 idFuncao={idFuncao}420 usuarioPermitido={[{ id: 1 }, { id: 5 }]}421 isClosed422 />423 <MyRoute424 path="/chamada/"425 component={Chamada}426 idFuncao={idFuncao}427 usuarioPermitido={[{ id: 1 }, { id: 5 }, { id: 7 }]}428 isClosed429 />430 <MyRoute431 path="/detailAluno/:id"432 component={DetailAluno}433 idFuncao={idFuncao}434 usuarioPermitido={[{ id: 1 }, { id: 5 }]}435 isClosed436 />437 <MyRoute438 path="/PresencaDetalhada/"439 component={PresencaDetalhada}440 idFuncao={idFuncao}441 usuarioPermitido={[{ id: 1 }, { id: 5 }]}442 isClosed443 />444 <MyRoute445 path="/relatorioPresencaDiaria/"446 component={RelatorioPresencaDiaria}447 idFuncao={idFuncao}448 usuarioPermitido={[{ id: 1 }, { id: 5 }, { id: 7 }]}449 isClosed450 />451 <MyRoute452 path="/relatorioPresencaGeral/"453 component={RelatorioPresencaGeral}454 idFuncao={idFuncao}455 usuarioPermitido={[{ id: 1 }, { id: 5 }]}456 isClosed457 />458 <MyRoute path="*" component={Page404} />459 </Switch>460 );...
csg-paths.js
Source:csg-paths.js
1import test from 'ava'2import {CSG} from '../csg'3import {OBJ} from './helpers/obj-store'4import {assertSameGeometry} from './helpers/asserts'5// Testing common shape generation can only be done by comparing6// with previously human validated shapes. It would be trivially7// rewriting the generation code to test it with code instead.8function isValid (t, name, observed) {9 const expected = OBJ.loadPrevious('csg-shapes.' + name, observed)10 assertSameGeometry(t, observed, expected)11}12test('CSG.Path2D constructor creates an empty path', t => {13 let p1 = new CSG.Path2D()14 t.is(typeof p1, 'object')15 t.false(p1.isClosed())16 t.is(p1.getPoints().length,0)17// make sure methods work on empty paths18 let p2 = new CSG.Path2D()19 let p3 = p1.concat(p2)20 t.false(p3.isClosed())21 t.is(p3.getPoints().length,0)22 let matrix = CSG.Matrix4x4.rotationX(90)23 p3 = p2.transform(matrix)24 t.false(p3.isClosed())25 t.is(p3.getPoints().length,0)26 p3 = p2.appendPoint([1,1])27 t.false(p3.isClosed())28 t.is(p3.getPoints().length,1)29 t.false(p2.isClosed())30 t.is(p2.getPoints().length,0)31 p3 = p2.appendPoints(p1.getPoints())32 t.false(p3.isClosed())33 t.is(p3.getPoints().length,0)34// test that close is possible35 let p4 = p3.close()36 t.true(p4.isClosed())37 t.is(p4.getPoints().length,0)38})39test('CSG.Path2D.arc() creates correct paths', t => {40// test default options41 let a1 = CSG.Path2D.arc()42 let p1 = a1.getPoints()43 t.false(a1.isClosed())44 t.is(p1.length,34)45 t.deepEqual(p1[0],new CSG.Vector2D([1,0]))46// test center47 let a2 = CSG.Path2D.arc({center: [5,5]})48 let p2 = a2.getPoints()49 t.false(a2.isClosed())50 t.is(p2.length,34)51 t.deepEqual(p2[0],new CSG.Vector2D([6,5]))52// test radius (with center)53 let a3 = CSG.Path2D.arc({center: [5,5],radius: 10})54 let p3 = a3.getPoints()55 t.false(a3.isClosed())56 t.is(p3.length,34)57 t.deepEqual(p3[0],new CSG.Vector2D([15,5]))58// test start angle (with radius)59 let a4 = CSG.Path2D.arc({radius: 10,startangle: 180})60 let p4 = a4.getPoints()61 t.false(a4.isClosed())62 t.is(p4.length,18)63 //t.deepEqual(p4[0],new CSG.Vector2D([10,0]))64// test end angle (with center)65 let a5 = CSG.Path2D.arc({center: [5,5],endangle: 90})66 let p5 = a5.getPoints()67 t.false(a5.isClosed())68 t.is(p5.length,10)69 t.deepEqual(p5[0],new CSG.Vector2D([6,5]))70// test resolution (with radius)71 let a6 = CSG.Path2D.arc({radius: 10,resolution: 144})72 let p6 = a6.getPoints()73 t.false(a6.isClosed())74 t.is(p6.length,146)75 t.deepEqual(p6[0],new CSG.Vector2D([10,0]))76// test make tangent (with radius)77 let a7 = CSG.Path2D.arc({radius: 10,maketangent: true})78 let p7 = a7.getPoints()79 t.false(a7.isClosed())80 t.is(p7.length,36)81 t.deepEqual(p7[0],new CSG.Vector2D([10,0]))82})83test('CSG.Path2D creates CAG from paths', t => {84 let p1 = new CSG.Path2D([[27.5,-22.96875]],false);85 p1 = p1.appendPoint([27.5,-3.28125]);86 p1 = p1.appendArc([12.5,-22.96875],{xradius: 15,yradius: -19.6875,xaxisrotation: 0,clockwise: false,large: false});87 p1 = p1.close();88 let cag01 = p1.innerToCAG();89 t.is(typeof cag01, 'object')90 let p2 = new CSG.Path2D([[27.5,-22.96875]],false);91 p2 = p2.appendPoint([27.5,-3.28125]);92 p2 = p2.appendArc([12.5,-22.96875],{xradius: 15,yradius: -19.6875,xaxisrotation: 0,clockwise: false,large: true});93 p2 = p2.close();94 let cag02 = p2.innerToCAG();95 t.is(typeof cag02, 'object')96 let p3 = new CSG.Path2D([[27.5,-22.96875]],false);97 p3 = p3.appendPoint([27.5,-3.28125]);98 p3 = p3.appendArc([12.5,-22.96875],{xradius: 15,yradius: -19.6875,xaxisrotation: 0,clockwise: true,large: true});99 p3 = p3.close();100 let cag03 = p3.innerToCAG();101 t.is(typeof cag03, 'object')102 let p4 = new CSG.Path2D([[27.5,-22.96875]],false);103 p4 = p4.appendPoint([27.5,-3.28125]);104 p4 = p4.appendArc([12.5,-22.96875],{xradius: 15,yradius: -19.6875,xaxisrotation: 0,clockwise: true,large: false});105 p4 = p4.close();106 let cag04 = p4.innerToCAG();107 t.is(typeof cag04, 'object')108 let p5 = new CSG.Path2D([[10,-20]],false);109 p5 = p5.appendBezier([[10,-10],[25,-10],[25,-20]]);110 p5 = p5.appendBezier([[25,-30],[40,-30],[40,-20]]);111 let cag05 = p5.expandToCAG(0.05,CSG.defaultResolution2D);112 t.is(typeof cag05, 'object')113})114test('CSG.Path2D closed cw square turns cw', t => {115 let path = new CSG.Path2D([[0, 0]], false).appendPoint([1, 0]).appendPoint([1, 1]).appendPoint([0, 1]).close();116 t.deepEqual(path.getTurn(), 'clockwise');117})118test('CSG.Path2D unclosed cw triangle turns cw', t => {119 let path = new CSG.Path2D([[0, 0]], false).appendPoint([1, 0]).appendPoint([0, 1]);120 t.deepEqual(path.getTurn(), 'clockwise');121})122test('CSG.Path2D closed ccw square is ccw', t => {123 let path = new CSG.Path2D([[0, 0]], false).appendPoint([0, 1]).appendPoint([1, 1]).appendPoint([1, 0]).close();124 t.deepEqual(path.getTurn(), 'counter-clockwise');125})126test('CSG.Path2D unit straight path area is straight', t => {127 let path = new CSG.Path2D([[0, 0]], false).appendPoint([0, 1]);128 t.deepEqual(path.getTurn(), 'straight');...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!