From 61bd4805696ddf824702824a2de25eef4741b14d Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 15 Nov 2024 01:42:07 +0200 Subject: [PATCH 001/118] upgrade to nudged 2.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0dd78149..9d90c064 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "affineplane": "^2.18.0", "component-emitter": "^1.3.0", "loadimages": "^1.0.0", - "nudged": "^2.0.0", + "nudged": "^2.1.1", "to-px": "^1.1.0" }, "devDependencies": { From 42e0f1bfe25c67dd9c1bb4662d30266a51b4fcf2 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 15 Nov 2024 01:48:31 +0200 Subject: [PATCH 002/118] upgrade dev-deps: async, css-loader, ip --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9d90c064..f7ae8014 100644 --- a/package.json +++ b/package.json @@ -39,12 +39,12 @@ "to-px": "^1.1.0" }, "devDependencies": { - "async": "^3.2.5", - "css-loader": "^6.8.1", + "async": "^3.2.6", + "css-loader": "^6.11.0", "ejs-loader": "^0.5.0", "finalhandler": "^1.2.0", "genversion": "^3.0.2", - "ip": "^1.1.5", + "ip": "^1.1.9", "path-browserify": "^1.0.1", "process": "^0.11.10", "qrcode-terminal": "^0.12.0", From 98c1d89712aa230523962a43aea5a2149524afaa Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 15 Nov 2024 01:49:33 +0200 Subject: [PATCH 003/118] upgrade to affineplane 2.19.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f7ae8014..f942cf74 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "license": "MIT", "dependencies": { - "affineplane": "^2.18.0", + "affineplane": "^2.19.0", "component-emitter": "^1.3.0", "loadimages": "^1.0.0", "nudged": "^2.1.1", From 190f03cc48cce9b6433d9bbff0d0b30a65b82496 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 15 Nov 2024 02:16:51 +0200 Subject: [PATCH 004/118] upgrade dev-deps: webpack, css-loader, style-loader --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f942cf74..b9d110e8 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "devDependencies": { "async": "^3.2.6", - "css-loader": "^6.11.0", + "css-loader": "^7.1.2", "ejs-loader": "^0.5.0", "finalhandler": "^1.2.0", "genversion": "^3.0.2", @@ -53,9 +53,9 @@ "serve-static": "^1.15.0", "standard": "^17.1.0", "stream-browserify": "^3.0.0", - "style-loader": "^3.3.3", "tape": "^5.7.2", - "webpack": "^5.89.0", + "style-loader": "^4.0.0", + "webpack": "^5.96.1", "webpack-cli": "^5.1.4", "webpack-livereload-plugin": "^3.0.2", "yamdog": "^2.1.0" From 818c5ce63cc723754c4a977bf0c6976e8a95e116 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 15 Nov 2024 02:18:09 +0200 Subject: [PATCH 005/118] upgrade dev-deps: semver, standard, tape --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b9d110e8..a6bb24e7 100644 --- a/package.json +++ b/package.json @@ -48,13 +48,13 @@ "path-browserify": "^1.0.1", "process": "^0.11.10", "qrcode-terminal": "^0.12.0", - "semver": "^7.5.4", + "semver": "^7.6.3", "serve-index": "^1.9.1", "serve-static": "^1.15.0", - "standard": "^17.1.0", + "standard": "^17.1.2", "stream-browserify": "^3.0.0", - "tape": "^5.7.2", "style-loader": "^4.0.0", + "tape": "^5.9.0", "webpack": "^5.96.1", "webpack-cli": "^5.1.4", "webpack-livereload-plugin": "^3.0.2", From 94d902ea12efbd982e73347f2e5032b482426e4e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 15 Nov 2024 02:19:00 +0200 Subject: [PATCH 006/118] upgrade dev-deps: finalhandler, ip, serve-static --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index a6bb24e7..082016fb 100644 --- a/package.json +++ b/package.json @@ -42,15 +42,15 @@ "async": "^3.2.6", "css-loader": "^7.1.2", "ejs-loader": "^0.5.0", - "finalhandler": "^1.2.0", "genversion": "^3.0.2", - "ip": "^1.1.9", + "finalhandler": "^1.3.1", + "ip": "^2.0.1", "path-browserify": "^1.0.1", "process": "^0.11.10", "qrcode-terminal": "^0.12.0", "semver": "^7.6.3", "serve-index": "^1.9.1", - "serve-static": "^1.15.0", + "serve-static": "^1.16.2", "standard": "^17.1.2", "stream-browserify": "^3.0.0", "style-loader": "^4.0.0", From 34809e4c07fbdd36a8d7b37b0415fa57a76aa115 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 15 Nov 2024 02:19:14 +0200 Subject: [PATCH 007/118] upgrade dev-deps: genversion --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 082016fb..6a5a9dc8 100644 --- a/package.json +++ b/package.json @@ -42,8 +42,8 @@ "async": "^3.2.6", "css-loader": "^7.1.2", "ejs-loader": "^0.5.0", - "genversion": "^3.0.2", "finalhandler": "^1.3.1", + "genversion": "^3.2.0", "ip": "^2.0.1", "path-browserify": "^1.0.1", "process": "^0.11.10", From 88db7f9ad15825f9bb88c956b81b976e754065b4 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 9 Dec 2024 18:15:29 +0200 Subject: [PATCH 008/118] upgrade dev-dep: webpack --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6a5a9dc8..e5ee2b29 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "stream-browserify": "^3.0.0", "style-loader": "^4.0.0", "tape": "^5.9.0", - "webpack": "^5.96.1", + "webpack": "^5.97.1", "webpack-cli": "^5.1.4", "webpack-livereload-plugin": "^3.0.2", "yamdog": "^2.1.0" From e1b281fb1ab46c74b748424570ec993f9d5afd0b Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 9 Dec 2024 18:16:20 +0200 Subject: [PATCH 009/118] refactor static example server to use const --- docs/examples/server.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/examples/server.js b/docs/examples/server.js index 6aa908bc..d6e6ab59 100644 --- a/docs/examples/server.js +++ b/docs/examples/server.js @@ -1,3 +1,4 @@ +// Static web server for hosting examples locally. // // Start a static file server and output the root URL as a QR code. // @@ -11,28 +12,28 @@ // Static File Server // https://stackoverflow.com/a/24575241/638546 -var PORT = 8000 +const PORT = 8000 -var path = require('path') -var http = require('http') -var finalhandler = require('finalhandler') -var serveIndex = require('serve-index') -var serveStatic = require('serve-static') +const path = require('path') +const http = require('http') +const finalhandler = require('finalhandler') +const serveIndex = require('serve-index') +const serveStatic = require('serve-static') -var ip = require('ip') -var qrcode = require('qrcode-terminal') +const ip = require('ip') +const qrcode = require('qrcode-terminal') -var index = serveIndex(__dirname, { +const index = serveIndex(__dirname, { icons: true, filter: function (fname) { return fname !== 'server.js' && fname !== 'assets' } }) -var serveExamples = serveStatic(__dirname) -var serveBundle = serveStatic(path.resolve(__dirname, '../../dist')) +const serveExamples = serveStatic(__dirname) +const serveBundle = serveStatic(path.resolve(__dirname, '../../dist')) -var server = http.createServer(function (req, res) { - var done = finalhandler(req, res) +const server = http.createServer(function (req, res) { + const done = finalhandler(req, res) serveExamples(req, res, function (err) { if (err) return done(err) @@ -46,7 +47,7 @@ var server = http.createServer(function (req, res) { }) // Output a URL to the server -var url = 'http://' + ip.address() + ':' + PORT +const url = 'http://' + ip.address() + ':' + PORT qrcode.generate(url) console.log(url) From ac3170497e6a344716d7faee8659876524ae4b4b Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 9 Dec 2024 18:37:45 +0200 Subject: [PATCH 010/118] replace old dev-dep ip by a stack overflow snippet --- docs/examples/server.js | 26 ++++++++++++++++++++++---- package.json | 1 - 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/docs/examples/server.js b/docs/examples/server.js index d6e6ab59..931ae6ef 100644 --- a/docs/examples/server.js +++ b/docs/examples/server.js @@ -5,8 +5,6 @@ // Resources: // Print QR code in terminal // https://www.npmjs.com/package/qrcode-terminal -// Get your IP address -// https://www.npmjs.com/package/ip // Serve directory index // https://github.com/expressjs/serve-index // Static File Server @@ -16,13 +14,33 @@ const PORT = 8000 const path = require('path') const http = require('http') +const os = require('os') const finalhandler = require('finalhandler') const serveIndex = require('serve-index') const serveStatic = require('serve-static') -const ip = require('ip') const qrcode = require('qrcode-terminal') +const getIpAddress = () => { + // Return current IP address as a string. + // See: https://stackoverflow.com/a/8440736/638546 + const nets = os.networkInterfaces() + const results = Object.keys(nets).reduce((acc, netName) => { + nets[netName].forEach((entry) => { + const isPreNode18 = typeof entry.family === 'string' + const familyV4 = isPreNode18 ? 'IPv4' : 4 + const isExternal = !entry.internal + + if (entry.family === familyV4 && isExternal) { + acc.push(entry.address) + } + }) + return acc + }, []) + // Pick first + return results[0] +} + const index = serveIndex(__dirname, { icons: true, filter: function (fname) { @@ -47,7 +65,7 @@ const server = http.createServer(function (req, res) { }) // Output a URL to the server -const url = 'http://' + ip.address() + ':' + PORT +const url = 'http://' + getIpAddress() + ':' + PORT qrcode.generate(url) console.log(url) diff --git a/package.json b/package.json index e5ee2b29..9906a45d 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "ejs-loader": "^0.5.0", "finalhandler": "^1.3.1", "genversion": "^3.2.0", - "ip": "^2.0.1", "path-browserify": "^1.0.1", "process": "^0.11.10", "qrcode-terminal": "^0.12.0", From c10f90a953bc7f76227c32036b1f61205d14f247 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 9 Dec 2024 18:39:23 +0200 Subject: [PATCH 011/118] add ctrl-c hint to static example server --- docs/examples/server.js | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/examples/server.js b/docs/examples/server.js index 931ae6ef..ef2df5e9 100644 --- a/docs/examples/server.js +++ b/docs/examples/server.js @@ -68,5 +68,6 @@ const server = http.createServer(function (req, res) { const url = 'http://' + getIpAddress() + ':' + PORT qrcode.generate(url) console.log(url) +console.log('Press CTRL+C to stop and quit.') server.listen(PORT) From ee8c767b43738af3028c225f55a482235bb03eb8 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 9 Dec 2024 19:51:32 +0200 Subject: [PATCH 012/118] setup github actions ci --- .github/workflows/tapspace-ci.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/tapspace-ci.yml diff --git a/.github/workflows/tapspace-ci.yml b/.github/workflows/tapspace-ci.yml new file mode 100644 index 00000000..c72c35fa --- /dev/null +++ b/.github/workflows/tapspace-ci.yml @@ -0,0 +1,21 @@ +name: Tapspace.js CI +run-name: tapspace test run by ${{ github.actor }} + +on: [push] + +jobs: + tapspace-lint-test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18, 20, 22] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run lint From a7b94d6dffda65dd61a413c811d2b94cba1fa8cd Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 11 Dec 2024 13:45:00 +0200 Subject: [PATCH 013/118] install new dev-dep puppeteer and init a headless test script --- package.json | 1 + test/headless.test.mjs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 test/headless.test.mjs diff --git a/package.json b/package.json index 9906a45d..492864eb 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "genversion": "^3.2.0", "path-browserify": "^1.0.1", "process": "^0.11.10", + "puppeteer": "^23.10.2", "qrcode-terminal": "^0.12.0", "semver": "^7.6.3", "serve-index": "^1.9.1", diff --git a/test/headless.test.mjs b/test/headless.test.mjs new file mode 100644 index 00000000..7bfa631f --- /dev/null +++ b/test/headless.test.mjs @@ -0,0 +1,17 @@ +import puppeteer from 'puppeteer' +import { join as pathjoin } from 'path' + +// Launch the browser and open a new blank page. +const browser = await puppeteer.launch() +const page = await browser.newPage() + +// Navigate the page to a URL. +await page.goto(`file:${ pathjoin(import.meta.dirname, 'browser.html') }`) + +// Set screen size. +await page.setViewport({ width: 1024, height: 768 }) + +console.log('Hello from puppeteer app') + +// Exit the test page and close the browser. +await browser.close() From 9827c76f62b3d45eb4f7cfd657a3480ef97ada37 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 11 Dec 2024 15:26:39 +0200 Subject: [PATCH 014/118] breaking: remove dep to-px thus setSize and resizeTo take only numbers --- lib/components/FrameComponent/resizeTo.js | 4 +--- lib/components/FrameComponent/setSize.js | 20 ++++++++------------ package.json | 3 +-- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/components/FrameComponent/resizeTo.js b/lib/components/FrameComponent/resizeTo.js index 6df1a488..02ab69da 100644 --- a/lib/components/FrameComponent/resizeTo.js +++ b/lib/components/FrameComponent/resizeTo.js @@ -25,9 +25,7 @@ module.exports = function (newSize, pivot) { // Parameters: // newSize // a {w,h}, a {width,height}, or a Size. - // .. If {w,h} or {width,height} format is used, the dimensions can be - // .. either number of pixels or CSS length strings. Note that if the - // .. component is not yet in DOM, relative length units might not work. + // .. The dimensions must be numbers. CSS length strings are not supported. // pivot // optional Point, default is the transform origin. // diff --git a/lib/components/FrameComponent/setSize.js b/lib/components/FrameComponent/setSize.js index 01a4a68d..43be8cca 100644 --- a/lib/components/FrameComponent/setSize.js +++ b/lib/components/FrameComponent/setSize.js @@ -1,5 +1,3 @@ -const toPx = require('to-px') - module.exports = function (newSize, options) { // @FrameComponent:setSize(newSize) // @@ -13,9 +11,8 @@ module.exports = function (newSize, options) { // Parameters: // newSize // a {w,h}, a {width,height}, or a Size. - // .. If {w,h} or {width,height} format is used, the dimensions can be - // .. either number of pixels or CSS length strings. Note that if the - // .. component is not yet in DOM, relative length units might not work. + // .. Note that the dimensions must be numbers. + // ...CSS length strings are not supported. // // Alternative parameters: // width @@ -63,14 +60,13 @@ module.exports = function (newSize, options) { } else { throw new Error('Invalid height: ' + newSize.height) } - } - // Allow and convert CSS strings to pixel numbers. - if (typeof wPx === 'string') { - wPx = toPx(wPx) - } - if (typeof hPx === 'string') { - hPx = toPx(hPx) + if (typeof wPx !== 'number') { + throw new Error('Invalid width: ' + wPx) + } + if (typeof hPx !== 'number') { + throw new Error('Invalid height: ' + hPx) + } } this.size = { w: wPx, h: hPx, d: 0 } diff --git a/package.json b/package.json index 492864eb..500d2c37 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,7 @@ "affineplane": "^2.19.0", "component-emitter": "^1.3.0", "loadimages": "^1.0.0", - "nudged": "^2.1.1", - "to-px": "^1.1.0" + "nudged": "^2.1.1" }, "devDependencies": { "async": "^3.2.6", From 66d618539fbecacfaa88f1070ebfe6fa818d3ddd Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 12 Dec 2024 02:16:20 +0200 Subject: [PATCH 015/118] install dev-dependency: tap-parser --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 500d2c37..d3743a44 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "standard": "^17.1.2", "stream-browserify": "^3.0.0", "style-loader": "^4.0.0", + "tap-parser": "^18.0.0", "tape": "^5.9.0", "webpack": "^5.97.1", "webpack-cli": "^5.1.4", From d2496b43d1bbc0cc3e30a64339392edea612717c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 12 Dec 2024 02:17:58 +0200 Subject: [PATCH 016/118] hacky puppeteer tape test runner --- test/browser.html | 5 ++-- test/headless.html | 23 +++++++++++++++ test/headless.test.mjs | 65 +++++++++++++++++++++++++++++++++++++++--- test/index.test.js | 5 +++- 4 files changed, 91 insertions(+), 7 deletions(-) create mode 100644 test/headless.html diff --git a/test/browser.html b/test/browser.html index 31ffb876..b6f8d18e 100644 --- a/test/browser.html +++ b/test/browser.html @@ -1,6 +1,6 @@ - - + + @@ -14,6 +14,7 @@ background: gray; } +
diff --git a/test/headless.html b/test/headless.html new file mode 100644 index 00000000..d51b1d4d --- /dev/null +++ b/test/headless.html @@ -0,0 +1,23 @@ + + + + + + Tapspace Test + + + + +
+
+ + + diff --git a/test/headless.test.mjs b/test/headless.test.mjs index 7bfa631f..9b64ee2a 100644 --- a/test/headless.test.mjs +++ b/test/headless.test.mjs @@ -1,17 +1,74 @@ import puppeteer from 'puppeteer' import { join as pathjoin } from 'path' +import { Parser } from 'tap-parser' +import { Readable } from 'stream' + +class TextStream extends Readable { + constructor(options) { + super(options) + } + + _read(size) { + // No-op + } + + write(data) { + this.push(data) + } + + end() { + this.push(null) + } +} // Launch the browser and open a new blank page. const browser = await puppeteer.launch() const page = await browser.newPage() +// Capture console output +const consoleStream = new TextStream() +// page.on('console', msg => console.log('PAGE LOG:', msg.text())) +page.on('console', msg => { + const str = msg.text() + '\n' + consoleStream.write(str) +}) + +const tapParser = new Parser() +consoleStream.pipe(tapParser) + +// tapParser.on('line', (line) => { +// console.log(line) +// }) + +tapParser.on('complete', async (results) => { + console.log('Tests finished.') + // console.dir(results) + + await browser.close() + + const exitCode = results.ok ? 0 : 1 + + process.exit(exitCode) +}) + // Navigate the page to a URL. -await page.goto(`file:${ pathjoin(import.meta.dirname, 'browser.html') }`) +const suiteUrl = `file:${ pathjoin(import.meta.dirname, 'headless.html') }` +await page.goto(suiteUrl, { + waitUntil: 'domcontentloaded' +}) // Set screen size. await page.setViewport({ width: 1024, height: 768 }) -console.log('Hello from puppeteer app') +// Test version property +// const tapspaceVersion = await page.evaluate(() => window.tapspace.version) +// console.log(tapspaceVersion) + +// Wait until tests are finished. +await page.waitForFunction('window.done === true') + +// HACK Give tape a few milliseconds to print out the summary. +setTimeout(() => { + consoleStream.end() +}, 100) -// Exit the test page and close the browser. -await browser.close() diff --git a/test/index.test.js b/test/index.test.js index 5153a2a8..8cb7e322 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -1,5 +1,5 @@ const test = require('tape') -const tapspace = require('../index') +const tapspace = window.tapspace const units = { // General @@ -28,3 +28,6 @@ const container = document.querySelector('#container') Object.keys(units).forEach((unitName) => { units[unitName](test, container, tapspace) }) + +// Mark tests finished. Puppeteer runner reads this. +window.done = true From 4402b2e32eac9d2fd77b7535905350348a7ceec4 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 2 Jan 2025 18:35:37 +0200 Subject: [PATCH 017/118] setup headless test suite with tape running outside puppeteer --- test/suites.test.mjs | 18 +++++++++ .../Viewport/getAspectRatio.test.html | 37 +++++++++++++++++++ .../Viewport/getAspectRatio.test.mjs | 22 +++++++++++ test/suites/components/Viewport/index.mjs | 5 +++ test/suites/components/index.mjs | 5 +++ test/suites/index.mjs | 5 +++ 6 files changed, 92 insertions(+) create mode 100644 test/suites.test.mjs create mode 100644 test/suites/components/Viewport/getAspectRatio.test.html create mode 100644 test/suites/components/Viewport/getAspectRatio.test.mjs create mode 100644 test/suites/components/Viewport/index.mjs create mode 100644 test/suites/components/index.mjs create mode 100644 test/suites/index.mjs diff --git a/test/suites.test.mjs b/test/suites.test.mjs new file mode 100644 index 00000000..d2e204a7 --- /dev/null +++ b/test/suites.test.mjs @@ -0,0 +1,18 @@ +import puppeteer from 'puppeteer' +import test from 'tape' +import { join } from 'path' + +// Suites +import { run } from './suites/index.mjs' + +// Setup +const browser = await puppeteer.launch() + +// Run tests +run(test, browser) + +// Exit after all tests completed, success or not. +// It is important to keep the browser open until that. +test.onFinish(async () => { + await browser.close() +}) diff --git a/test/suites/components/Viewport/getAspectRatio.test.html b/test/suites/components/Viewport/getAspectRatio.test.html new file mode 100644 index 00000000..6b950088 --- /dev/null +++ b/test/suites/components/Viewport/getAspectRatio.test.html @@ -0,0 +1,37 @@ + + + + + Viewport:getAspectRatio – Tapspace Test + + + + +
+
+
+ + + diff --git a/test/suites/components/Viewport/getAspectRatio.test.mjs b/test/suites/components/Viewport/getAspectRatio.test.mjs new file mode 100644 index 00000000..59e1c459 --- /dev/null +++ b/test/suites/components/Viewport/getAspectRatio.test.mjs @@ -0,0 +1,22 @@ +import { join } from 'path' + +const pageUrl = 'file:' + join(import.meta.dirname, 'getAspectRatio.test.html') + +export const run = (test, browser) => { + test('Viewport:getAspectRatio', async (t) => { + // Setup + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Test + const aspectRatio = await page.evaluate(() => { + return window.suite.view.getAspectRatio() + }) + t.equal(aspectRatio, 2, 'should match viewport size') + + // Exit + await page.close() + t.end() + }) +} diff --git a/test/suites/components/Viewport/index.mjs b/test/suites/components/Viewport/index.mjs new file mode 100644 index 00000000..f2ea6473 --- /dev/null +++ b/test/suites/components/Viewport/index.mjs @@ -0,0 +1,5 @@ +import { run as runGetAspectRatio } from './getAspectRatio.test.mjs' + +export const run = (test, browser) => { + runGetAspectRatio(test, browser) +} diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs new file mode 100644 index 00000000..d34de8e4 --- /dev/null +++ b/test/suites/components/index.mjs @@ -0,0 +1,5 @@ +import { run as runViewport } from './Viewport/index.mjs' + +export const run = (test, browser) => { + runViewport(test, browser) +} diff --git a/test/suites/index.mjs b/test/suites/index.mjs new file mode 100644 index 00000000..fdf166d1 --- /dev/null +++ b/test/suites/index.mjs @@ -0,0 +1,5 @@ +import { run as runComponents } from './components/index.mjs' + +export const run = (test, browser) => { + runComponents(test, browser) +} From 24c765f30579ab605b20c477af8c5dbba6a69c2c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 3 Jan 2025 17:43:16 +0200 Subject: [PATCH 018/118] document the test suite --- test/suites.test.mjs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/suites.test.mjs b/test/suites.test.mjs index d2e204a7..52de3ae6 100644 --- a/test/suites.test.mjs +++ b/test/suites.test.mjs @@ -1,3 +1,20 @@ +// This test server enables testing Tapspace in a headless Chromium browser +// both locally and in a continuous integration server. +// +// ## Usage +// $ node suites.test.mjs +// +// ## Design +// We use Tape testing framework on server side only. +// In other words, the assertions happen server side. +// This is for simplicity, because Tape does not +// work in a browser without a special build setup. +// Also, extracting tape output from the headless browser would be tricky. +// +// ## Licence +// MIT. Copyright Akseli Palén 2025 +// + import puppeteer from 'puppeteer' import test from 'tape' import { join } from 'path' @@ -7,6 +24,8 @@ import { run } from './suites/index.mjs' // Setup const browser = await puppeteer.launch() +// Switch to the commented line to show the browser. +// const browser = await puppeteer.launch({ headless: false }) // Run tests run(test, browser) From bee80d9098313e1e18e77af7be0067b72bf4faf7 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 3 Jan 2025 18:02:47 +0200 Subject: [PATCH 019/118] migrate Viewport:measureGroup tests --- test/suites/components/Viewport/index.mjs | 2 + .../Viewport/measureGroup.test.html | 66 +++++++++++++++++++ .../components/Viewport/measureGroup.test.mjs | 27 ++++++++ 3 files changed, 95 insertions(+) create mode 100644 test/suites/components/Viewport/measureGroup.test.html create mode 100644 test/suites/components/Viewport/measureGroup.test.mjs diff --git a/test/suites/components/Viewport/index.mjs b/test/suites/components/Viewport/index.mjs index f2ea6473..4dbefbd6 100644 --- a/test/suites/components/Viewport/index.mjs +++ b/test/suites/components/Viewport/index.mjs @@ -1,5 +1,7 @@ import { run as runGetAspectRatio } from './getAspectRatio.test.mjs' +import { run as runMeasureGroup } from './measureGroup.test.mjs' export const run = (test, browser) => { runGetAspectRatio(test, browser) + runMeasureGroup(test, browser) } diff --git a/test/suites/components/Viewport/measureGroup.test.html b/test/suites/components/Viewport/measureGroup.test.html new file mode 100644 index 00000000..b88d5fcc --- /dev/null +++ b/test/suites/components/Viewport/measureGroup.test.html @@ -0,0 +1,66 @@ + + + + + Viewport:measureGroup – Tapspace Test + + + + +
+
+
+ + + diff --git a/test/suites/components/Viewport/measureGroup.test.mjs b/test/suites/components/Viewport/measureGroup.test.mjs new file mode 100644 index 00000000..5c80de8d --- /dev/null +++ b/test/suites/components/Viewport/measureGroup.test.mjs @@ -0,0 +1,27 @@ +import { join } from 'path' + +const pageUrl = 'file:' + join(import.meta.dirname, 'measureGroup.test.html') + +export const run = (test, browser) => { + test('Viewport:measureGroup', async (t) => { + // Setup + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Test + const suite = await page.evaluate(() => { + return window.suite + }) + + for (let i = 0; i < suite.length; i += 1) { + const predicate = suite[i][0] + const message = suite[i][1] + t.ok(predicate, message) + } + + // Exit + await page.close() + t.end() + }) +} From 05a169f4cae9a9012014d079746257925c2ab91c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 3 Jan 2025 18:10:54 +0200 Subject: [PATCH 020/118] simplify test imports --- test/suites/components/Viewport/getAspectRatio.test.mjs | 2 +- test/suites/components/Viewport/index.mjs | 8 ++++---- test/suites/components/Viewport/measureGroup.test.mjs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/suites/components/Viewport/getAspectRatio.test.mjs b/test/suites/components/Viewport/getAspectRatio.test.mjs index 59e1c459..1dd23c1b 100644 --- a/test/suites/components/Viewport/getAspectRatio.test.mjs +++ b/test/suites/components/Viewport/getAspectRatio.test.mjs @@ -2,7 +2,7 @@ import { join } from 'path' const pageUrl = 'file:' + join(import.meta.dirname, 'getAspectRatio.test.html') -export const run = (test, browser) => { +export default function (test, browser) { test('Viewport:getAspectRatio', async (t) => { // Setup const page = await browser.newPage() diff --git a/test/suites/components/Viewport/index.mjs b/test/suites/components/Viewport/index.mjs index 4dbefbd6..9326db29 100644 --- a/test/suites/components/Viewport/index.mjs +++ b/test/suites/components/Viewport/index.mjs @@ -1,7 +1,7 @@ -import { run as runGetAspectRatio } from './getAspectRatio.test.mjs' -import { run as runMeasureGroup } from './measureGroup.test.mjs' +import testGetAspectRatio from './getAspectRatio.test.mjs' +import testMeasureGroup from './measureGroup.test.mjs' export const run = (test, browser) => { - runGetAspectRatio(test, browser) - runMeasureGroup(test, browser) + testGetAspectRatio(test, browser) + testMeasureGroup(test, browser) } diff --git a/test/suites/components/Viewport/measureGroup.test.mjs b/test/suites/components/Viewport/measureGroup.test.mjs index 5c80de8d..a7b2ff35 100644 --- a/test/suites/components/Viewport/measureGroup.test.mjs +++ b/test/suites/components/Viewport/measureGroup.test.mjs @@ -2,7 +2,7 @@ import { join } from 'path' const pageUrl = 'file:' + join(import.meta.dirname, 'measureGroup.test.html') -export const run = (test, browser) => { +export default function (test, browser) { test('Viewport:measureGroup', async (t) => { // Setup const page = await browser.newPage() From a89a2f4e6eb3c5998b3c2566c20286a83bd9c230 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 3 Jan 2025 18:22:03 +0200 Subject: [PATCH 021/118] simplify test suite structure --- .../Viewport/getAspectRatio.test.html | 4 +- .../Viewport/getAspectRatio.test.mjs | 22 -------- test/suites/components/Viewport/index.mjs | 50 +++++++++++++++++-- .../components/Viewport/measureGroup.test.mjs | 27 ---------- test/suites/components/index.mjs | 4 +- 5 files changed, 50 insertions(+), 57 deletions(-) delete mode 100644 test/suites/components/Viewport/getAspectRatio.test.mjs delete mode 100644 test/suites/components/Viewport/measureGroup.test.mjs diff --git a/test/suites/components/Viewport/getAspectRatio.test.html b/test/suites/components/Viewport/getAspectRatio.test.html index 6b950088..e39ad71a 100644 --- a/test/suites/components/Viewport/getAspectRatio.test.html +++ b/test/suites/components/Viewport/getAspectRatio.test.html @@ -31,7 +31,9 @@ const basis = tapspace.createSpace() view.addChild(basis) - window.suite = { view } + window.suite = [ + [view.getAspectRatio() === 2, 'should match viewport ratio'] + ] diff --git a/test/suites/components/Viewport/getAspectRatio.test.mjs b/test/suites/components/Viewport/getAspectRatio.test.mjs deleted file mode 100644 index 1dd23c1b..00000000 --- a/test/suites/components/Viewport/getAspectRatio.test.mjs +++ /dev/null @@ -1,22 +0,0 @@ -import { join } from 'path' - -const pageUrl = 'file:' + join(import.meta.dirname, 'getAspectRatio.test.html') - -export default function (test, browser) { - test('Viewport:getAspectRatio', async (t) => { - // Setup - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Test - const aspectRatio = await page.evaluate(() => { - return window.suite.view.getAspectRatio() - }) - t.equal(aspectRatio, 2, 'should match viewport size') - - // Exit - await page.close() - t.end() - }) -} diff --git a/test/suites/components/Viewport/index.mjs b/test/suites/components/Viewport/index.mjs index 9326db29..bc276a33 100644 --- a/test/suites/components/Viewport/index.mjs +++ b/test/suites/components/Viewport/index.mjs @@ -1,7 +1,47 @@ -import testGetAspectRatio from './getAspectRatio.test.mjs' -import testMeasureGroup from './measureGroup.test.mjs' +import { join } from 'path' -export const run = (test, browser) => { - testGetAspectRatio(test, browser) - testMeasureGroup(test, browser) +const getUrl = (testName) => 'file:' + join(import.meta.dirname, testName) + +export default function (test, browser) { + test('Viewport:getAspectRatio', async (t) => { + // Setup + const pageUrl = getUrl('getAspectRatio.test.html') + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Test + const suite = await page.evaluate(() => window.suite) + + for (let i = 0; i < suite.length; i += 1) { + const predicate = suite[i][0] + const message = suite[i][1] + t.ok(predicate, message) + } + + // Exit + await page.close() + t.end() + }) + + test('Viewport:measureGroup', async (t) => { + // Setup + const pageUrl = getUrl('measureGroup.test.html') + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Test + const suite = await page.evaluate(() => window.suite) + + for (let i = 0; i < suite.length; i += 1) { + const predicate = suite[i][0] + const message = suite[i][1] + t.ok(predicate, message) + } + + // Exit + await page.close() + t.end() + }) } diff --git a/test/suites/components/Viewport/measureGroup.test.mjs b/test/suites/components/Viewport/measureGroup.test.mjs deleted file mode 100644 index a7b2ff35..00000000 --- a/test/suites/components/Viewport/measureGroup.test.mjs +++ /dev/null @@ -1,27 +0,0 @@ -import { join } from 'path' - -const pageUrl = 'file:' + join(import.meta.dirname, 'measureGroup.test.html') - -export default function (test, browser) { - test('Viewport:measureGroup', async (t) => { - // Setup - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Test - const suite = await page.evaluate(() => { - return window.suite - }) - - for (let i = 0; i < suite.length; i += 1) { - const predicate = suite[i][0] - const message = suite[i][1] - t.ok(predicate, message) - } - - // Exit - await page.close() - t.end() - }) -} diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index d34de8e4..d19113e8 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -1,5 +1,5 @@ -import { run as runViewport } from './Viewport/index.mjs' +import testViewport from './Viewport/index.mjs' export const run = (test, browser) => { - runViewport(test, browser) + testViewport(test, browser) } From 7b89cedf58476e50ec46c3223d159667429d5f9a Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 3 Jan 2025 18:23:56 +0200 Subject: [PATCH 022/118] simplify test suites by use of default export --- test/suites.test.mjs | 4 ++-- test/suites/components/index.mjs | 2 +- test/suites/index.mjs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/suites.test.mjs b/test/suites.test.mjs index 52de3ae6..12c5d62e 100644 --- a/test/suites.test.mjs +++ b/test/suites.test.mjs @@ -20,7 +20,7 @@ import test from 'tape' import { join } from 'path' // Suites -import { run } from './suites/index.mjs' +import testSuite from './suites/index.mjs' // Setup const browser = await puppeteer.launch() @@ -28,7 +28,7 @@ const browser = await puppeteer.launch() // const browser = await puppeteer.launch({ headless: false }) // Run tests -run(test, browser) +testSuite(test, browser) // Exit after all tests completed, success or not. // It is important to keep the browser open until that. diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index d19113e8..26cf78cb 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -1,5 +1,5 @@ import testViewport from './Viewport/index.mjs' -export const run = (test, browser) => { +export default function (test, browser) { testViewport(test, browser) } diff --git a/test/suites/index.mjs b/test/suites/index.mjs index fdf166d1..63c7c67e 100644 --- a/test/suites/index.mjs +++ b/test/suites/index.mjs @@ -1,5 +1,5 @@ -import { run as runComponents } from './components/index.mjs' +import testComponents from './components/index.mjs' -export const run = (test, browser) => { - runComponents(test, browser) +export default function (test, browser) { + testComponents(test, browser) } From 0e184bfb4c166eee2f4a4a35266d97bbccad02bd Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 15:39:54 +0200 Subject: [PATCH 023/118] implement Point:equal Point:almostEqual --- lib/geometry/Point/almostEqual.js | 25 +++++++++++++++++++++++++ lib/geometry/Point/equal.js | 22 ++++++++++++++++++++++ lib/geometry/Point/index.js | 2 ++ 3 files changed, 49 insertions(+) create mode 100644 lib/geometry/Point/almostEqual.js create mode 100644 lib/geometry/Point/equal.js diff --git a/lib/geometry/Point/almostEqual.js b/lib/geometry/Point/almostEqual.js new file mode 100644 index 00000000..e743e099 --- /dev/null +++ b/lib/geometry/Point/almostEqual.js @@ -0,0 +1,25 @@ +const point3 = require('affineplane').point3 + +module.exports = function (p, tolerance) { + // @Point:almostEqual(p, tolerance) + // + // Test if the point is almost equal to p. + // Almost equal requires strictly equal basis and + // that coordinates are equal within tolerance. + // + // Parameters: + // p + // a Point + // tolerance + // optional number. Maximum Manhattan distance between this and p. + // Default is affineplane.epsilon + // + // Return + // a boolean + // + + if (!p.basis) return false + if (this.basis !== p.basis) return false + + return point3.almostEqual(this.point, p.point, tolerance) +} diff --git a/lib/geometry/Point/equal.js b/lib/geometry/Point/equal.js new file mode 100644 index 00000000..d965c5e1 --- /dev/null +++ b/lib/geometry/Point/equal.js @@ -0,0 +1,22 @@ +const point3 = require('affineplane').point3 + +module.exports = function (p) { + // @Point:equal(p) + // + // Test if the point is strictly equal to p. + // Strict equality requires strictly equal basis and coordinates. + // + // Parameters: + // p + // a Point + // + // Return + // a boolean + // + + if (p.basis && this.basis === p.basis) { + return point3.equal(this.point, p.point) + } + + return false +} diff --git a/lib/geometry/Point/index.js b/lib/geometry/Point/index.js index e0a4ae84..49495c1b 100644 --- a/lib/geometry/Point/index.js +++ b/lib/geometry/Point/index.js @@ -38,7 +38,9 @@ Point.fromMean = Point.fromAverage // Instance methods proto.addVector = require('./addVector') +proto.almostEqual = require('./almostEqual') proto.changeBasis = require('./changeBasis') +proto.equal = require('./equal') proto.getDirectionTo = require('./getDirectionTo')(Direction) proto.getDistanceTo = require('./getDistanceTo')(Distance) proto.getRaw = require('./getRaw') From d47ef2226a9f5979efdad4856e230d6132338b3a Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 15:40:25 +0200 Subject: [PATCH 024/118] migrate Space test suite --- test/suites/components/Space/at.test.html | 45 ++++++++++++ .../components/Space/getBoundingBox.test.html | 73 +++++++++++++++++++ test/suites/components/Space/index.mjs | 47 ++++++++++++ test/suites/components/index.mjs | 2 + 4 files changed, 167 insertions(+) create mode 100644 test/suites/components/Space/at.test.html create mode 100644 test/suites/components/Space/getBoundingBox.test.html create mode 100644 test/suites/components/Space/index.mjs diff --git a/test/suites/components/Space/at.test.html b/test/suites/components/Space/at.test.html new file mode 100644 index 00000000..cfe9c0e8 --- /dev/null +++ b/test/suites/components/Space/at.test.html @@ -0,0 +1,45 @@ + + + + + Space:at – Tapspace Test + + + + +
+
+
+ + + diff --git a/test/suites/components/Space/getBoundingBox.test.html b/test/suites/components/Space/getBoundingBox.test.html new file mode 100644 index 00000000..272cb6f2 --- /dev/null +++ b/test/suites/components/Space/getBoundingBox.test.html @@ -0,0 +1,73 @@ + + + + + Space:getBoundingBox – Tapspace Test + + + + +
+
+
+ + + diff --git a/test/suites/components/Space/index.mjs b/test/suites/components/Space/index.mjs new file mode 100644 index 00000000..a2a90d04 --- /dev/null +++ b/test/suites/components/Space/index.mjs @@ -0,0 +1,47 @@ +import { join } from 'path' + +const getUrl = (testName) => 'file:' + join(import.meta.dirname, testName) + +export default function (test, browser) { + test('Space:at', async (t) => { + // Setup + const pageUrl = getUrl('at.test.html') + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Test + const suite = await page.evaluate(() => window.suite) + + for (let i = 0; i < suite.length; i += 1) { + const predicate = suite[i][0] + const message = suite[i][1] + t.ok(predicate, message) + } + + // Exit + await page.close() + t.end() + }) + + test('Space:getBoundingBox', async (t) => { + // Setup + const pageUrl = getUrl('getBoundingBox.test.html') + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Test + const suite = await page.evaluate(() => window.suite) + + for (let i = 0; i < suite.length; i += 1) { + const predicate = suite[i][0] + const message = suite[i][1] + t.ok(predicate, message) + } + + // Exit + await page.close() + t.end() + }) +} diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index 26cf78cb..0fbcf78a 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -1,5 +1,7 @@ +import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' export default function (test, browser) { + testSpace(test, browser) testViewport(test, browser) } From c5fb5b03680f48a810f65ccb20d1c695be2fc9a7 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 15:53:38 +0200 Subject: [PATCH 025/118] simplify headless test suite structure --- test/suites.test.mjs | 29 +++++++++++++- test/suites/components/Space/index.mjs | 49 ++--------------------- test/suites/components/Viewport/index.mjs | 49 ++--------------------- test/suites/components/index.mjs | 6 +-- test/suites/index.mjs | 4 +- 5 files changed, 39 insertions(+), 98 deletions(-) diff --git a/test/suites.test.mjs b/test/suites.test.mjs index 12c5d62e..dfa6c704 100644 --- a/test/suites.test.mjs +++ b/test/suites.test.mjs @@ -27,8 +27,35 @@ const browser = await puppeteer.launch() // Switch to the commented line to show the browser. // const browser = await puppeteer.launch({ headless: false }) +const getFileUrl = (dirname, filename) => 'file:' + join(dirname, filename) + +// Custom test +const customTest = async (unitName, dirname, filename) => { + test(unitName, async (t) => { + // Setup + const pageUrl = getFileUrl(dirname, filename) + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Collect test results. + const suite = await page.evaluate(() => window.suite) + + // Check test results. + for (let i = 0; i < suite.length; i += 1) { + const predicate = suite[i][0] + const message = suite[i][1] + t.ok(predicate, message) + } + + // Exit + await page.close() + t.end() + }) +} + // Run tests -testSuite(test, browser) +testSuite(customTest) // Exit after all tests completed, success or not. // It is important to keep the browser open until that. diff --git a/test/suites/components/Space/index.mjs b/test/suites/components/Space/index.mjs index a2a90d04..b1424401 100644 --- a/test/suites/components/Space/index.mjs +++ b/test/suites/components/Space/index.mjs @@ -1,47 +1,4 @@ -import { join } from 'path' - -const getUrl = (testName) => 'file:' + join(import.meta.dirname, testName) - -export default function (test, browser) { - test('Space:at', async (t) => { - // Setup - const pageUrl = getUrl('at.test.html') - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Test - const suite = await page.evaluate(() => window.suite) - - for (let i = 0; i < suite.length; i += 1) { - const predicate = suite[i][0] - const message = suite[i][1] - t.ok(predicate, message) - } - - // Exit - await page.close() - t.end() - }) - - test('Space:getBoundingBox', async (t) => { - // Setup - const pageUrl = getUrl('getBoundingBox.test.html') - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Test - const suite = await page.evaluate(() => window.suite) - - for (let i = 0; i < suite.length; i += 1) { - const predicate = suite[i][0] - const message = suite[i][1] - t.ok(predicate, message) - } - - // Exit - await page.close() - t.end() - }) +export default function (test) { + test('Space:at', import.meta.dirname, 'at.test.html') + test('Space:getBoundingBox', import.meta.dirname, 'getBoundingBox.test.html') } diff --git a/test/suites/components/Viewport/index.mjs b/test/suites/components/Viewport/index.mjs index bc276a33..76ef4052 100644 --- a/test/suites/components/Viewport/index.mjs +++ b/test/suites/components/Viewport/index.mjs @@ -1,47 +1,4 @@ -import { join } from 'path' - -const getUrl = (testName) => 'file:' + join(import.meta.dirname, testName) - -export default function (test, browser) { - test('Viewport:getAspectRatio', async (t) => { - // Setup - const pageUrl = getUrl('getAspectRatio.test.html') - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Test - const suite = await page.evaluate(() => window.suite) - - for (let i = 0; i < suite.length; i += 1) { - const predicate = suite[i][0] - const message = suite[i][1] - t.ok(predicate, message) - } - - // Exit - await page.close() - t.end() - }) - - test('Viewport:measureGroup', async (t) => { - // Setup - const pageUrl = getUrl('measureGroup.test.html') - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Test - const suite = await page.evaluate(() => window.suite) - - for (let i = 0; i < suite.length; i += 1) { - const predicate = suite[i][0] - const message = suite[i][1] - t.ok(predicate, message) - } - - // Exit - await page.close() - t.end() - }) +export default function (test) { + test('Viewport:getAspectRatio', import.meta.dirname, 'getAspectRatio.test.html') + test('Viewport:measureGroup', import.meta.dirname, 'measureGroup.test.html') } diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index 0fbcf78a..bb499cf4 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -1,7 +1,7 @@ import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' -export default function (test, browser) { - testSpace(test, browser) - testViewport(test, browser) +export default function (test) { + testSpace(test) + testViewport(test) } diff --git a/test/suites/index.mjs b/test/suites/index.mjs index 63c7c67e..5e13196d 100644 --- a/test/suites/index.mjs +++ b/test/suites/index.mjs @@ -1,5 +1,5 @@ import testComponents from './components/index.mjs' -export default function (test, browser) { - testComponents(test, browser) +export default function (test) { + testComponents(test) } From f58d24dd4d151cb5ce4d954b7f788d8870b630f4 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 15:59:07 +0200 Subject: [PATCH 026/118] uninstall tap-parser and delete sketch of headless runner --- package.json | 1 - test/headless.html | 23 ------------- test/headless.test.mjs | 74 ------------------------------------------ 3 files changed, 98 deletions(-) delete mode 100644 test/headless.html delete mode 100644 test/headless.test.mjs diff --git a/package.json b/package.json index d3743a44..500d2c37 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,6 @@ "standard": "^17.1.2", "stream-browserify": "^3.0.0", "style-loader": "^4.0.0", - "tap-parser": "^18.0.0", "tape": "^5.9.0", "webpack": "^5.97.1", "webpack-cli": "^5.1.4", diff --git a/test/headless.html b/test/headless.html deleted file mode 100644 index d51b1d4d..00000000 --- a/test/headless.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - Tapspace Test - - - - -
-
- - - diff --git a/test/headless.test.mjs b/test/headless.test.mjs deleted file mode 100644 index 9b64ee2a..00000000 --- a/test/headless.test.mjs +++ /dev/null @@ -1,74 +0,0 @@ -import puppeteer from 'puppeteer' -import { join as pathjoin } from 'path' -import { Parser } from 'tap-parser' -import { Readable } from 'stream' - -class TextStream extends Readable { - constructor(options) { - super(options) - } - - _read(size) { - // No-op - } - - write(data) { - this.push(data) - } - - end() { - this.push(null) - } -} - -// Launch the browser and open a new blank page. -const browser = await puppeteer.launch() -const page = await browser.newPage() - -// Capture console output -const consoleStream = new TextStream() -// page.on('console', msg => console.log('PAGE LOG:', msg.text())) -page.on('console', msg => { - const str = msg.text() + '\n' - consoleStream.write(str) -}) - -const tapParser = new Parser() -consoleStream.pipe(tapParser) - -// tapParser.on('line', (line) => { -// console.log(line) -// }) - -tapParser.on('complete', async (results) => { - console.log('Tests finished.') - // console.dir(results) - - await browser.close() - - const exitCode = results.ok ? 0 : 1 - - process.exit(exitCode) -}) - -// Navigate the page to a URL. -const suiteUrl = `file:${ pathjoin(import.meta.dirname, 'headless.html') }` -await page.goto(suiteUrl, { - waitUntil: 'domcontentloaded' -}) - -// Set screen size. -await page.setViewport({ width: 1024, height: 768 }) - -// Test version property -// const tapspaceVersion = await page.evaluate(() => window.tapspace.version) -// console.log(tapspaceVersion) - -// Wait until tests are finished. -await page.waitForFunction('window.done === true') - -// HACK Give tape a few milliseconds to print out the summary. -setTimeout(() => { - consoleStream.end() -}, 100) - From 3b836fc920ff17c4c4747887beb937ef5e2a949a Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 19:06:48 +0200 Subject: [PATCH 027/118] improve test suite structure and test version --- test/suites.test.mjs | 30 +----------------------- test/suites/components/index.mjs | 33 ++++++++++++++++++++++++--- test/suites/index.mjs | 6 +++-- test/suites/utils.mjs | 5 ++++ test/suites/version/index.mjs | 26 +++++++++++++++++++++ test/suites/version/version.test.html | 16 +++++++++++++ 6 files changed, 82 insertions(+), 34 deletions(-) create mode 100644 test/suites/utils.mjs create mode 100644 test/suites/version/index.mjs create mode 100644 test/suites/version/version.test.html diff --git a/test/suites.test.mjs b/test/suites.test.mjs index dfa6c704..fcb6d2d0 100644 --- a/test/suites.test.mjs +++ b/test/suites.test.mjs @@ -17,7 +17,6 @@ import puppeteer from 'puppeteer' import test from 'tape' -import { join } from 'path' // Suites import testSuite from './suites/index.mjs' @@ -27,35 +26,8 @@ const browser = await puppeteer.launch() // Switch to the commented line to show the browser. // const browser = await puppeteer.launch({ headless: false }) -const getFileUrl = (dirname, filename) => 'file:' + join(dirname, filename) - -// Custom test -const customTest = async (unitName, dirname, filename) => { - test(unitName, async (t) => { - // Setup - const pageUrl = getFileUrl(dirname, filename) - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Collect test results. - const suite = await page.evaluate(() => window.suite) - - // Check test results. - for (let i = 0; i < suite.length; i += 1) { - const predicate = suite[i][0] - const message = suite[i][1] - t.ok(predicate, message) - } - - // Exit - await page.close() - t.end() - }) -} - // Run tests -testSuite(customTest) +testSuite(test, browser) // Exit after all tests completed, success or not. // It is important to keep the browser open until that. diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index bb499cf4..5d0cb862 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -1,7 +1,34 @@ import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' +import { getFileUrl } from '../utils.mjs' -export default function (test) { - testSpace(test) - testViewport(test) +export default function (test, browser) { + // Custom test runner to reduce boilerplate code. + // Opens the test page and evaluates the test results. + const testAllOk = async (unitName, dirname, filename) => { + test(unitName, async (t) => { + // Setup + const pageUrl = getFileUrl(dirname, filename) + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Collect test results. + const suite = await page.evaluate(() => window.suite) + + // Check test results. + for (let i = 0; i < suite.length; i += 1) { + const predicate = suite[i][0] + const message = suite[i][1] + t.ok(predicate, message) + } + + // Exit + await page.close() + t.end() + }) + } + + testSpace(testAllOk) + testViewport(testAllOk) } diff --git a/test/suites/index.mjs b/test/suites/index.mjs index 5e13196d..b605dfae 100644 --- a/test/suites/index.mjs +++ b/test/suites/index.mjs @@ -1,5 +1,7 @@ import testComponents from './components/index.mjs' +import testVersion from './version/index.mjs' -export default function (test) { - testComponents(test) +export default function (test, browser) { + testComponents(test, browser) + testVersion(test, browser) } diff --git a/test/suites/utils.mjs b/test/suites/utils.mjs new file mode 100644 index 00000000..88eaed05 --- /dev/null +++ b/test/suites/utils.mjs @@ -0,0 +1,5 @@ +import { join } from 'path' + +export const getFileUrl = (dirname, filename) => { + return 'file:' + join(dirname, filename) +} diff --git a/test/suites/version/index.mjs b/test/suites/version/index.mjs new file mode 100644 index 00000000..c9bdd903 --- /dev/null +++ b/test/suites/version/index.mjs @@ -0,0 +1,26 @@ +import { getFileUrl } from '../utils.mjs' +import { readFile } from 'fs/promises' + +const pjson = JSON.parse( + await readFile(new URL('../../../package.json', import.meta.url)) +) + +export default function (test, browser) { + test('tapspace.version', async (t) => { + // Setup + const pageUrl = getFileUrl(import.meta.dirname, 'version.test.html') + const page = await browser.newPage() + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Get client side version + const v = await page.evaluate(() => window.tapspace.version) + + // Assertions + t.equal(typeof v, 'string', 'should be available') + t.equal(v, pjson.version, 'should equal package version') + + // Exit + await page.close() + t.end() + }) +} diff --git a/test/suites/version/version.test.html b/test/suites/version/version.test.html new file mode 100644 index 00000000..8148ae5e --- /dev/null +++ b/test/suites/version/version.test.html @@ -0,0 +1,16 @@ + + + + + version – Tapspace Test + + + +
+
+
+ + + From 255f3373fc9de3636dc12ad14331665bd3532aba Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 20:13:11 +0200 Subject: [PATCH 028/118] migrate Arc unit tests --- .../suites/components/Arc/getLength.test.html | 51 +++++++++++++++++++ test/suites/components/Arc/index.mjs | 3 ++ test/suites/components/index.mjs | 2 + 3 files changed, 56 insertions(+) create mode 100644 test/suites/components/Arc/getLength.test.html create mode 100644 test/suites/components/Arc/index.mjs diff --git a/test/suites/components/Arc/getLength.test.html b/test/suites/components/Arc/getLength.test.html new file mode 100644 index 00000000..ec1a6ab2 --- /dev/null +++ b/test/suites/components/Arc/getLength.test.html @@ -0,0 +1,51 @@ + + + + + Arc:getLength – Tapspace Test + + + + +
+
+
+ + + diff --git a/test/suites/components/Arc/index.mjs b/test/suites/components/Arc/index.mjs new file mode 100644 index 00000000..c764cc69 --- /dev/null +++ b/test/suites/components/Arc/index.mjs @@ -0,0 +1,3 @@ +export default function (test) { + test('Arc:getLength', import.meta.dirname, 'getLength.test.html') +} diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index 5d0cb862..898849ee 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -1,3 +1,4 @@ +import testArc from './Arc/index.mjs' import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' import { getFileUrl } from '../utils.mjs' @@ -29,6 +30,7 @@ export default function (test, browser) { }) } + testArc(testAllOk) testSpace(testAllOk) testViewport(testAllOk) } From 6b01e277b0bbd99e97c90476a7467be68e21eb59 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 20:17:32 +0200 Subject: [PATCH 029/118] improve Point:almostEqual docs --- lib/geometry/Point/almostEqual.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/geometry/Point/almostEqual.js b/lib/geometry/Point/almostEqual.js index e743e099..494974e1 100644 --- a/lib/geometry/Point/almostEqual.js +++ b/lib/geometry/Point/almostEqual.js @@ -1,7 +1,7 @@ const point3 = require('affineplane').point3 module.exports = function (p, tolerance) { - // @Point:almostEqual(p, tolerance) + // @Point:almostEqual(p[, tolerance]) // // Test if the point is almost equal to p. // Almost equal requires strictly equal basis and From 67f959f9d7b5551785581298016cb47bab288144 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Sun, 5 Jan 2025 22:00:31 +0200 Subject: [PATCH 030/118] write client-side test lib to simplify headless testing --- .../suites/components/Arc/getLength.test.html | 9 +- test/suites/components/Space/at.test.html | 15 +- .../components/Space/getBoundingBox.test.html | 19 ++- .../Viewport/getAspectRatio.test.html | 9 +- .../Viewport/measureGroup.test.html | 28 ++-- test/suites/components/index.mjs | 8 +- test/suites/testlib/testlib.js | 149 ++++++++++++++++++ 7 files changed, 196 insertions(+), 41 deletions(-) create mode 100644 test/suites/testlib/testlib.js diff --git a/test/suites/components/Arc/getLength.test.html b/test/suites/components/Arc/getLength.test.html index ec1a6ab2..6a71e053 100644 --- a/test/suites/components/Arc/getLength.test.html +++ b/test/suites/components/Arc/getLength.test.html @@ -21,13 +21,14 @@ } +
diff --git a/test/suites/components/Space/at.test.html b/test/suites/components/Space/at.test.html index cfe9c0e8..8c3846aa 100644 --- a/test/suites/components/Space/at.test.html +++ b/test/suites/components/Space/at.test.html @@ -21,12 +21,15 @@ } +
diff --git a/test/suites/components/Space/getBoundingBox.test.html b/test/suites/components/Space/getBoundingBox.test.html index 272cb6f2..2a147569 100644 --- a/test/suites/components/Space/getBoundingBox.test.html +++ b/test/suites/components/Space/getBoundingBox.test.html @@ -21,13 +21,14 @@ } +
diff --git a/test/suites/components/Viewport/getAspectRatio.test.html b/test/suites/components/Viewport/getAspectRatio.test.html index e39ad71a..88120230 100644 --- a/test/suites/components/Viewport/getAspectRatio.test.html +++ b/test/suites/components/Viewport/getAspectRatio.test.html @@ -21,19 +21,22 @@ } +
diff --git a/test/suites/components/Viewport/measureGroup.test.html b/test/suites/components/Viewport/measureGroup.test.html index b88d5fcc..c827b645 100644 --- a/test/suites/components/Viewport/measureGroup.test.html +++ b/test/suites/components/Viewport/measureGroup.test.html @@ -21,12 +21,15 @@ } +
diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index 898849ee..a843ca50 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -15,13 +15,11 @@ export default function (test, browser) { await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) // Collect test results. - const suite = await page.evaluate(() => window.suite) + const report = await page.evaluate(() => window.test.report()) // Check test results. - for (let i = 0; i < suite.length; i += 1) { - const predicate = suite[i][0] - const message = suite[i][1] - t.ok(predicate, message) + for (let i = 0; i < report.length; i += 1) { + t.ok(report[i].result, report[i].message) } // Exit diff --git a/test/suites/testlib/testlib.js b/test/suites/testlib/testlib.js new file mode 100644 index 00000000..10acf17b --- /dev/null +++ b/test/suites/testlib/testlib.js @@ -0,0 +1,149 @@ +// These tools attempt to replicate tape test API to be used +// in unit tests within a headless browser. +// The test report can be serialized so that it can be read +// in the test runner outside the headless instances. +// + +if (!window) { + throw new Error('Browser environment is required.') +} + +// Tolerance for almost equality. +const TOLERANCE = 1e-10 + +const toPlain = (val) => { + // Forcefully simplify value to a string, number or boolean. + // + if (typeof val === 'undefined') { + return 'undefined' + } + + if (typeof val !== 'object') { + return val + } + + if (Array.isArray(val)) { + return '[Array]' + } + + return '[Object]' +} + +const toSerializable = (val) => { + if (typeof val === 'undefined') { + return 'undefined' + } + + if (typeof val !== 'object') { + return val + } + + // Convert array elements to plain values. + if (Array.isArray(val)) { + return val.map(elem => toPlain(elem)) + } + + // Convert first level of properties to plain values. + const keys = Object.keys(val) + const obj = {} + for (let i = 0; i < keys.length; i += 1) { + const k = keys[i] + const v = val[k] + obj[k] = toPlain(v) + } + return obj +} + +window.test = { + planned: -1, + results: [], + + plan: function (num) { + if (typeof num !== 'number' || isNaN(num) || num < 0) { + throw new Error('Invalid number of planned tests: ' + num) + } + this.planned = num + }, + + end: function () { + // Check that correct number of tests were performed. + // If not, add a failed test result. + const actual = this.results.length + const expected = this.planned + + if (expected >= 0) { + if (actual !== expected) { + this.results.push({ + result: false, + operator: 'plan', + message: `Unexpected number of tests: ${actual}, should be ${expected}`, + actual, + expected + }) + } + } + }, + + report: function () { + // Export results in a serializable format. + // Convert complex objects into strings if necessary. + // + return this.results.map(r => { + return { + result: r.result, + operator: r.operator, + message: r.message, + actual: toSerializable(r.actual), + expected: toSerializable(r.expected) + } + }) + }, + + almostEqual: function (actual, expected, message) { + let result = false + + if (actual === expected) { + result = true + } else { + if (typeof actual === 'number' && typeof expected === 'number') { + if (!isNaN(actual) && !isNaN(expected)) { + if (Math.abs(actual - expected) < TOLERANCE) { + result = true + } + } + } + } + + this.results.push({ + result, + operator: 'almostEqual', + message: message || 'values should be equal or almost equal', + actual, + expected + }) + }, + + equal: function (actual, expected, message) { + const isEqual = actual === expected + this.results.push({ + result: isEqual, + operator: 'equal', + message: message || 'values should be strictly equal', + actual, + expected + }) + }, + + ok: function (actual, message) { + if (typeof actual !== 'boolean') { + actual = false + } + this.results.push({ + result: actual, + operator: 'ok', + message: message || 'proposition should be true', + actual, + expected: true + }) + } +} From d72dd00e52abd51ab44636a6015aae60e7819288 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 16:02:38 +0200 Subject: [PATCH 031/118] simplify test suite html file names --- .../components/Arc/{getLength.test.html => getLength.html} | 0 test/suites/components/Arc/index.mjs | 2 +- test/suites/components/Space/{at.test.html => at.html} | 0 .../Space/{getBoundingBox.test.html => getBoundingBox.html} | 0 test/suites/components/Space/index.mjs | 4 ++-- .../{getAspectRatio.test.html => getAspectRatio.html} | 0 test/suites/components/Viewport/index.mjs | 4 ++-- .../Viewport/{measureGroup.test.html => measureGroup.html} | 0 test/suites/version/index.mjs | 2 +- test/suites/version/{version.test.html => version.html} | 0 10 files changed, 6 insertions(+), 6 deletions(-) rename test/suites/components/Arc/{getLength.test.html => getLength.html} (100%) rename test/suites/components/Space/{at.test.html => at.html} (100%) rename test/suites/components/Space/{getBoundingBox.test.html => getBoundingBox.html} (100%) rename test/suites/components/Viewport/{getAspectRatio.test.html => getAspectRatio.html} (100%) rename test/suites/components/Viewport/{measureGroup.test.html => measureGroup.html} (100%) rename test/suites/version/{version.test.html => version.html} (100%) diff --git a/test/suites/components/Arc/getLength.test.html b/test/suites/components/Arc/getLength.html similarity index 100% rename from test/suites/components/Arc/getLength.test.html rename to test/suites/components/Arc/getLength.html diff --git a/test/suites/components/Arc/index.mjs b/test/suites/components/Arc/index.mjs index c764cc69..bd8e0f0a 100644 --- a/test/suites/components/Arc/index.mjs +++ b/test/suites/components/Arc/index.mjs @@ -1,3 +1,3 @@ export default function (test) { - test('Arc:getLength', import.meta.dirname, 'getLength.test.html') + test('Arc:getLength', import.meta.dirname, 'getLength.html') } diff --git a/test/suites/components/Space/at.test.html b/test/suites/components/Space/at.html similarity index 100% rename from test/suites/components/Space/at.test.html rename to test/suites/components/Space/at.html diff --git a/test/suites/components/Space/getBoundingBox.test.html b/test/suites/components/Space/getBoundingBox.html similarity index 100% rename from test/suites/components/Space/getBoundingBox.test.html rename to test/suites/components/Space/getBoundingBox.html diff --git a/test/suites/components/Space/index.mjs b/test/suites/components/Space/index.mjs index b1424401..787f4a7e 100644 --- a/test/suites/components/Space/index.mjs +++ b/test/suites/components/Space/index.mjs @@ -1,4 +1,4 @@ export default function (test) { - test('Space:at', import.meta.dirname, 'at.test.html') - test('Space:getBoundingBox', import.meta.dirname, 'getBoundingBox.test.html') + test('Space:at', import.meta.dirname, 'at.html') + test('Space:getBoundingBox', import.meta.dirname, 'getBoundingBox.html') } diff --git a/test/suites/components/Viewport/getAspectRatio.test.html b/test/suites/components/Viewport/getAspectRatio.html similarity index 100% rename from test/suites/components/Viewport/getAspectRatio.test.html rename to test/suites/components/Viewport/getAspectRatio.html diff --git a/test/suites/components/Viewport/index.mjs b/test/suites/components/Viewport/index.mjs index 76ef4052..ab65c573 100644 --- a/test/suites/components/Viewport/index.mjs +++ b/test/suites/components/Viewport/index.mjs @@ -1,4 +1,4 @@ export default function (test) { - test('Viewport:getAspectRatio', import.meta.dirname, 'getAspectRatio.test.html') - test('Viewport:measureGroup', import.meta.dirname, 'measureGroup.test.html') + test('Viewport:getAspectRatio', import.meta.dirname, 'getAspectRatio.html') + test('Viewport:measureGroup', import.meta.dirname, 'measureGroup.html') } diff --git a/test/suites/components/Viewport/measureGroup.test.html b/test/suites/components/Viewport/measureGroup.html similarity index 100% rename from test/suites/components/Viewport/measureGroup.test.html rename to test/suites/components/Viewport/measureGroup.html diff --git a/test/suites/version/index.mjs b/test/suites/version/index.mjs index c9bdd903..99778bd0 100644 --- a/test/suites/version/index.mjs +++ b/test/suites/version/index.mjs @@ -8,7 +8,7 @@ const pjson = JSON.parse( export default function (test, browser) { test('tapspace.version', async (t) => { // Setup - const pageUrl = getFileUrl(import.meta.dirname, 'version.test.html') + const pageUrl = getFileUrl(import.meta.dirname, 'version.html') const page = await browser.newPage() await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) diff --git a/test/suites/version/version.test.html b/test/suites/version/version.html similarity index 100% rename from test/suites/version/version.test.html rename to test/suites/version/version.html From 2c7f131608d396209be20f1118dfa3a8c463991c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 16:16:51 +0200 Subject: [PATCH 032/118] implement testlib assertion: notOk --- test/suites/testlib/testlib.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/suites/testlib/testlib.js b/test/suites/testlib/testlib.js index 10acf17b..29eb9669 100644 --- a/test/suites/testlib/testlib.js +++ b/test/suites/testlib/testlib.js @@ -54,6 +54,7 @@ const toSerializable = (val) => { return obj } +// Global simpleton test class. window.test = { planned: -1, results: [], @@ -145,5 +146,19 @@ window.test = { actual, expected: true }) + }, + + notOk: function (actual, message) { + let result = false + if (typeof actual === 'boolean') { + result = !actual + } + this.results.push({ + result, + operator: 'notOk', + message: message || 'proposition should be false', + actual, + expected: false + }) } } From 7f9143dec9f60347c7ec21084a9de334118c2f70 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 16:17:10 +0200 Subject: [PATCH 033/118] improve testlib docs --- test/suites/components/Space/at.html | 2 ++ test/suites/testlib/testlib.js | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/test/suites/components/Space/at.html b/test/suites/components/Space/at.html index 8c3846aa..225670f5 100644 --- a/test/suites/components/Space/at.html +++ b/test/suites/components/Space/at.html @@ -28,6 +28,7 @@
diff --git a/test/suites/testlib/testlib.js b/test/suites/testlib/testlib.js index 29eb9669..821f2eb8 100644 --- a/test/suites/testlib/testlib.js +++ b/test/suites/testlib/testlib.js @@ -3,6 +3,16 @@ // The test report can be serialized so that it can be read // in the test runner outside the headless instances. // +// Usage: +// - Install with a script tag on a unit-test HTML page. +// - Access via window.test object. +// - Use test.plan(n) to start the test section and test.end() to stop. +// - Assert with test.equal(), .almostEqual() and test.ok() +// - Access results via test.report() +// +// Licence: MIT +// Copyright: Akseli Palén, 2025 +// if (!window) { throw new Error('Browser environment is required.') @@ -30,6 +40,9 @@ const toPlain = (val) => { } const toSerializable = (val) => { + // Simplify value to a serializable. Objects and arrays are preserved + // on top level but converted to strings below that. + // if (typeof val === 'undefined') { return 'undefined' } From 44b766cca7df4cc2b8ed863b010daa432b063f5d Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 17:32:46 +0200 Subject: [PATCH 034/118] simplify test suite: check plan in report instead of end --- test/suites/components/Arc/getLength.html | 2 -- test/suites/components/Space/at.html | 4 +--- test/suites/components/Space/getBoundingBox.html | 2 -- test/suites/components/Viewport/getAspectRatio.html | 2 -- test/suites/components/Viewport/measureGroup.html | 2 -- test/suites/testlib/testlib.js | 12 +++++------- 6 files changed, 6 insertions(+), 18 deletions(-) diff --git a/test/suites/components/Arc/getLength.html b/test/suites/components/Arc/getLength.html index 6a71e053..d58f113b 100644 --- a/test/suites/components/Arc/getLength.html +++ b/test/suites/components/Arc/getLength.html @@ -45,8 +45,6 @@ const blen = new tapspace.geometry.Distance(space, Math.PI * 50) test.ok(alen.isAlmostEqual(blen), 'should have correct arc length') - - test.end() diff --git a/test/suites/components/Space/at.html b/test/suites/components/Space/at.html index 225670f5..f6b70a2e 100644 --- a/test/suites/components/Space/at.html +++ b/test/suites/components/Space/at.html @@ -38,13 +38,11 @@ // Take a point const p = space.at(1, 2) + // Test test.ok( p.almostEqual({ basis: space, point: { x: 1, y: 2, z: 0 } }), 'should fill z' ) - - // Exit - test.end() diff --git a/test/suites/components/Space/getBoundingBox.html b/test/suites/components/Space/getBoundingBox.html index 2a147569..36a80897 100644 --- a/test/suites/components/Space/getBoundingBox.html +++ b/test/suites/components/Space/getBoundingBox.html @@ -65,8 +65,6 @@ test.ok(s0.almostEqual(b0), 'should have matching origin') test.ok(s1.almostEqual(b1), 'should have matching bottom right corner') - - test.end() diff --git a/test/suites/components/Viewport/getAspectRatio.html b/test/suites/components/Viewport/getAspectRatio.html index 88120230..7f048403 100644 --- a/test/suites/components/Viewport/getAspectRatio.html +++ b/test/suites/components/Viewport/getAspectRatio.html @@ -35,8 +35,6 @@ view.addChild(basis) test.equal(view.getAspectRatio(), 2, 'should match viewport ratio') - - test.end() diff --git a/test/suites/components/Viewport/measureGroup.html b/test/suites/components/Viewport/measureGroup.html index c827b645..031028a9 100644 --- a/test/suites/components/Viewport/measureGroup.html +++ b/test/suites/components/Viewport/measureGroup.html @@ -61,8 +61,6 @@ test.equal(measures1.length, 2, 'should have two measurements') test.equal(measures1[1].dilation, 2, 'should have scaled dilation') test.equal(measures1[1].areaPx, 1600, 'should have scaled area') - - test.end() diff --git a/test/suites/testlib/testlib.js b/test/suites/testlib/testlib.js index 821f2eb8..e2e634e4 100644 --- a/test/suites/testlib/testlib.js +++ b/test/suites/testlib/testlib.js @@ -79,12 +79,15 @@ window.test = { this.planned = num }, - end: function () { + report: function () { + // Export results in a serializable format. + // Convert complex objects into strings if necessary. + // + // Check that correct number of tests were performed. // If not, add a failed test result. const actual = this.results.length const expected = this.planned - if (expected >= 0) { if (actual !== expected) { this.results.push({ @@ -96,12 +99,7 @@ window.test = { }) } } - }, - report: function () { - // Export results in a serializable format. - // Convert complex objects into strings if necessary. - // return this.results.map(r => { return { result: r.result, From 9a2a2607637fc3f504988ed1c9fec6abc72de91b Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 17:33:38 +0200 Subject: [PATCH 035/118] improve serialization of nullish values in testlib --- test/suites/testlib/testlib.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/suites/testlib/testlib.js b/test/suites/testlib/testlib.js index e2e634e4..3a9c5372 100644 --- a/test/suites/testlib/testlib.js +++ b/test/suites/testlib/testlib.js @@ -32,6 +32,10 @@ const toPlain = (val) => { return val } + if (val === null) { + return null + } + if (Array.isArray(val)) { return '[Array]' } @@ -51,6 +55,10 @@ const toSerializable = (val) => { return val } + if (val === null) { + return null + } + // Convert array elements to plain values. if (Array.isArray(val)) { return val.map(elem => toPlain(elem)) From 749ef9a4bd7f64401191ffd23234d59979aa0521 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 17:34:25 +0200 Subject: [PATCH 036/118] implement Basis :almostEqual :equal --- lib/geometry/Basis/almostEqual.js | 25 +++++++++++++++++++++++++ lib/geometry/Basis/equal.js | 23 +++++++++++++++++++++++ lib/geometry/Basis/index.js | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 lib/geometry/Basis/almostEqual.js create mode 100644 lib/geometry/Basis/equal.js diff --git a/lib/geometry/Basis/almostEqual.js b/lib/geometry/Basis/almostEqual.js new file mode 100644 index 00000000..a2e19bb6 --- /dev/null +++ b/lib/geometry/Basis/almostEqual.js @@ -0,0 +1,25 @@ +const plane3 = require('affineplane').plane3 +const almostEqual = plane3.almostEqual + +module.exports = function (b, tolerance) { + // @Basis:almostEqual(b[, tolerance]) + // + // Test if this is equal to the given basis b within tolerance. + // Almost equality requires identical basis' basis + // and that coordinates are equal within tolerance. + // + // Parameters: + // b + // a Basis + // tolerance + // optional number. Maximum tolerated distance between coordinates. + // + // Return + // a boolean + // + if (!b || !b.basis) { + return false + } + + return this.basis === b.basis && almostEqual(this.tran, b.tran, tolerance) +} diff --git a/lib/geometry/Basis/equal.js b/lib/geometry/Basis/equal.js new file mode 100644 index 00000000..8f14500f --- /dev/null +++ b/lib/geometry/Basis/equal.js @@ -0,0 +1,23 @@ +const plane3 = require('affineplane').plane3 +const equal = plane3.equal + +module.exports = function (b) { + // @Basis:equal(b) + // + // Test if the value b is a Basis and strictly equal. + // Strict equality requires the same basis' basis + // and identical coordinates. + // + // Parameters: + // b + // a Basis + // + // Return + // a boolean + // + if (!b || !b.basis) { + return false + } + + return this.basis === b.basis && equal(this.tran, b.tran) +} diff --git a/lib/geometry/Basis/index.js b/lib/geometry/Basis/index.js index 84f23a93..31b8d921 100644 --- a/lib/geometry/Basis/index.js +++ b/lib/geometry/Basis/index.js @@ -35,11 +35,13 @@ proto.isBasis = true Basis.fromPoints = require('./fromPoints')(Basis) // Methods +proto.almostEqual = require('./almostEqual') proto.at = require('./at') proto.changeBasis = require('./changeBasis') proto.createDistance = require('./createDistance') proto.createDirection = require('./createDirection') proto.createVector = require('./createVector') +proto.equal = require('./equal') proto.getMatchedOuter = require('./getMatchedOuter') proto.getOrientation = require('./getOrientation') proto.getPoint = proto.at From d030ff18388057dd0cb6b09ec7606993979b5404 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 17:34:49 +0200 Subject: [PATCH 037/118] migrate Component:createBasis tests --- .../components/Component/createBasis.html | 48 +++++++++++++++++++ test/suites/components/Component/index.mjs | 3 ++ test/suites/components/index.mjs | 2 + 3 files changed, 53 insertions(+) create mode 100644 test/suites/components/Component/createBasis.html create mode 100644 test/suites/components/Component/index.mjs diff --git a/test/suites/components/Component/createBasis.html b/test/suites/components/Component/createBasis.html new file mode 100644 index 00000000..9174cb76 --- /dev/null +++ b/test/suites/components/Component/createBasis.html @@ -0,0 +1,48 @@ + + + + + Component:createBasis – Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/suites/components/Component/index.mjs b/test/suites/components/Component/index.mjs new file mode 100644 index 00000000..2019f2ef --- /dev/null +++ b/test/suites/components/Component/index.mjs @@ -0,0 +1,3 @@ +export default function (test) { + test('Component:createBasis', import.meta.dirname, 'createBasis.html') +} diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index a843ca50..ad94b788 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -1,4 +1,5 @@ import testArc from './Arc/index.mjs' +import testComponent from './Component/index.mjs' import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' import { getFileUrl } from '../utils.mjs' @@ -29,6 +30,7 @@ export default function (test, browser) { } testArc(testAllOk) + testComponent(testAllOk) testSpace(testAllOk) testViewport(testAllOk) } From 88de8282726d96bfb41e740802af9c765784128b Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 21:06:50 +0200 Subject: [PATCH 038/118] implement Direction :almostEqual :equal --- lib/geometry/Direction/almostEqual.js | 26 ++++++++++++++++++++++++++ lib/geometry/Direction/equal.js | 22 ++++++++++++++++++++++ lib/geometry/Direction/index.js | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 lib/geometry/Direction/almostEqual.js create mode 100644 lib/geometry/Direction/equal.js diff --git a/lib/geometry/Direction/almostEqual.js b/lib/geometry/Direction/almostEqual.js new file mode 100644 index 00000000..4bb44d36 --- /dev/null +++ b/lib/geometry/Direction/almostEqual.js @@ -0,0 +1,26 @@ +const vec3 = require('affineplane').vec3 +// TODO use dir3 + +module.exports = function (dir, tolerance) { + // @Direction:almostEqual(dir[, tolerance]) + // + // Test if this direction is equal to a given direction within tolerance. + // Equality requires strictly equal basis and that the distance between coordinates + // is within the tolerance. + // + // Parameters: + // dir + // a Direction + // tolerance + // optional number + // + // Return + // a boolean + // + + if (dir && dir.basis && this.basis === dir.basis) { + return vec3.almostEqual(this.dir, dir.dir, tolerance) + } + + return false +} diff --git a/lib/geometry/Direction/equal.js b/lib/geometry/Direction/equal.js new file mode 100644 index 00000000..e2285204 --- /dev/null +++ b/lib/geometry/Direction/equal.js @@ -0,0 +1,22 @@ +const vec3 = require('affineplane').vec3 + +module.exports = function (dir) { + // @Direction:equal(dir) + // + // Test if this direction is strictly equal to a given direction. + // Strict equality requires strictly equal basis and coordinates. + // + // Parameters: + // dir + // a Direction + // + // Return + // a boolean + // + + if (dir && dir.basis && this.basis === dir.basis) { + return vec3.equal(this.dir, dir.dir) + } + + return false +} diff --git a/lib/geometry/Direction/index.js b/lib/geometry/Direction/index.js index 76dbdf9d..d9834105 100644 --- a/lib/geometry/Direction/index.js +++ b/lib/geometry/Direction/index.js @@ -37,7 +37,9 @@ Direction.fromVector = require('./fromVector')(Direction) Direction.fromSpherical = require('./fromSpherical')(Direction) // Methods +proto.almostEqual = require('./almostEqual') proto.changeBasis = require('./changeBasis') +proto.equal = require('./equal') proto.getRaw = require('./getRaw') proto.toVector = proto.getVector proto.transit = proto.changeBasis From 3d7331fd2412e2705b8a17549364c6dd2818787b Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 21:07:42 +0200 Subject: [PATCH 039/118] improve testlib: display serialized actual and expected values --- test/suites/components/index.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/suites/components/index.mjs b/test/suites/components/index.mjs index ad94b788..d713c4d4 100644 --- a/test/suites/components/index.mjs +++ b/test/suites/components/index.mjs @@ -20,7 +20,12 @@ export default function (test, browser) { // Check test results. for (let i = 0; i < report.length; i += 1) { - t.ok(report[i].result, report[i].message) + t._assert(report[i].result, { + message: report[i].message, + operator: report[i].operator, + actual: report[i].actual, + expected: report[i].expected + }) } // Exit From bbf7f1eb472fa382baf18f2e58fc848e875a47ae Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 6 Jan 2025 21:08:07 +0200 Subject: [PATCH 040/118] migrate Component:createDirection tests --- .../Component/{createBasis.html => creation.html} | 14 +++++++++++--- test/suites/components/Component/index.mjs | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) rename test/suites/components/Component/{createBasis.html => creation.html} (71%) diff --git a/test/suites/components/Component/createBasis.html b/test/suites/components/Component/creation.html similarity index 71% rename from test/suites/components/Component/createBasis.html rename to test/suites/components/Component/creation.html index 9174cb76..3aa1fe17 100644 --- a/test/suites/components/Component/createBasis.html +++ b/test/suites/components/Component/creation.html @@ -2,7 +2,7 @@ - Component:createBasis – Tapspace Test + Component geometry creation - Tapspace Test + + + + +
+
+
+ + + diff --git a/test/suites/components/Component/creation.html b/test/suites/components/Component/geometryCreation.html similarity index 100% rename from test/suites/components/Component/creation.html rename to test/suites/components/Component/geometryCreation.html diff --git a/test/suites/components/Component/index.mjs b/test/suites/components/Component/index.mjs index 90fa70a9..11ab6054 100644 --- a/test/suites/components/Component/index.mjs +++ b/test/suites/components/Component/index.mjs @@ -1,3 +1,4 @@ export default function (test) { - test('Component: geometry creation', import.meta.dirname, 'creation.html') + test('Component: findCommonAncestor', import.meta.dirname, 'findCommonAncestor.html') + test('Component: geometry creation', import.meta.dirname, 'geometryCreation.html') } From cfec0bd1e5ed1593398fdda0be31b96419bbb8f9 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 01:36:37 +0200 Subject: [PATCH 045/118] remove migrated original tests --- .../Arc.test/getLength.test.js | 25 -------- test/components.test/Arc.test/index.js | 9 --- test/components.test/Arc.test/template.ejs | 1 - .../Component.test/createMethods.test.js | 55 ----------------- .../Component.test/findCommonAncestor.test.js | 61 ------------------- test/components.test/Component.test/index.js | 2 - test/components.test/Space.test/at.test.js | 23 ------- .../Space.test/getBoundingBox.test.js | 51 ---------------- test/components.test/Space.test/index.js | 10 --- test/components.test/Space.test/template.ejs | 1 - .../Viewport.test/getAspectRatio.test.js | 16 ----- test/components.test/Viewport.test/index.js | 10 --- .../Viewport.test/measureGroup.test.js | 38 ------------ .../Viewport.test/template.ejs | 1 - test/components.test/index.js | 5 +- 15 files changed, 1 insertion(+), 307 deletions(-) delete mode 100644 test/components.test/Arc.test/getLength.test.js delete mode 100644 test/components.test/Arc.test/index.js delete mode 100644 test/components.test/Arc.test/template.ejs delete mode 100644 test/components.test/Component.test/createMethods.test.js delete mode 100644 test/components.test/Component.test/findCommonAncestor.test.js delete mode 100644 test/components.test/Space.test/at.test.js delete mode 100644 test/components.test/Space.test/getBoundingBox.test.js delete mode 100644 test/components.test/Space.test/index.js delete mode 100644 test/components.test/Space.test/template.ejs delete mode 100644 test/components.test/Viewport.test/getAspectRatio.test.js delete mode 100644 test/components.test/Viewport.test/index.js delete mode 100644 test/components.test/Viewport.test/measureGroup.test.js delete mode 100644 test/components.test/Viewport.test/template.ejs diff --git a/test/components.test/Arc.test/getLength.test.js b/test/components.test/Arc.test/getLength.test.js deleted file mode 100644 index e92b7e41..00000000 --- a/test/components.test/Arc.test/getLength.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Arc:getLength', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Create an arc, radius 50 - const arc = tapspace.createArc(Math.PI, '1px solid black') - space.addChild(arc) - arc.setPoints(space.at(100, 100), space.at(200, 100)) - - t.almostEqual( - arc.getLength().transitRaw(space), - Math.PI * 50, - 'should have correct arc length' - ) - - t.end() - }) -} diff --git a/test/components.test/Arc.test/index.js b/test/components.test/Arc.test/index.js deleted file mode 100644 index 7780e7c4..00000000 --- a/test/components.test/Arc.test/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const units = { - getLength: require('./getLength.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/components.test/Arc.test/template.ejs b/test/components.test/Arc.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/components.test/Arc.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/components.test/Component.test/createMethods.test.js b/test/components.test/Component.test/createMethods.test.js deleted file mode 100644 index e4658504..00000000 --- a/test/components.test/Component.test/createMethods.test.js +++ /dev/null @@ -1,55 +0,0 @@ -const template = require('./template.ejs') - -module.exports = (test, container, tapspace) => { - // - test('Component:createBasis', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - t.almostEqualBasis( - space.createBasis(space.at(0, 0), 1, 0), - space.getBasis(), - 'should be identical with space basis' - ) - - t.end() - }) - - test('Component:createDirection', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Take a direction - const dir = space.createDirection(Math.PI, Math.PI / 2) - - t.almostEqualDirection( - dir.dir, - { x: -1, y: 0, z: 0 }, - 'should point left' - ) - - t.end() - }) - - test('Component:createOrientation', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - t.almostEqualOrientation( - space.createOrientation(Math.PI).getRaw(), - { a: -1, b: 0 }, - 'should be upside down' - ) - - t.end() - }) -} diff --git a/test/components.test/Component.test/findCommonAncestor.test.js b/test/components.test/Component.test/findCommonAncestor.test.js deleted file mode 100644 index 902327e3..00000000 --- a/test/components.test/Component.test/findCommonAncestor.test.js +++ /dev/null @@ -1,61 +0,0 @@ -const template = require('./template.ejs') -const hierarchy = require('./hierarchy.ejs') - -module.exports = (test, container, tapspace) => { - // - const Component = tapspace.components.Component - - test('Component.findCommonAncestor', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - - // Construct a hierarchy of nodes - basis.element.innerHTML = hierarchy() - const na = new Component(basis.element.querySelector('#affine-a')) - const naa = new Component(basis.element.querySelector('#affine-aa')) - const naaa = new Component(basis.element.querySelector('#affine-aaa')) - const naab = new Component(basis.element.querySelector('#affine-aab')) - const naac = document.querySelector('#nonaffine-aac') - // naac is not affine - - // Common with self - t.equal( - na.findCommonAncestor(na), - na, - 'closest common with self' - ) - - // Common ancestor of non-affine - t.equal( - na.findCommonAncestor(naac), - null, - 'non-affine cannot have common' - ) - - // Parent-child - t.equal( - na.findCommonAncestor(naa), - na, - 'parent itself is the closest common' - ) - - // Ancestor - t.equal( - na.findCommonAncestor(naaa), - na, - 'ancestor is the closest common' - ) - - // Common parent - t.equal( - naaa.findCommonAncestor(naab), - naa, - 'common parent is the closest common' - ) - - t.end() - }) -} diff --git a/test/components.test/Component.test/index.js b/test/components.test/Component.test/index.js index f47c6dc5..d97c2c15 100644 --- a/test/components.test/Component.test/index.js +++ b/test/components.test/Component.test/index.js @@ -1,6 +1,4 @@ const units = { - createMethods: require('./createMethods.test'), - findCommonAncestor: require('./findCommonAncestor.test'), prependChild: require('./prependChild.test'), removeChild: require('./removeChild.test'), replaceChild: require('./replaceChild.test'), diff --git a/test/components.test/Space.test/at.test.js b/test/components.test/Space.test/at.test.js deleted file mode 100644 index 79db6456..00000000 --- a/test/components.test/Space.test/at.test.js +++ /dev/null @@ -1,23 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Space:at', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Take a point - const p = space.at(1, 2) - - t.almostEqualPoint( - p, - { basis: space, point: { x: 1, y: 2, z: 0 } }, - 'should fill z' - ) - - t.end() - }) -} diff --git a/test/components.test/Space.test/getBoundingBox.test.js b/test/components.test/Space.test/getBoundingBox.test.js deleted file mode 100644 index 17aad8e7..00000000 --- a/test/components.test/Space.test/getBoundingBox.test.js +++ /dev/null @@ -1,51 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Space:getBoundingBox', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Create items for boundary - const foo = tapspace.createItem('

Foo

') - foo.setSize(200, 200) - foo.setAnchor(0, 0) - const bar = tapspace.createItem('

Bar

') - bar.setSize(200, 200) - bar.setAnchor(0, 0) - - // Try to add off the space - space.addChild(foo, space.at(100, 100, 10)) - space.addChild(bar, space.at(500, 300, -10)) - - // Take the box - const bounds = space.getBoundingBox() - - t.deepEqual( - bounds.getSize().getRaw(), - { w: 600, h: 400, d: 20 }, - 'should have correct size' - ) - - // Take a custom orientation. - const orient = space.createOrientation(Math.PI / 4) - const orientedBounds = space.getBoundingBox(orient) - - t.almostEqualPoint( - orientedBounds.at(0, 0).changeBasis(space), - space.at(300, -100, -10), - 'should have matching origin' - ) - - t.almostEqualPoint( - orientedBounds.atNorm(1, 1).changeBasis(space), - space.at(500, 700, -10), - 'should have matching bottom right corner' - ) - - t.end() - }) -} diff --git a/test/components.test/Space.test/index.js b/test/components.test/Space.test/index.js deleted file mode 100644 index b0eaccb2..00000000 --- a/test/components.test/Space.test/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const units = { - at: require('./at.test'), - getBoundingBox: require('./getBoundingBox.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/components.test/Space.test/template.ejs b/test/components.test/Space.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/components.test/Space.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/components.test/Viewport.test/getAspectRatio.test.js b/test/components.test/Viewport.test/getAspectRatio.test.js deleted file mode 100644 index a638e319..00000000 --- a/test/components.test/Viewport.test/getAspectRatio.test.js +++ /dev/null @@ -1,16 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Viewport:getAspectRatio', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - - t.equal(typeof view.getAspectRatio(), 'number', 'should return number') - - t.end() - }) -} diff --git a/test/components.test/Viewport.test/index.js b/test/components.test/Viewport.test/index.js deleted file mode 100644 index 98aa166d..00000000 --- a/test/components.test/Viewport.test/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const units = { - getAspectRatio: require('./getAspectRatio.test'), - measureGroup: require('./measureGroup.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/components.test/Viewport.test/measureGroup.test.js b/test/components.test/Viewport.test/measureGroup.test.js deleted file mode 100644 index 5aae973c..00000000 --- a/test/components.test/Viewport.test/measureGroup.test.js +++ /dev/null @@ -1,38 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Viewport:measureGroup', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - - // Populate space - const space0 = tapspace.createSpace() - const space1 = tapspace.createSpace() - view.addChild(space0, view.at(0, 0)) - view.addChild(space1, view.at(100, 100)) - space1.scaleBy(2) - // Items to measure - const item00 = tapspace.createNode(10) - const item01 = tapspace.createNode(10) - space0.addChild(item00, space0.at(10, 20)) - space0.addChild(item01, space0.at(20, 40)) - const item10 = tapspace.createNode(10) - space1.addChild(item10, space1.at(10, 20)) - - const measures0 = view.measureGroup(space0) - t.equal(measures0.length, 3, 'should have three measurements') - t.equal(measures0[0].target, space0, 'should have space as first') - t.equal(measures0[1].target, item00, 'should have item as second') - t.equal(measures0[1].dilation, 1, 'should have correct dilation') - t.equal(measures0[1].areaPx, 400, 'should have correct area') - - const measures1 = view.measureGroup(space1) - t.equal(measures1.length, 2, 'should have num of measurements') - t.equal(measures1[1].dilation, 2, 'should have scaled dilation') - t.equal(measures1[1].areaPx, 1600, 'should have scaled area') - - t.end() - }) -} diff --git a/test/components.test/Viewport.test/template.ejs b/test/components.test/Viewport.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/components.test/Viewport.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/components.test/index.js b/test/components.test/index.js index add273c9..ea882d22 100644 --- a/test/components.test/index.js +++ b/test/components.test/index.js @@ -1,10 +1,7 @@ const units = { - Arc: require('./Arc.test'), Component: require('./Component.test'), FrameComponent: require('./FrameComponent.test'), - Item: require('./Item.test'), - Space: require('./Space.test'), - Viewport: require('./Viewport.test') + Item: require('./Item.test') } module.exports = (test, container, tapspace) => { From 44f7d0ccaba78f8c858e3894d0f8f3959b2dd008 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 01:39:17 +0200 Subject: [PATCH 046/118] rename headless test suites --- test/{suites.test.mjs => headless.test.mjs} | 0 test/{suites => headless}/components/Arc/getLength.html | 0 test/{suites => headless}/components/Arc/index.mjs | 0 .../components/Component/findCommonAncestor.html | 0 .../components/Component/geometryCreation.html | 0 test/{suites => headless}/components/Component/index.mjs | 0 test/{suites => headless}/components/Space/at.html | 0 test/{suites => headless}/components/Space/getBoundingBox.html | 0 test/{suites => headless}/components/Space/index.mjs | 0 test/{suites => headless}/components/Viewport/getAspectRatio.html | 0 test/{suites => headless}/components/Viewport/index.mjs | 0 test/{suites => headless}/components/Viewport/measureGroup.html | 0 test/{suites => headless}/components/index.mjs | 0 test/{suites => headless}/index.mjs | 0 test/{suites => headless}/testlib/testlib.js | 0 test/{suites => headless}/utils.mjs | 0 test/{suites => headless}/version/index.mjs | 0 test/{suites => headless}/version/version.html | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename test/{suites.test.mjs => headless.test.mjs} (100%) rename test/{suites => headless}/components/Arc/getLength.html (100%) rename test/{suites => headless}/components/Arc/index.mjs (100%) rename test/{suites => headless}/components/Component/findCommonAncestor.html (100%) rename test/{suites => headless}/components/Component/geometryCreation.html (100%) rename test/{suites => headless}/components/Component/index.mjs (100%) rename test/{suites => headless}/components/Space/at.html (100%) rename test/{suites => headless}/components/Space/getBoundingBox.html (100%) rename test/{suites => headless}/components/Space/index.mjs (100%) rename test/{suites => headless}/components/Viewport/getAspectRatio.html (100%) rename test/{suites => headless}/components/Viewport/index.mjs (100%) rename test/{suites => headless}/components/Viewport/measureGroup.html (100%) rename test/{suites => headless}/components/index.mjs (100%) rename test/{suites => headless}/index.mjs (100%) rename test/{suites => headless}/testlib/testlib.js (100%) rename test/{suites => headless}/utils.mjs (100%) rename test/{suites => headless}/version/index.mjs (100%) rename test/{suites => headless}/version/version.html (100%) diff --git a/test/suites.test.mjs b/test/headless.test.mjs similarity index 100% rename from test/suites.test.mjs rename to test/headless.test.mjs diff --git a/test/suites/components/Arc/getLength.html b/test/headless/components/Arc/getLength.html similarity index 100% rename from test/suites/components/Arc/getLength.html rename to test/headless/components/Arc/getLength.html diff --git a/test/suites/components/Arc/index.mjs b/test/headless/components/Arc/index.mjs similarity index 100% rename from test/suites/components/Arc/index.mjs rename to test/headless/components/Arc/index.mjs diff --git a/test/suites/components/Component/findCommonAncestor.html b/test/headless/components/Component/findCommonAncestor.html similarity index 100% rename from test/suites/components/Component/findCommonAncestor.html rename to test/headless/components/Component/findCommonAncestor.html diff --git a/test/suites/components/Component/geometryCreation.html b/test/headless/components/Component/geometryCreation.html similarity index 100% rename from test/suites/components/Component/geometryCreation.html rename to test/headless/components/Component/geometryCreation.html diff --git a/test/suites/components/Component/index.mjs b/test/headless/components/Component/index.mjs similarity index 100% rename from test/suites/components/Component/index.mjs rename to test/headless/components/Component/index.mjs diff --git a/test/suites/components/Space/at.html b/test/headless/components/Space/at.html similarity index 100% rename from test/suites/components/Space/at.html rename to test/headless/components/Space/at.html diff --git a/test/suites/components/Space/getBoundingBox.html b/test/headless/components/Space/getBoundingBox.html similarity index 100% rename from test/suites/components/Space/getBoundingBox.html rename to test/headless/components/Space/getBoundingBox.html diff --git a/test/suites/components/Space/index.mjs b/test/headless/components/Space/index.mjs similarity index 100% rename from test/suites/components/Space/index.mjs rename to test/headless/components/Space/index.mjs diff --git a/test/suites/components/Viewport/getAspectRatio.html b/test/headless/components/Viewport/getAspectRatio.html similarity index 100% rename from test/suites/components/Viewport/getAspectRatio.html rename to test/headless/components/Viewport/getAspectRatio.html diff --git a/test/suites/components/Viewport/index.mjs b/test/headless/components/Viewport/index.mjs similarity index 100% rename from test/suites/components/Viewport/index.mjs rename to test/headless/components/Viewport/index.mjs diff --git a/test/suites/components/Viewport/measureGroup.html b/test/headless/components/Viewport/measureGroup.html similarity index 100% rename from test/suites/components/Viewport/measureGroup.html rename to test/headless/components/Viewport/measureGroup.html diff --git a/test/suites/components/index.mjs b/test/headless/components/index.mjs similarity index 100% rename from test/suites/components/index.mjs rename to test/headless/components/index.mjs diff --git a/test/suites/index.mjs b/test/headless/index.mjs similarity index 100% rename from test/suites/index.mjs rename to test/headless/index.mjs diff --git a/test/suites/testlib/testlib.js b/test/headless/testlib/testlib.js similarity index 100% rename from test/suites/testlib/testlib.js rename to test/headless/testlib/testlib.js diff --git a/test/suites/utils.mjs b/test/headless/utils.mjs similarity index 100% rename from test/suites/utils.mjs rename to test/headless/utils.mjs diff --git a/test/suites/version/index.mjs b/test/headless/version/index.mjs similarity index 100% rename from test/suites/version/index.mjs rename to test/headless/version/index.mjs diff --git a/test/suites/version/version.html b/test/headless/version/version.html similarity index 100% rename from test/suites/version/version.html rename to test/headless/version/version.html From b8653dc55b23d079b8c203687b6a21f8ccfb6115 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 01:44:23 +0200 Subject: [PATCH 047/118] simplify headless test file structure --- test/{headless.test.mjs => headless/run.mjs} | 2 +- test/headless/{index.mjs => suites.mjs} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/{headless.test.mjs => headless/run.mjs} (95%) rename test/headless/{index.mjs => suites.mjs} (100%) diff --git a/test/headless.test.mjs b/test/headless/run.mjs similarity index 95% rename from test/headless.test.mjs rename to test/headless/run.mjs index fcb6d2d0..7bef6978 100644 --- a/test/headless.test.mjs +++ b/test/headless/run.mjs @@ -19,7 +19,7 @@ import puppeteer from 'puppeteer' import test from 'tape' // Suites -import testSuite from './suites/index.mjs' +import testSuite from './suites.mjs' // Setup const browser = await puppeteer.launch() diff --git a/test/headless/index.mjs b/test/headless/suites.mjs similarity index 100% rename from test/headless/index.mjs rename to test/headless/suites.mjs From e4add7bbab06578f8598f58dbe7c4f6877395136 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 01:45:02 +0200 Subject: [PATCH 048/118] add package script for test:headless --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 500d2c37..e56245df 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "lint:fix": "standard --fix 'lib/**/*.js' 'test/**/*.js'", "lint:lib": "standard 'lib/**/*.js'", "test": "npm run lint", + "test:headless": "npm run lint && npm run build && node test/headless/run.mjs", "test:browser": "npm run test:browser:build && npm run test:browser:open", "test:browser:open": "open -a \"Google Chrome\" test/browser.html", "test:browser:build": "webpack --config test/webpack.browser.config.js", From 0e84f761e3acfd77148010d2dd17dfa74a4d080a Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 01:56:13 +0200 Subject: [PATCH 049/118] migrate semantic version test --- test/headless/version/index.mjs | 2 ++ test/index.test.js | 2 -- test/version.test/index.js | 15 --------------- 3 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 test/version.test/index.js diff --git a/test/headless/version/index.mjs b/test/headless/version/index.mjs index 99778bd0..756c68be 100644 --- a/test/headless/version/index.mjs +++ b/test/headless/version/index.mjs @@ -1,5 +1,6 @@ import { getFileUrl } from '../utils.mjs' import { readFile } from 'fs/promises' +import semver from 'semver' const pjson = JSON.parse( await readFile(new URL('../../../package.json', import.meta.url)) @@ -18,6 +19,7 @@ export default function (test, browser) { // Assertions t.equal(typeof v, 'string', 'should be available') t.equal(v, pjson.version, 'should equal package version') + t.ok(semver.valid(v), 'semantically valid version') // Exit await page.close() diff --git a/test/index.test.js b/test/index.test.js index 8cb7e322..9168899d 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -2,8 +2,6 @@ const test = require('tape') const tapspace = window.tapspace const units = { - // General - version: require('./version.test'), // Geometry geometry: require('./geometry.test'), // Components diff --git a/test/version.test/index.js b/test/version.test/index.js deleted file mode 100644 index e6443b7e..00000000 --- a/test/version.test/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const tapspace = require('../../index') -const pjson = require('../../package.json') -const semver = require('semver') - -module.exports = (test) => { - test('tapspace.version: correctly formatted', (t) => { - t.ok(semver.valid(tapspace.version), 'valid semantic version') - t.end() - }) - - test('tapspace.version: match package.json', (t) => { - t.equal(tapspace.version, pjson.version, 'version match') - t.end() - }) -} From e5587e8c57461d2a0c47a2d17743eeb3e8a7d2a9 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 02:50:04 +0200 Subject: [PATCH 050/118] implement testlib assert deepEqual --- test/headless/testlib/testlib.js | 69 ++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/test/headless/testlib/testlib.js b/test/headless/testlib/testlib.js index 3a9c5372..79488fa6 100644 --- a/test/headless/testlib/testlib.js +++ b/test/headless/testlib/testlib.js @@ -75,6 +75,53 @@ const toSerializable = (val) => { return obj } +const deepEqual = (x, y) => { + if (x === y) { + return true + } + // Not strictly equal. + if (!x || !y) { + return false + } + // Values not nullish. + if (typeof x !== 'object' || typeof y !== 'object') { + return false + } + // Values are objects. Arrays? + if (Array.isArray(x) && Array.isArray(y)) { + if (x.length !== y.length) { + return false + } + // Arrays equal length. + let every = true + for (let i = 0; every && i < x.length; i += 1) { + every = every && deepEqual(x[i], y[i]) + } + // Array elements deeply equal. + return every + } + // Not both arrays, maybe separately? + if (Array.isArray(x) || Array.isArray(y)) { + return false + } + // Not nullish, not arrays, are objects. + // Note that key order must not matter. + const xkeys = Object.keys(x) + const ykeys = Object.keys(y) + if (xkeys.length !== ykeys.length) { + return false + } + let every = true + for (let i = 0; every && i < xkeys.length; i += 1) { + const key = xkeys[i] + const xval = x[key] + const yval = y[key] + every = every && deepEqual(xval, yval) + } + // Every property deeply equal. + return every +} + // Global simpleton test class. window.test = { planned: -1, @@ -143,6 +190,17 @@ window.test = { }) }, + deepEqual: function (actual, expected, message) { + const isDeepEqual = deepEqual(actual, expected) + this.results.push({ + result: isDeepEqual, + operator: 'deepEqual', + message: message || 'values should be deeply equal', + actual, + expected + }) + }, + equal: function (actual, expected, message) { const isEqual = actual === expected this.results.push({ @@ -154,6 +212,17 @@ window.test = { }) }, + notEqual: function (actual, expected, message) { + const isNotEqual = actual !== expected + this.results.push({ + result: isNotEqual, + operator: 'notEqual', + message: message || 'values should not be strictly equal', + actual, + expected + }) + }, + ok: function (actual, message) { if (typeof actual !== 'boolean') { actual = false From eae420aa40b4bd694e615c341fd96fd0e6045ad8 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 02:51:06 +0200 Subject: [PATCH 051/118] migrate Component tests: prependChild, removeChild, replaceChild, replaceParent --- .../Component/findCommonAncestor.html | 3 +- test/headless/components/Component/index.mjs | 4 + .../components/Component/prependChild.html | 75 ++++++++++++++++ .../components/Component/removeChild.html | 90 +++++++++++++++++++ .../components/Component/replaceChild.html | 72 +++++++++++++++ .../components/Component/replaceParent.html | 62 +++++++++++++ 6 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 test/headless/components/Component/prependChild.html create mode 100644 test/headless/components/Component/removeChild.html create mode 100644 test/headless/components/Component/replaceChild.html create mode 100644 test/headless/components/Component/replaceParent.html diff --git a/test/headless/components/Component/findCommonAncestor.html b/test/headless/components/Component/findCommonAncestor.html index d81b6504..1cd8cbe0 100644 --- a/test/headless/components/Component/findCommonAncestor.html +++ b/test/headless/components/Component/findCommonAncestor.html @@ -28,8 +28,9 @@
+ + + +
+
+
+ + + diff --git a/test/headless/components/Component/removeChild.html b/test/headless/components/Component/removeChild.html new file mode 100644 index 00000000..5d822698 --- /dev/null +++ b/test/headless/components/Component/removeChild.html @@ -0,0 +1,90 @@ + + + + + Component:removeChild - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Component/replaceChild.html b/test/headless/components/Component/replaceChild.html new file mode 100644 index 00000000..78c1200a --- /dev/null +++ b/test/headless/components/Component/replaceChild.html @@ -0,0 +1,72 @@ + + + + + Component:replaceChild - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Component/replaceParent.html b/test/headless/components/Component/replaceParent.html new file mode 100644 index 00000000..f747f3fe --- /dev/null +++ b/test/headless/components/Component/replaceParent.html @@ -0,0 +1,62 @@ + + + + + Component:replaceParent - Tapspace Test + + + + + +
+
+
+ + + From 5254314da7ccea557ca0169c0b8be300c0b7a715 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 7 Jan 2025 02:53:15 +0200 Subject: [PATCH 052/118] remove migrated original Component tests --- .../Component.test/hierarchy.ejs | 10 ---- test/components.test/Component.test/index.js | 4 -- .../Component.test/prependChild.test.js | 42 -------------- .../Component.test/removeChild.test.js | 57 ------------------- .../Component.test/replaceChild.test.js | 47 --------------- .../Component.test/replaceParent.test.js | 37 ------------ 6 files changed, 197 deletions(-) delete mode 100644 test/components.test/Component.test/hierarchy.ejs delete mode 100644 test/components.test/Component.test/prependChild.test.js delete mode 100644 test/components.test/Component.test/removeChild.test.js delete mode 100644 test/components.test/Component.test/replaceChild.test.js delete mode 100644 test/components.test/Component.test/replaceParent.test.js diff --git a/test/components.test/Component.test/hierarchy.ejs b/test/components.test/Component.test/hierarchy.ejs deleted file mode 100644 index a8567528..00000000 --- a/test/components.test/Component.test/hierarchy.ejs +++ /dev/null @@ -1,10 +0,0 @@ -
-
-
-
-
-
-
-
-
-
diff --git a/test/components.test/Component.test/index.js b/test/components.test/Component.test/index.js index d97c2c15..5e7e5dea 100644 --- a/test/components.test/Component.test/index.js +++ b/test/components.test/Component.test/index.js @@ -1,8 +1,4 @@ const units = { - prependChild: require('./prependChild.test'), - removeChild: require('./removeChild.test'), - replaceChild: require('./replaceChild.test'), - replaceParent: require('./replaceParent.test'), setId: require('./setId.test'), setParent: require('./setParent.test') } diff --git a/test/components.test/Component.test/prependChild.test.js b/test/components.test/Component.test/prependChild.test.js deleted file mode 100644 index 57e395ec..00000000 --- a/test/components.test/Component.test/prependChild.test.js +++ /dev/null @@ -1,42 +0,0 @@ -const template = require('./template.ejs') -const hierarchy = require('./hierarchy.ejs') - -module.exports = (test, container, tapspace) => { - // - const Component = tapspace.components.Component - - test('Component:prependChild', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - - // Construct a hierarchy of nodes - basis.element.innerHTML = hierarchy() - // eslint-disable-next-line - const na = new Component(basis.element.querySelector('#affine-a')) - const naa = new Component(basis.element.querySelector('#affine-aa')) - const naaa = new Component(basis.element.querySelector('#affine-aaa')) - const naab = new Component(basis.element.querySelector('#affine-aab')) - // const naac = document.querySelector('#nonaffine-aac') - // naac is not affine - - t.equal( - naa.getElement().firstElementChild, - naaa.getElement(), - 'should be first' - ) - - // Move naab to first - naa.prependChild(naab) - - t.equal( - naa.getElement().firstElementChild, - naab.getElement(), - 'should have moved first' - ) - - t.end() - }) -} diff --git a/test/components.test/Component.test/removeChild.test.js b/test/components.test/Component.test/removeChild.test.js deleted file mode 100644 index 8bc662ea..00000000 --- a/test/components.test/Component.test/removeChild.test.js +++ /dev/null @@ -1,57 +0,0 @@ -const template = require('./template.ejs') -const hierarchy = require('./hierarchy.ejs') - -module.exports = (test, container, tapspace) => { - // - const Component = tapspace.components.Component - - test('Component:removeChild', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // HACK Construct a hierarchy of nodes - space.element.innerHTML = hierarchy() - // eslint-disable-next-line - const na = new Component(space.element.querySelector('#affine-a')) - const naa = new Component(space.element.querySelector('#affine-aa')) - const naaa = new Component(space.element.querySelector('#affine-aaa')) - const naab = new Component(space.element.querySelector('#affine-aab')) - // const naac = document.querySelector('#nonaffine-aac') - // naac is not affine - - // Ensure connected - t.equal( - naab.getViewport(), - view, - 'should be connected to view' - ) - - // Remove leaf - naab.remove() - t.equal( - naab.getViewport(), - null, - 'should be disconnected via remove' - ) - - // Ensure connected - t.equal( - naaa.getViewport(), - view, - 'should be connected to view' - ) - - // Remove child - naa.removeChild(naaa) - t.equal( - naaa.getViewport(), - null, - 'should be disconnected via removeChild' - ) - - t.end() - }) -} diff --git a/test/components.test/Component.test/replaceChild.test.js b/test/components.test/Component.test/replaceChild.test.js deleted file mode 100644 index 1c7a24bb..00000000 --- a/test/components.test/Component.test/replaceChild.test.js +++ /dev/null @@ -1,47 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Component:replaceChild', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space, view.at(100, 50)) - - const item = tapspace.createItem('

Hello

') - item.setSize(400, 200) - space.addChild(item, space.at(300, 150)) - - // Create the replacement, note we try different size. - const rival = tapspace.createItem('

World

') - rival.setSize(600, 300) - - // Sample a coordinate. - const before = item.at(0, 0).transitRaw(view) - - // Replace - space.replaceChild(item, rival) - - // Sample the same coordinate again - const after = rival.at(0, 0).transitRaw(view) - - t.equal(item.getParent(), null, 'should not have parent') - t.equal(rival.getParent(), space, 'should have parent') - - t.deepEqual( - after, - before, - 'samples should match' - ) - - // Ensure item size was not carried to the rival. - t.deepEqual( - rival.atBottomRight().transitRaw(view), - { x: 1000, y: 500, z: 0 }, - 'should have correctly size-offset corner' - ) - - t.end() - }) -} diff --git a/test/components.test/Component.test/replaceParent.test.js b/test/components.test/Component.test/replaceParent.test.js deleted file mode 100644 index c0819788..00000000 --- a/test/components.test/Component.test/replaceParent.test.js +++ /dev/null @@ -1,37 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Component:replaceParent', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space, view.at(100, 50)) - const backyard = tapspace.createSpace() - view.addChild(backyard, view.at(200, 100)) - - const item = tapspace.createItem('

Hello

') - item.setSize(400, 200) - space.addChild(item, space.at(300, 150)) - - // Store a point - const before = item.atCenter().transitRaw(view) - - // Reparent - item.replaceParent(backyard) - - // Sample the point again - const after = item.atCenter().transitRaw(view) - - t.notEqual(item.getParent(), space, 'should have new parent') - - t.deepEqual( - after, - before, - 'points should match' - ) - - t.end() - }) -} From c06d3926b3c3193287d7ac0c4972b9bfbe120c16 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 8 Jan 2025 16:26:55 +0200 Subject: [PATCH 053/118] add new assertion method to headless testlib: throws --- test/headless/testlib/testlib.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/headless/testlib/testlib.js b/test/headless/testlib/testlib.js index 79488fa6..16798f9e 100644 --- a/test/headless/testlib/testlib.js +++ b/test/headless/testlib/testlib.js @@ -248,5 +248,23 @@ window.test = { actual, expected: false }) + }, + + throws: function (fn, message) { + let result = false + // let exception = null + try { + fn() + } catch (e) { + result = true + // exception = e + } + this.results.push({ + result, + operator: 'throws', + message: message || 'function should throw an exception', + actual: result, + expected: true + }) } } From a6409dfb2803c2090b4196a03dfbaa2ec7e97c53 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 8 Jan 2025 16:28:43 +0200 Subject: [PATCH 054/118] migrate Component tests: setId, setParent --- test/components.test/Component.test/index.js | 10 --- .../Component.test/setId.test.js | 20 ----- .../Component.test/setParent.test.js | 56 ------------- .../Component.test/template.ejs | 1 - test/components.test/index.js | 1 - test/headless/components/Component/index.mjs | 2 + test/headless/components/Component/setId.html | 48 +++++++++++ .../components/Component/setParent.html | 82 +++++++++++++++++++ 8 files changed, 132 insertions(+), 88 deletions(-) delete mode 100644 test/components.test/Component.test/index.js delete mode 100644 test/components.test/Component.test/setId.test.js delete mode 100644 test/components.test/Component.test/setParent.test.js delete mode 100644 test/components.test/Component.test/template.ejs create mode 100644 test/headless/components/Component/setId.html create mode 100644 test/headless/components/Component/setParent.html diff --git a/test/components.test/Component.test/index.js b/test/components.test/Component.test/index.js deleted file mode 100644 index 5e7e5dea..00000000 --- a/test/components.test/Component.test/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const units = { - setId: require('./setId.test'), - setParent: require('./setParent.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/components.test/Component.test/setId.test.js b/test/components.test/Component.test/setId.test.js deleted file mode 100644 index af8bfd2a..00000000 --- a/test/components.test/Component.test/setId.test.js +++ /dev/null @@ -1,20 +0,0 @@ -const template = require('./template.ejs') - -module.exports = (test, container, tapspace) => { - // - test('Component:setId', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - - // Set basis id - basis.setId('hero') - - // Common with self - t.equal(basis.element.id, 'hero', 'should be new element id') - - t.end() - }) -} diff --git a/test/components.test/Component.test/setParent.test.js b/test/components.test/Component.test/setParent.test.js deleted file mode 100644 index d00cf61f..00000000 --- a/test/components.test/Component.test/setParent.test.js +++ /dev/null @@ -1,56 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Component:setParent', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space, view.at(100, 50)) - const backyard = tapspace.createSpace() - view.addChild(backyard, view.at(200, 100)) - - const item = tapspace.createItem('

Hello

') - item.setSize(400, 200) - - t.equal(item.getParent(), null, 'should have no parent') - - // Set parent without position - item.setParent(space) - - t.deepEqual( - item.at(0, 0).transitRaw(view), - { x: 100, y: 50, z: 0 }, - 'should be at default position' - ) - - t.equal(item.getParent(), space, 'should have parent') - - // Replace parent with position. - item.setParent(backyard, backyard.at(200, 100)) - - t.equal(item.getParent(), backyard, 'should have correct parent') - - t.deepEqual( - item.at(0, 0).transitRaw(view), - { x: 400, y: 200, z: 0 }, - 'should have correct position' - ) - - // Replace parent without position - item.setParent(space) - t.equal(item.getParent(), space, 'should have space parent') - t.deepEqual( - item.at(0, 0).transitRaw(space), - { x: 200, y: 100, z: 0 }, - 'should preserve local position' - ) - - t.throws(() => { - item.setParent(null) - }, 'should detect non-existing parent') - - t.end() - }) -} diff --git a/test/components.test/Component.test/template.ejs b/test/components.test/Component.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/components.test/Component.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/components.test/index.js b/test/components.test/index.js index ea882d22..4badcd6e 100644 --- a/test/components.test/index.js +++ b/test/components.test/index.js @@ -1,5 +1,4 @@ const units = { - Component: require('./Component.test'), FrameComponent: require('./FrameComponent.test'), Item: require('./Item.test') } diff --git a/test/headless/components/Component/index.mjs b/test/headless/components/Component/index.mjs index b809b153..5d8457f6 100644 --- a/test/headless/components/Component/index.mjs +++ b/test/headless/components/Component/index.mjs @@ -5,4 +5,6 @@ export default function (test) { test('Component: removeChild', import.meta.dirname, 'removeChild.html') test('Component: replaceChild', import.meta.dirname, 'replaceChild.html') test('Component: replaceParent', import.meta.dirname, 'replaceParent.html') + test('Component: setId', import.meta.dirname, 'setId.html') + test('Component: setParent', import.meta.dirname, 'setParent.html') } diff --git a/test/headless/components/Component/setId.html b/test/headless/components/Component/setId.html new file mode 100644 index 00000000..b2ff89dc --- /dev/null +++ b/test/headless/components/Component/setId.html @@ -0,0 +1,48 @@ + + + + + Component:setId - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Component/setParent.html b/test/headless/components/Component/setParent.html new file mode 100644 index 00000000..2b963c0b --- /dev/null +++ b/test/headless/components/Component/setParent.html @@ -0,0 +1,82 @@ + + + + + Component:setParent - Tapspace Test + + + + + +
+
+
+ + + From 5fa9cfd021343491b6a1311ad652f9d4995951d4 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 8 Jan 2025 16:46:47 +0200 Subject: [PATCH 055/118] migrate FrameComponent tests: resizeTo, transformToFill, transformToFit --- .../FrameComponent.test/index.js | 11 ---- .../FrameComponent.test/resizeTo.test.js | 47 ------------- .../FrameComponent.test/template.ejs | 1 - .../transformToFill.test.js | 39 ----------- .../transformToFit.test.js | 39 ----------- test/components.test/index.js | 1 - .../components/FrameComponent/index.mjs | 5 ++ .../components/FrameComponent/resizeTo.html | 66 +++++++++++++++++++ .../FrameComponent/transformToFill.html | 62 +++++++++++++++++ .../FrameComponent/transformToFit.html | 62 +++++++++++++++++ test/headless/components/index.mjs | 2 + 11 files changed, 197 insertions(+), 138 deletions(-) delete mode 100644 test/components.test/FrameComponent.test/index.js delete mode 100644 test/components.test/FrameComponent.test/resizeTo.test.js delete mode 100644 test/components.test/FrameComponent.test/template.ejs delete mode 100644 test/components.test/FrameComponent.test/transformToFill.test.js delete mode 100644 test/components.test/FrameComponent.test/transformToFit.test.js create mode 100644 test/headless/components/FrameComponent/index.mjs create mode 100644 test/headless/components/FrameComponent/resizeTo.html create mode 100644 test/headless/components/FrameComponent/transformToFill.html create mode 100644 test/headless/components/FrameComponent/transformToFit.html diff --git a/test/components.test/FrameComponent.test/index.js b/test/components.test/FrameComponent.test/index.js deleted file mode 100644 index 66c3cd54..00000000 --- a/test/components.test/FrameComponent.test/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const units = { - resizeTo: require('./resizeTo.test'), - transformToFill: require('./transformToFill.test'), - transformToFit: require('./transformToFit.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/components.test/FrameComponent.test/resizeTo.test.js b/test/components.test/FrameComponent.test/resizeTo.test.js deleted file mode 100644 index 0e26f04f..00000000 --- a/test/components.test/FrameComponent.test/resizeTo.test.js +++ /dev/null @@ -1,47 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('FrameComponent:resizeTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createItem('

Hello

') - item.setSize(400, 200) - item.setAnchor(200, 100) - space.addChild(item, space.at(200, 100)) - - // Ensure setup - t.almostEqualPoint( - item.at(0, 0).changeBasis(view), - view.at(0, 0), - 'should match viewport' - ) - - // Resize operation - item.resizeTo({ w: 300, h: 100 }, item.atBottomRight()) - - t.almostEqualPoint( - item.at(0, 0).changeBasis(view), - view.at(100, 100), - 'should have moved' - ) - - t.almostEqualPoint( - item.atBottomRight().changeBasis(view), - view.at(400, 200), - 'should have preserved corner position' - ) - - t.almostEqualPoint( - item.atAnchor().changeBasis(view), - view.at(250, 150), - 'should have preserved origin at middle' - ) - - t.end() - }) -} diff --git a/test/components.test/FrameComponent.test/template.ejs b/test/components.test/FrameComponent.test/template.ejs deleted file mode 100644 index 504ff76e..00000000 --- a/test/components.test/FrameComponent.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/components.test/FrameComponent.test/transformToFill.test.js b/test/components.test/FrameComponent.test/transformToFill.test.js deleted file mode 100644 index 4779669d..00000000 --- a/test/components.test/FrameComponent.test/transformToFill.test.js +++ /dev/null @@ -1,39 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('FrameComponent:resizeTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const air = tapspace.createItem('

Air

') - air.setSize(100, 100) - air.setAnchor(50, 50) - air.setParent(space, space.at(0, 0)) - - const balloon = tapspace.createItem('

Balloon

') - balloon.setSize(200, 400) - balloon.setAnchor(100, 200) - balloon.setParent(space, space.at(400, 400)) // zero at (300, 200) - - // Operation - air.transformToFill(balloon) - - t.almostEqualPoint( - air.atNorm(0, 0).changeBasis(view).getRaw(), - balloon.at(-100, 0).changeBasis(view).getRaw(), - 'should extend beyond balloon left' - ) - - t.almostEqualPoint( - air.atNorm(1, 1).changeBasis(view).getRaw(), - balloon.at(300, 400).changeBasis(view).getRaw(), - 'should extend beyond balloon right' - ) - - t.end() - }) -} diff --git a/test/components.test/FrameComponent.test/transformToFit.test.js b/test/components.test/FrameComponent.test/transformToFit.test.js deleted file mode 100644 index 9a764ede..00000000 --- a/test/components.test/FrameComponent.test/transformToFit.test.js +++ /dev/null @@ -1,39 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('FrameComponent:resizeTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const air = tapspace.createItem('

Air

') - air.setSize(100, 100) - air.setAnchor(50, 50) - air.setParent(space, space.at(0, 0)) - - const balloon = tapspace.createItem('

Balloon

') - balloon.setSize(200, 400) - balloon.setAnchor(100, 200) - balloon.setParent(space, space.at(400, 400)) // zero at (300, 200) - - // Operation - air.transformToFit(balloon) - - t.almostEqualPoint( - air.atNorm(0, 0).changeBasis(view).getRaw(), - balloon.at(0, 100).changeBasis(view).getRaw(), - 'should match balloon left' - ) - - t.almostEqualPoint( - air.atNorm(1, 1).changeBasis(view).getRaw(), - balloon.at(200, 300).changeBasis(view).getRaw(), - 'should match balloon right' - ) - - t.end() - }) -} diff --git a/test/components.test/index.js b/test/components.test/index.js index 4badcd6e..5879e340 100644 --- a/test/components.test/index.js +++ b/test/components.test/index.js @@ -1,5 +1,4 @@ const units = { - FrameComponent: require('./FrameComponent.test'), Item: require('./Item.test') } diff --git a/test/headless/components/FrameComponent/index.mjs b/test/headless/components/FrameComponent/index.mjs new file mode 100644 index 00000000..2c8f4c2c --- /dev/null +++ b/test/headless/components/FrameComponent/index.mjs @@ -0,0 +1,5 @@ +export default function (test) { + test('FrameComponent: resizeTo', import.meta.dirname, 'resizeTo.html') + test('FrameComponent: transformToFill', import.meta.dirname, 'transformToFill.html') + test('FrameComponent: transformToFit', import.meta.dirname, 'transformToFit.html') +} diff --git a/test/headless/components/FrameComponent/resizeTo.html b/test/headless/components/FrameComponent/resizeTo.html new file mode 100644 index 00000000..87d21695 --- /dev/null +++ b/test/headless/components/FrameComponent/resizeTo.html @@ -0,0 +1,66 @@ + + + + + FrameComponent:resizeTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/FrameComponent/transformToFill.html b/test/headless/components/FrameComponent/transformToFill.html new file mode 100644 index 00000000..635329d7 --- /dev/null +++ b/test/headless/components/FrameComponent/transformToFill.html @@ -0,0 +1,62 @@ + + + + + FrameComponent:transformToFill - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/FrameComponent/transformToFit.html b/test/headless/components/FrameComponent/transformToFit.html new file mode 100644 index 00000000..2dd20b87 --- /dev/null +++ b/test/headless/components/FrameComponent/transformToFit.html @@ -0,0 +1,62 @@ + + + + + FrameComponent:transformToFit - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/index.mjs b/test/headless/components/index.mjs index d713c4d4..c297c895 100644 --- a/test/headless/components/index.mjs +++ b/test/headless/components/index.mjs @@ -1,5 +1,6 @@ import testArc from './Arc/index.mjs' import testComponent from './Component/index.mjs' +import testFrameComponent from './FrameComponent/index.mjs' import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' import { getFileUrl } from '../utils.mjs' @@ -36,6 +37,7 @@ export default function (test, browser) { testArc(testAllOk) testComponent(testAllOk) + testFrameComponent(testAllOk) testSpace(testAllOk) testViewport(testAllOk) } From 99b6467cffad2ac7969cecaec34145c55437d7b1 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 8 Jan 2025 16:59:43 +0200 Subject: [PATCH 056/118] add note about testlib structure --- test/headless/testlib/testlib.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/headless/testlib/testlib.js b/test/headless/testlib/testlib.js index 16798f9e..93e68a98 100644 --- a/test/headless/testlib/testlib.js +++ b/test/headless/testlib/testlib.js @@ -10,6 +10,12 @@ // - Assert with test.equal(), .almostEqual() and test.ok() // - Access results via test.report() // +// Developer note: +// - Keep everything in this single file to avoid need +// to deal with module import statements and +// browsers' CORS requirements for modules or any +// bundle build setup. +// // Licence: MIT // Copyright: Akseli Palén, 2025 // From eb101db9094321f3ceffcba7121fd3db1aebb07c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 8 Jan 2025 22:16:04 +0200 Subject: [PATCH 057/118] simplify headless suite testlib structure --- test/headless/components/Arc/getLength.html | 2 +- test/headless/components/Component/findCommonAncestor.html | 2 +- test/headless/components/Component/geometryCreation.html | 2 +- test/headless/components/Component/prependChild.html | 2 +- test/headless/components/Component/removeChild.html | 2 +- test/headless/components/Component/replaceChild.html | 2 +- test/headless/components/Component/replaceParent.html | 2 +- test/headless/components/Component/setId.html | 2 +- test/headless/components/Component/setParent.html | 2 +- test/headless/components/FrameComponent/resizeTo.html | 2 +- test/headless/components/FrameComponent/transformToFill.html | 2 +- test/headless/components/FrameComponent/transformToFit.html | 2 +- test/headless/components/Space/at.html | 2 +- test/headless/components/Space/getBoundingBox.html | 2 +- test/headless/components/Viewport/getAspectRatio.html | 2 +- test/headless/components/Viewport/measureGroup.html | 2 +- test/headless/{testlib => }/testlib.js | 0 17 files changed, 16 insertions(+), 16 deletions(-) rename test/headless/{testlib => }/testlib.js (100%) diff --git a/test/headless/components/Arc/getLength.html b/test/headless/components/Arc/getLength.html index d58f113b..8c63594f 100644 --- a/test/headless/components/Arc/getLength.html +++ b/test/headless/components/Arc/getLength.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/findCommonAncestor.html b/test/headless/components/Component/findCommonAncestor.html index 1cd8cbe0..ccd3077f 100644 --- a/test/headless/components/Component/findCommonAncestor.html +++ b/test/headless/components/Component/findCommonAncestor.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/geometryCreation.html b/test/headless/components/Component/geometryCreation.html index 96a7cbf4..01e182b3 100644 --- a/test/headless/components/Component/geometryCreation.html +++ b/test/headless/components/Component/geometryCreation.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/prependChild.html b/test/headless/components/Component/prependChild.html index 5b7ed4c1..f4105ca8 100644 --- a/test/headless/components/Component/prependChild.html +++ b/test/headless/components/Component/prependChild.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/removeChild.html b/test/headless/components/Component/removeChild.html index 5d822698..a59adcb0 100644 --- a/test/headless/components/Component/removeChild.html +++ b/test/headless/components/Component/removeChild.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/replaceChild.html b/test/headless/components/Component/replaceChild.html index 78c1200a..2ead30ea 100644 --- a/test/headless/components/Component/replaceChild.html +++ b/test/headless/components/Component/replaceChild.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/replaceParent.html b/test/headless/components/Component/replaceParent.html index f747f3fe..ea969855 100644 --- a/test/headless/components/Component/replaceParent.html +++ b/test/headless/components/Component/replaceParent.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/setId.html b/test/headless/components/Component/setId.html index b2ff89dc..0ccd7db2 100644 --- a/test/headless/components/Component/setId.html +++ b/test/headless/components/Component/setId.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Component/setParent.html b/test/headless/components/Component/setParent.html index 2b963c0b..03229f28 100644 --- a/test/headless/components/Component/setParent.html +++ b/test/headless/components/Component/setParent.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/FrameComponent/resizeTo.html b/test/headless/components/FrameComponent/resizeTo.html index 87d21695..093517e0 100644 --- a/test/headless/components/FrameComponent/resizeTo.html +++ b/test/headless/components/FrameComponent/resizeTo.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/FrameComponent/transformToFill.html b/test/headless/components/FrameComponent/transformToFill.html index 635329d7..8ab52698 100644 --- a/test/headless/components/FrameComponent/transformToFill.html +++ b/test/headless/components/FrameComponent/transformToFill.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/FrameComponent/transformToFit.html b/test/headless/components/FrameComponent/transformToFit.html index 2dd20b87..5db1d4a4 100644 --- a/test/headless/components/FrameComponent/transformToFit.html +++ b/test/headless/components/FrameComponent/transformToFit.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Space/at.html b/test/headless/components/Space/at.html index f6b70a2e..e39a1dcc 100644 --- a/test/headless/components/Space/at.html +++ b/test/headless/components/Space/at.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Space/getBoundingBox.html b/test/headless/components/Space/getBoundingBox.html index 36a80897..3cfaed52 100644 --- a/test/headless/components/Space/getBoundingBox.html +++ b/test/headless/components/Space/getBoundingBox.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Viewport/getAspectRatio.html b/test/headless/components/Viewport/getAspectRatio.html index 7f048403..14917ba9 100644 --- a/test/headless/components/Viewport/getAspectRatio.html +++ b/test/headless/components/Viewport/getAspectRatio.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/components/Viewport/measureGroup.html b/test/headless/components/Viewport/measureGroup.html index 031028a9..9d6fd236 100644 --- a/test/headless/components/Viewport/measureGroup.html +++ b/test/headless/components/Viewport/measureGroup.html @@ -21,7 +21,7 @@ } - +
diff --git a/test/headless/testlib/testlib.js b/test/headless/testlib.js similarity index 100% rename from test/headless/testlib/testlib.js rename to test/headless/testlib.js From 517c616f34b0f1aa2fe3850f5f8ece2b0f111908 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 9 Jan 2025 00:03:35 +0200 Subject: [PATCH 058/118] migrate Item tests --- test/components.test/Item.test/at.test.js | 28 ------- .../Item.test/createVector.test.js | 30 -------- .../Item.test/getDistanceTo.test.js | 31 -------- .../Item.test/getVectorTo.test.js | 31 -------- test/components.test/Item.test/index.js | 21 ----- test/components.test/Item.test/meta.test.js | 14 ---- .../Item.test/rotateBy.test.js | 29 ------- .../Item.test/setBasis.test.js | 44 ----------- .../Item.test/setOrientation.test.js | 32 -------- .../Item.test/setScale.test.js | 39 ---------- test/components.test/Item.test/template.ejs | 1 - test/components.test/index.js | 9 --- test/headless/components/Item/at.html | 54 +++++++++++++ .../components/Item/boundaries.html} | 76 +++++++++---------- .../components/Item/createVector.html | 56 ++++++++++++++ .../components/Item/getDistanceTo.html | 58 ++++++++++++++ .../headless/components/Item/getVectorTo.html | 57 ++++++++++++++ test/headless/components/Item/index.mjs | 21 +++++ .../components/Item/matchBasis.html} | 52 +++++++++---- test/headless/components/Item/rotateBy.html | 55 ++++++++++++++ test/headless/components/Item/setBasis.html | 65 ++++++++++++++++ .../components/Item/setOrientation.html | 56 ++++++++++++++ test/headless/components/Item/setScale.html | 64 ++++++++++++++++ .../components/Item/transformBy.html} | 44 ++++++++--- test/headless/components/index.mjs | 4 + test/headless/testlib.js | 25 ++++-- test/index.test.js | 4 +- 27 files changed, 619 insertions(+), 381 deletions(-) delete mode 100644 test/components.test/Item.test/at.test.js delete mode 100644 test/components.test/Item.test/createVector.test.js delete mode 100644 test/components.test/Item.test/getDistanceTo.test.js delete mode 100644 test/components.test/Item.test/getVectorTo.test.js delete mode 100644 test/components.test/Item.test/index.js delete mode 100644 test/components.test/Item.test/meta.test.js delete mode 100644 test/components.test/Item.test/rotateBy.test.js delete mode 100644 test/components.test/Item.test/setBasis.test.js delete mode 100644 test/components.test/Item.test/setOrientation.test.js delete mode 100644 test/components.test/Item.test/setScale.test.js delete mode 100644 test/components.test/Item.test/template.ejs delete mode 100644 test/components.test/index.js create mode 100644 test/headless/components/Item/at.html rename test/{components.test/Item.test/boundaries.test.js => headless/components/Item/boundaries.html} (54%) create mode 100644 test/headless/components/Item/createVector.html create mode 100644 test/headless/components/Item/getDistanceTo.html create mode 100644 test/headless/components/Item/getVectorTo.html create mode 100644 test/headless/components/Item/index.mjs rename test/{components.test/Item.test/matchBasis.test.js => headless/components/Item/matchBasis.html} (53%) create mode 100644 test/headless/components/Item/rotateBy.html create mode 100644 test/headless/components/Item/setBasis.html create mode 100644 test/headless/components/Item/setOrientation.html create mode 100644 test/headless/components/Item/setScale.html rename test/{components.test/Item.test/transformBy.test.js => headless/components/Item/transformBy.html} (55%) diff --git a/test/components.test/Item.test/at.test.js b/test/components.test/Item.test/at.test.js deleted file mode 100644 index a0902082..00000000 --- a/test/components.test/Item.test/at.test.js +++ /dev/null @@ -1,28 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:at', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - - const item = tapspace.createItem('

Hello

') - basis.addChild(item) - item.translateBy({ x: 10, y: 6 }) - - const xyOnElem = item.at(0, 0) - const xyOnView = item.at(0, 0).changeBasis(view) - - t.equal(xyOnElem.basis, item, 'item is the basis') - t.equal(xyOnElem.point.x, 0) - t.equal(xyOnElem.point.y, 0) - t.equal(xyOnView.basis, view, 'view is the basis') - t.equal(xyOnView.point.x, 10, 'view x match') - t.equal(xyOnView.point.y, 6, 'view y match') - - t.end() - }) -} diff --git a/test/components.test/Item.test/createVector.test.js b/test/components.test/Item.test/createVector.test.js deleted file mode 100644 index 687e1abd..00000000 --- a/test/components.test/Item.test/createVector.test.js +++ /dev/null @@ -1,30 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:createVector', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createItem('

Hello

') - space.addChild(item) - item.translateBy({ x: 10, y: 6 }) - - t.deepEqual( - item.createVector(1, 2).transitRaw(space), - { x: 1, y: 2, z: 0 }, - 'translation should not affect' - ) - - t.deepEqual( - item.createVector(1, 2, 3).transitRaw(space), - { x: 1, y: 2, z: 3 }, - 'allow z coordinate' - ) - - t.end() - }) -} diff --git a/test/components.test/Item.test/getDistanceTo.test.js b/test/components.test/Item.test/getDistanceTo.test.js deleted file mode 100644 index 0b4394be..00000000 --- a/test/components.test/Item.test/getDistanceTo.test.js +++ /dev/null @@ -1,31 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:getDistanceTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createItem('

Hello

') - item.setSize(20, 20) - space.addChild(item) - item.translateBy({ x: 30, y: 40 }) - - t.equal( - item.getDistanceTo(item.atTopRight()).transitRaw(space), - 20, - 'distance to point' - ) - - t.equal( - item.getDistanceTo(space).transitRaw(space), - 50, - 'distance to anchor' - ) - - t.end() - }) -} diff --git a/test/components.test/Item.test/getVectorTo.test.js b/test/components.test/Item.test/getVectorTo.test.js deleted file mode 100644 index 7787544e..00000000 --- a/test/components.test/Item.test/getVectorTo.test.js +++ /dev/null @@ -1,31 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:getVectorTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createItem('

Hello

') - item.setSize(20, 20) - space.addChild(item) - item.translateBy({ x: 30, y: 40 }) - - t.deepEqual( - item.getVectorTo(item.atTopRight()).transitRaw(space), - { x: 20, y: 0, z: 0 }, - 'vector to corner' - ) - - t.deepEqual( - item.getVectorTo(space).transitRaw(space), - { x: -30, y: -40, z: 0 }, - 'vector to anchor' - ) - - t.end() - }) -} diff --git a/test/components.test/Item.test/index.js b/test/components.test/Item.test/index.js deleted file mode 100644 index b55c38f9..00000000 --- a/test/components.test/Item.test/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const units = { - meta: require('./meta.test'), - // - at: require('./at.test'), - boundaries: require('./boundaries.test'), - createVector: require('./createVector.test'), - getDistanceTo: require('./getDistanceTo.test'), - getVectorTo: require('./getVectorTo.test'), - rotateBy: require('./rotateBy.test'), - matchBasis: require('./matchBasis.test'), - setBasis: require('./setBasis.test'), - setOrientation: require('./setOrientation.test'), - setScale: require('./setScale.test'), - transformBy: require('./transformBy.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/components.test/Item.test/meta.test.js b/test/components.test/Item.test/meta.test.js deleted file mode 100644 index 3395ffed..00000000 --- a/test/components.test/Item.test/meta.test.js +++ /dev/null @@ -1,14 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item meta: template is working', function (t) { - // Setup - container.innerHTML = template() - - const elem = document.querySelector('#testspace') - t.notEqual(elem, null, 'element exists') - - t.end() - }) -} diff --git a/test/components.test/Item.test/rotateBy.test.js b/test/components.test/Item.test/rotateBy.test.js deleted file mode 100644 index ef058901..00000000 --- a/test/components.test/Item.test/rotateBy.test.js +++ /dev/null @@ -1,29 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:rotateBy', (t) => { - // Setting - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - - const item = tapspace.createItem('

Hello

') - item.setSize(400, 200) - basis.addChild(item) - - item.rotateBy(Math.PI / 2, item.atTopLeft()) - // Bring back to visible area - item.matchPoint(item.atBottomLeft(), view.at(0, 0)) - - setTimeout(() => { - t.notEqual(document.elementFromPoint(300, 100), - item.element, 'item not at 300,100') - t.equal(document.elementFromPoint(100, 300), - item.element, 'item at 100,300') - - t.end() - }, 10) - }) -} diff --git a/test/components.test/Item.test/setBasis.test.js b/test/components.test/Item.test/setBasis.test.js deleted file mode 100644 index f744089b..00000000 --- a/test/components.test/Item.test/setBasis.test.js +++ /dev/null @@ -1,44 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:setBasis', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const foo = tapspace.createItem('

Foo

') - foo.setSize(400, 200) - space.addChild(foo) - foo.rotateBy(Math.PI / 2) // 90 deg - - const bar = tapspace.createItem('

Bar

') - bar.setSize(200, 200) - space.addChild(bar) - - // Match basis - bar.setBasis(foo.getBasis()) - - t.almostEqualPoint( - foo.at(100, 100).changeBasis(space), - space.at(-100, 100), - 'should have correct basis' - ) - - t.almostEqualPoint( - bar.at(0, 0).transitRaw(view), - foo.at(0, 0).transitRaw(view), - 'should match bases at origin' - ) - - t.almostEqualPoint( - bar.at(10, 10).transitRaw(view), - foo.at(10, 10).transitRaw(view), - 'should match bases at point' - ) - - t.end() - }) -} diff --git a/test/components.test/Item.test/setOrientation.test.js b/test/components.test/Item.test/setOrientation.test.js deleted file mode 100644 index a8d809b8..00000000 --- a/test/components.test/Item.test/setOrientation.test.js +++ /dev/null @@ -1,32 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:setOrientation', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const foo = tapspace.createItem('

Foo

') - foo.setSize(400, 200) - space.addChild(foo) - foo.rotateBy(Math.PI / 2) // 90 deg - - const bar = tapspace.createItem('

Bar

') - bar.setSize(200, 200) - space.addChild(bar) - - // Match orientation - bar.setOrientation(foo.getOrientation(), bar.atBottomRight()) - - t.almostEqualPoint( - bar.at(0, 0).changeBasis(space), - space.at(400, 0), - 'should have rotated around corner' - ) - - t.end() - }) -} diff --git a/test/components.test/Item.test/setScale.test.js b/test/components.test/Item.test/setScale.test.js deleted file mode 100644 index 13f6b616..00000000 --- a/test/components.test/Item.test/setScale.test.js +++ /dev/null @@ -1,39 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Item:setScale', (t) => { - // Setting - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const ref = tapspace.createItem('

Hello

') - ref.setSize(200, 200) - ref.setAnchor(0, 0) - space.addChild(ref) - ref.setScale(2) - - const item = tapspace.createItem('

World

') - item.setSize(200, 200) - item.setAnchor(0, 0) - space.addChild(item) - - item.setScale(ref.getScale(), item.atBottomRight()) - - t.almostEqualPoint( - item.at(0, 0).changeBasis(space), - space.at(-200, -200), - 'should have doubled about corner' - ) - - t.equal( - item.getScale().transitRaw(space), - 2, - 'should have correct scale' - ) - - t.end() - }) -} diff --git a/test/components.test/Item.test/template.ejs b/test/components.test/Item.test/template.ejs deleted file mode 100644 index 504ff76e..00000000 --- a/test/components.test/Item.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/components.test/index.js b/test/components.test/index.js deleted file mode 100644 index 5879e340..00000000 --- a/test/components.test/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const units = { - Item: require('./Item.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/headless/components/Item/at.html b/test/headless/components/Item/at.html new file mode 100644 index 00000000..00f45a86 --- /dev/null +++ b/test/headless/components/Item/at.html @@ -0,0 +1,54 @@ + + + + + Item:at - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/components.test/Item.test/boundaries.test.js b/test/headless/components/Item/boundaries.html similarity index 54% rename from test/components.test/Item.test/boundaries.test.js rename to test/headless/components/Item/boundaries.html index fbe6906a..e547f627 100644 --- a/test/components.test/Item.test/boundaries.test.js +++ b/test/headless/components/Item/boundaries.html @@ -1,10 +1,37 @@ -const template = require('./template.ejs') + + + + + Item boundaries - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/createVector.html b/test/headless/components/Item/createVector.html new file mode 100644 index 00000000..66797fe0 --- /dev/null +++ b/test/headless/components/Item/createVector.html @@ -0,0 +1,56 @@ + + + + + Item:createVector - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/getDistanceTo.html b/test/headless/components/Item/getDistanceTo.html new file mode 100644 index 00000000..2de66bdb --- /dev/null +++ b/test/headless/components/Item/getDistanceTo.html @@ -0,0 +1,58 @@ + + + + + Item:getDistanceTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/getVectorTo.html b/test/headless/components/Item/getVectorTo.html new file mode 100644 index 00000000..9801dbe7 --- /dev/null +++ b/test/headless/components/Item/getVectorTo.html @@ -0,0 +1,57 @@ + + + + + Item:getVectorTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/index.mjs b/test/headless/components/Item/index.mjs new file mode 100644 index 00000000..6801945d --- /dev/null +++ b/test/headless/components/Item/index.mjs @@ -0,0 +1,21 @@ +export default function (test) { + const methods = [ + 'at', + 'boundaries', + 'createVector', + 'getDistanceTo', + 'getVectorTo', + 'matchBasis', + 'rotateBy', + 'setBasis', + 'setOrientation', + 'setScale', + 'transformBy' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test('Item:' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/components.test/Item.test/matchBasis.test.js b/test/headless/components/Item/matchBasis.html similarity index 53% rename from test/components.test/Item.test/matchBasis.test.js rename to test/headless/components/Item/matchBasis.html index 6657442a..95010451 100644 --- a/test/components.test/Item.test/matchBasis.test.js +++ b/test/headless/components/Item/matchBasis.html @@ -1,10 +1,37 @@ -const template = require('./template.ejs') + + + + + Item:matchBasis - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/rotateBy.html b/test/headless/components/Item/rotateBy.html new file mode 100644 index 00000000..1ae1368f --- /dev/null +++ b/test/headless/components/Item/rotateBy.html @@ -0,0 +1,55 @@ + + + + + Item:rotateBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/setBasis.html b/test/headless/components/Item/setBasis.html new file mode 100644 index 00000000..7fb2a3f3 --- /dev/null +++ b/test/headless/components/Item/setBasis.html @@ -0,0 +1,65 @@ + + + + + Item:setBasis - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/setOrientation.html b/test/headless/components/Item/setOrientation.html new file mode 100644 index 00000000..2df6d3f0 --- /dev/null +++ b/test/headless/components/Item/setOrientation.html @@ -0,0 +1,56 @@ + + + + + Item:setOrientation - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/Item/setScale.html b/test/headless/components/Item/setScale.html new file mode 100644 index 00000000..5ad19600 --- /dev/null +++ b/test/headless/components/Item/setScale.html @@ -0,0 +1,64 @@ + + + + + Item:setScale - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/components.test/Item.test/transformBy.test.js b/test/headless/components/Item/transformBy.html similarity index 55% rename from test/components.test/Item.test/transformBy.test.js rename to test/headless/components/Item/transformBy.html index 9a13b970..375ef88a 100644 --- a/test/components.test/Item.test/transformBy.test.js +++ b/test/headless/components/Item/transformBy.html @@ -1,10 +1,37 @@ -const template = require('./template.ejs') + + + + + Item:transformBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/components/index.mjs b/test/headless/components/index.mjs index c297c895..c33eea03 100644 --- a/test/headless/components/index.mjs +++ b/test/headless/components/index.mjs @@ -1,6 +1,7 @@ import testArc from './Arc/index.mjs' import testComponent from './Component/index.mjs' import testFrameComponent from './FrameComponent/index.mjs' +import testItem from './Item/index.mjs' import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' import { getFileUrl } from '../utils.mjs' @@ -16,6 +17,8 @@ export default function (test, browser) { await page.setViewport({ width: 1000, height: 500 }) await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + // Wait max 5 sec for an async test to finish. + await page.waitForFunction('window.test.finished === true', { timeout: 5000 }) // Collect test results. const report = await page.evaluate(() => window.test.report()) @@ -38,6 +41,7 @@ export default function (test, browser) { testArc(testAllOk) testComponent(testAllOk) testFrameComponent(testAllOk) + testItem(testAllOk) testSpace(testAllOk) testViewport(testAllOk) } diff --git a/test/headless/testlib.js b/test/headless/testlib.js index 93e68a98..b5686733 100644 --- a/test/headless/testlib.js +++ b/test/headless/testlib.js @@ -132,6 +132,15 @@ const deepEqual = (x, y) => { window.test = { planned: -1, results: [], + finished: false, + + assert: function (assertion) { + this.results.push(assertion) + + if (this.results.length >= this.planned) { + this.finished = true + } + }, plan: function (num) { if (typeof num !== 'number' || isNaN(num) || num < 0) { @@ -151,7 +160,7 @@ window.test = { const expected = this.planned if (expected >= 0) { if (actual !== expected) { - this.results.push({ + this.assert({ result: false, operator: 'plan', message: `Unexpected number of tests: ${actual}, should be ${expected}`, @@ -187,7 +196,7 @@ window.test = { } } - this.results.push({ + this.assert({ result, operator: 'almostEqual', message: message || 'values should be equal or almost equal', @@ -198,7 +207,7 @@ window.test = { deepEqual: function (actual, expected, message) { const isDeepEqual = deepEqual(actual, expected) - this.results.push({ + this.assert({ result: isDeepEqual, operator: 'deepEqual', message: message || 'values should be deeply equal', @@ -209,7 +218,7 @@ window.test = { equal: function (actual, expected, message) { const isEqual = actual === expected - this.results.push({ + this.assert({ result: isEqual, operator: 'equal', message: message || 'values should be strictly equal', @@ -220,7 +229,7 @@ window.test = { notEqual: function (actual, expected, message) { const isNotEqual = actual !== expected - this.results.push({ + this.assert({ result: isNotEqual, operator: 'notEqual', message: message || 'values should not be strictly equal', @@ -233,7 +242,7 @@ window.test = { if (typeof actual !== 'boolean') { actual = false } - this.results.push({ + this.assert({ result: actual, operator: 'ok', message: message || 'proposition should be true', @@ -247,7 +256,7 @@ window.test = { if (typeof actual === 'boolean') { result = !actual } - this.results.push({ + this.assert({ result, operator: 'notOk', message: message || 'proposition should be false', @@ -265,7 +274,7 @@ window.test = { result = true // exception = e } - this.results.push({ + this.assert({ result, operator: 'throws', message: message || 'function should throw an exception', diff --git a/test/index.test.js b/test/index.test.js index 9168899d..a27594cb 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -3,9 +3,7 @@ const tapspace = window.tapspace const units = { // Geometry - geometry: require('./geometry.test'), - // Components - components: require('./components.test') + geometry: require('./geometry.test') } // Custom assertations From f7afb4b126041d6b18ff72e5701b25355055a697 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 13 Jan 2025 13:32:48 +0200 Subject: [PATCH 059/118] create placeholder files for headless geometry tests --- test/headless/geometry/Area/index.mjs | 0 test/headless/geometry/Area/projectTo.html | 0 test/headless/geometry/Area/transitRaw.html | 0 test/headless/geometry/Basis/at.html | 0 test/headless/geometry/Basis/changeBasis.html | 0 test/headless/geometry/Basis/createDirection.html | 0 test/headless/geometry/Basis/createVector.html | 0 test/headless/geometry/Basis/getMatchedOuter.html | 0 test/headless/geometry/Basis/getTransformTo.html | 0 test/headless/geometry/Basis/index.mjs | 0 test/headless/geometry/Basis/offsets.html | 0 test/headless/geometry/Basis/rotateBy.html | 0 test/headless/geometry/Basis/rotateByDegrees.html | 0 test/headless/geometry/Basis/scaleBy.html | 0 test/headless/geometry/Basis/transformBy.html | 0 test/headless/geometry/Basis/transitRaw.html | 0 test/headless/geometry/Basis/transitRawOuter.html | 0 test/headless/geometry/Basis/translateBy.html | 0 test/headless/geometry/Box/at.html | 0 test/headless/geometry/Box/atNorm.html | 0 test/headless/geometry/Box/changeBasis.html | 0 test/headless/geometry/Box/collisions.html | 0 test/headless/geometry/Box/fromBoxes.html | 0 test/headless/geometry/Box/fromPoints.html | 0 test/headless/geometry/Box/getArea.html | 0 test/headless/geometry/Box/getBoundingBox.html | 0 test/headless/geometry/Box/getBoundingCircle.html | 0 test/headless/geometry/Box/getBoundingSphere.html | 0 test/headless/geometry/Box/getInnerSquare.html | 0 test/headless/geometry/Box/getVolume.html | 0 test/headless/geometry/Box/index.mjs | 0 test/headless/geometry/Box/normAt.html | 0 test/headless/geometry/Box/projectTo.html | 0 test/headless/geometry/Box/resizeTo.html | 0 test/headless/geometry/Box/rotateBy.html | 0 test/headless/geometry/Box/scaleBy.html | 0 test/headless/geometry/Box/transitRaw.html | 0 test/headless/geometry/Box/translateBy.html | 0 test/headless/geometry/Circle/boundaries.html | 0 test/headless/geometry/Circle/collisions.html | 0 test/headless/geometry/Circle/construction.html | 0 test/headless/geometry/Circle/dimensions.html | 0 test/headless/geometry/Circle/index.mjs | 0 test/headless/geometry/Circle/points.html | 0 test/headless/geometry/Circle/transformations.html | 0 test/headless/geometry/Circle/transitions.html | 0 test/headless/geometry/Circle/translations.html | 0 test/headless/geometry/Direction/getRaw.html | 0 test/headless/geometry/Direction/index.mjs | 0 test/headless/geometry/Distance/comparison.html | 0 test/headless/geometry/Distance/getRaw.html | 0 test/headless/geometry/Distance/index.mjs | 0 test/headless/geometry/Distance/projection.html | 0 test/headless/geometry/Orientation/getRaw.html | 0 test/headless/geometry/Orientation/index.mjs | 0 test/headless/geometry/Path/getRaw.html | 0 test/headless/geometry/Path/index.mjs | 0 test/headless/geometry/Point/addVector.html | 0 test/headless/geometry/Point/getDistanceTo.html | 0 test/headless/geometry/Point/getRaw.html | 0 test/headless/geometry/Point/index.mjs | 0 test/headless/geometry/Point/transformBy.html | 0 test/headless/geometry/Point/transitRawOuter.html | 0 test/headless/geometry/Ray/creation.html | 0 test/headless/geometry/Ray/index.mjs | 0 test/headless/geometry/Scale/changeBasis.html | 0 test/headless/geometry/Scale/getRaw.html | 0 test/headless/geometry/Scale/index.mjs | 0 test/headless/geometry/Size/getRaw.html | 0 test/headless/geometry/Size/index.mjs | 0 test/headless/geometry/Size/scaleBy.html | 0 test/headless/geometry/Sphere/boundaries.html | 0 test/headless/geometry/Sphere/collisions.html | 0 test/headless/geometry/Sphere/construction.html | 0 test/headless/geometry/Sphere/dimensions.html | 0 test/headless/geometry/Sphere/index.mjs | 0 test/headless/geometry/Sphere/measures.html | 0 test/headless/geometry/Sphere/points.html | 0 test/headless/geometry/Sphere/transformations.html | 0 test/headless/geometry/Sphere/transitions.html | 0 test/headless/geometry/Sphere/translations.html | 0 test/headless/geometry/Transform/getRaw.html | 0 test/headless/geometry/Transform/index.mjs | 0 test/headless/geometry/Vector/fromPolar.html | 0 test/headless/geometry/Vector/fromSpherical.html | 0 test/headless/geometry/Vector/getRaw.html | 0 test/headless/geometry/Vector/index.mjs | 0 test/headless/geometry/index.mjs | 0 88 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/headless/geometry/Area/index.mjs create mode 100644 test/headless/geometry/Area/projectTo.html create mode 100644 test/headless/geometry/Area/transitRaw.html create mode 100644 test/headless/geometry/Basis/at.html create mode 100644 test/headless/geometry/Basis/changeBasis.html create mode 100644 test/headless/geometry/Basis/createDirection.html create mode 100644 test/headless/geometry/Basis/createVector.html create mode 100644 test/headless/geometry/Basis/getMatchedOuter.html create mode 100644 test/headless/geometry/Basis/getTransformTo.html create mode 100644 test/headless/geometry/Basis/index.mjs create mode 100644 test/headless/geometry/Basis/offsets.html create mode 100644 test/headless/geometry/Basis/rotateBy.html create mode 100644 test/headless/geometry/Basis/rotateByDegrees.html create mode 100644 test/headless/geometry/Basis/scaleBy.html create mode 100644 test/headless/geometry/Basis/transformBy.html create mode 100644 test/headless/geometry/Basis/transitRaw.html create mode 100644 test/headless/geometry/Basis/transitRawOuter.html create mode 100644 test/headless/geometry/Basis/translateBy.html create mode 100644 test/headless/geometry/Box/at.html create mode 100644 test/headless/geometry/Box/atNorm.html create mode 100644 test/headless/geometry/Box/changeBasis.html create mode 100644 test/headless/geometry/Box/collisions.html create mode 100644 test/headless/geometry/Box/fromBoxes.html create mode 100644 test/headless/geometry/Box/fromPoints.html create mode 100644 test/headless/geometry/Box/getArea.html create mode 100644 test/headless/geometry/Box/getBoundingBox.html create mode 100644 test/headless/geometry/Box/getBoundingCircle.html create mode 100644 test/headless/geometry/Box/getBoundingSphere.html create mode 100644 test/headless/geometry/Box/getInnerSquare.html create mode 100644 test/headless/geometry/Box/getVolume.html create mode 100644 test/headless/geometry/Box/index.mjs create mode 100644 test/headless/geometry/Box/normAt.html create mode 100644 test/headless/geometry/Box/projectTo.html create mode 100644 test/headless/geometry/Box/resizeTo.html create mode 100644 test/headless/geometry/Box/rotateBy.html create mode 100644 test/headless/geometry/Box/scaleBy.html create mode 100644 test/headless/geometry/Box/transitRaw.html create mode 100644 test/headless/geometry/Box/translateBy.html create mode 100644 test/headless/geometry/Circle/boundaries.html create mode 100644 test/headless/geometry/Circle/collisions.html create mode 100644 test/headless/geometry/Circle/construction.html create mode 100644 test/headless/geometry/Circle/dimensions.html create mode 100644 test/headless/geometry/Circle/index.mjs create mode 100644 test/headless/geometry/Circle/points.html create mode 100644 test/headless/geometry/Circle/transformations.html create mode 100644 test/headless/geometry/Circle/transitions.html create mode 100644 test/headless/geometry/Circle/translations.html create mode 100644 test/headless/geometry/Direction/getRaw.html create mode 100644 test/headless/geometry/Direction/index.mjs create mode 100644 test/headless/geometry/Distance/comparison.html create mode 100644 test/headless/geometry/Distance/getRaw.html create mode 100644 test/headless/geometry/Distance/index.mjs create mode 100644 test/headless/geometry/Distance/projection.html create mode 100644 test/headless/geometry/Orientation/getRaw.html create mode 100644 test/headless/geometry/Orientation/index.mjs create mode 100644 test/headless/geometry/Path/getRaw.html create mode 100644 test/headless/geometry/Path/index.mjs create mode 100644 test/headless/geometry/Point/addVector.html create mode 100644 test/headless/geometry/Point/getDistanceTo.html create mode 100644 test/headless/geometry/Point/getRaw.html create mode 100644 test/headless/geometry/Point/index.mjs create mode 100644 test/headless/geometry/Point/transformBy.html create mode 100644 test/headless/geometry/Point/transitRawOuter.html create mode 100644 test/headless/geometry/Ray/creation.html create mode 100644 test/headless/geometry/Ray/index.mjs create mode 100644 test/headless/geometry/Scale/changeBasis.html create mode 100644 test/headless/geometry/Scale/getRaw.html create mode 100644 test/headless/geometry/Scale/index.mjs create mode 100644 test/headless/geometry/Size/getRaw.html create mode 100644 test/headless/geometry/Size/index.mjs create mode 100644 test/headless/geometry/Size/scaleBy.html create mode 100644 test/headless/geometry/Sphere/boundaries.html create mode 100644 test/headless/geometry/Sphere/collisions.html create mode 100644 test/headless/geometry/Sphere/construction.html create mode 100644 test/headless/geometry/Sphere/dimensions.html create mode 100644 test/headless/geometry/Sphere/index.mjs create mode 100644 test/headless/geometry/Sphere/measures.html create mode 100644 test/headless/geometry/Sphere/points.html create mode 100644 test/headless/geometry/Sphere/transformations.html create mode 100644 test/headless/geometry/Sphere/transitions.html create mode 100644 test/headless/geometry/Sphere/translations.html create mode 100644 test/headless/geometry/Transform/getRaw.html create mode 100644 test/headless/geometry/Transform/index.mjs create mode 100644 test/headless/geometry/Vector/fromPolar.html create mode 100644 test/headless/geometry/Vector/fromSpherical.html create mode 100644 test/headless/geometry/Vector/getRaw.html create mode 100644 test/headless/geometry/Vector/index.mjs create mode 100644 test/headless/geometry/index.mjs diff --git a/test/headless/geometry/Area/index.mjs b/test/headless/geometry/Area/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Area/projectTo.html b/test/headless/geometry/Area/projectTo.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Area/transitRaw.html b/test/headless/geometry/Area/transitRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/at.html b/test/headless/geometry/Basis/at.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/changeBasis.html b/test/headless/geometry/Basis/changeBasis.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/createDirection.html b/test/headless/geometry/Basis/createDirection.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/createVector.html b/test/headless/geometry/Basis/createVector.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/getMatchedOuter.html b/test/headless/geometry/Basis/getMatchedOuter.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/getTransformTo.html b/test/headless/geometry/Basis/getTransformTo.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/index.mjs b/test/headless/geometry/Basis/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/offsets.html b/test/headless/geometry/Basis/offsets.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/rotateBy.html b/test/headless/geometry/Basis/rotateBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/rotateByDegrees.html b/test/headless/geometry/Basis/rotateByDegrees.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/scaleBy.html b/test/headless/geometry/Basis/scaleBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/transformBy.html b/test/headless/geometry/Basis/transformBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/transitRaw.html b/test/headless/geometry/Basis/transitRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/transitRawOuter.html b/test/headless/geometry/Basis/transitRawOuter.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Basis/translateBy.html b/test/headless/geometry/Basis/translateBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/at.html b/test/headless/geometry/Box/at.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/atNorm.html b/test/headless/geometry/Box/atNorm.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/changeBasis.html b/test/headless/geometry/Box/changeBasis.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/collisions.html b/test/headless/geometry/Box/collisions.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/fromBoxes.html b/test/headless/geometry/Box/fromBoxes.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/fromPoints.html b/test/headless/geometry/Box/fromPoints.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/getArea.html b/test/headless/geometry/Box/getArea.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/getBoundingBox.html b/test/headless/geometry/Box/getBoundingBox.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/getBoundingCircle.html b/test/headless/geometry/Box/getBoundingCircle.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/getBoundingSphere.html b/test/headless/geometry/Box/getBoundingSphere.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/getInnerSquare.html b/test/headless/geometry/Box/getInnerSquare.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/getVolume.html b/test/headless/geometry/Box/getVolume.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/index.mjs b/test/headless/geometry/Box/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/normAt.html b/test/headless/geometry/Box/normAt.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/projectTo.html b/test/headless/geometry/Box/projectTo.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/resizeTo.html b/test/headless/geometry/Box/resizeTo.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/rotateBy.html b/test/headless/geometry/Box/rotateBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/scaleBy.html b/test/headless/geometry/Box/scaleBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/transitRaw.html b/test/headless/geometry/Box/transitRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Box/translateBy.html b/test/headless/geometry/Box/translateBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/boundaries.html b/test/headless/geometry/Circle/boundaries.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/collisions.html b/test/headless/geometry/Circle/collisions.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/construction.html b/test/headless/geometry/Circle/construction.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/dimensions.html b/test/headless/geometry/Circle/dimensions.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/index.mjs b/test/headless/geometry/Circle/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/points.html b/test/headless/geometry/Circle/points.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/transformations.html b/test/headless/geometry/Circle/transformations.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/transitions.html b/test/headless/geometry/Circle/transitions.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Circle/translations.html b/test/headless/geometry/Circle/translations.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Direction/getRaw.html b/test/headless/geometry/Direction/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Direction/index.mjs b/test/headless/geometry/Direction/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Distance/comparison.html b/test/headless/geometry/Distance/comparison.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Distance/getRaw.html b/test/headless/geometry/Distance/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Distance/index.mjs b/test/headless/geometry/Distance/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Distance/projection.html b/test/headless/geometry/Distance/projection.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Orientation/getRaw.html b/test/headless/geometry/Orientation/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Orientation/index.mjs b/test/headless/geometry/Orientation/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Path/getRaw.html b/test/headless/geometry/Path/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Path/index.mjs b/test/headless/geometry/Path/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Point/addVector.html b/test/headless/geometry/Point/addVector.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Point/getDistanceTo.html b/test/headless/geometry/Point/getDistanceTo.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Point/getRaw.html b/test/headless/geometry/Point/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Point/index.mjs b/test/headless/geometry/Point/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Point/transformBy.html b/test/headless/geometry/Point/transformBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Point/transitRawOuter.html b/test/headless/geometry/Point/transitRawOuter.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Ray/creation.html b/test/headless/geometry/Ray/creation.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Ray/index.mjs b/test/headless/geometry/Ray/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Scale/changeBasis.html b/test/headless/geometry/Scale/changeBasis.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Scale/getRaw.html b/test/headless/geometry/Scale/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Scale/index.mjs b/test/headless/geometry/Scale/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Size/getRaw.html b/test/headless/geometry/Size/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Size/index.mjs b/test/headless/geometry/Size/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Size/scaleBy.html b/test/headless/geometry/Size/scaleBy.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/boundaries.html b/test/headless/geometry/Sphere/boundaries.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/collisions.html b/test/headless/geometry/Sphere/collisions.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/construction.html b/test/headless/geometry/Sphere/construction.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/dimensions.html b/test/headless/geometry/Sphere/dimensions.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/index.mjs b/test/headless/geometry/Sphere/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/measures.html b/test/headless/geometry/Sphere/measures.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/points.html b/test/headless/geometry/Sphere/points.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/transformations.html b/test/headless/geometry/Sphere/transformations.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/transitions.html b/test/headless/geometry/Sphere/transitions.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Sphere/translations.html b/test/headless/geometry/Sphere/translations.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Transform/getRaw.html b/test/headless/geometry/Transform/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Transform/index.mjs b/test/headless/geometry/Transform/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Vector/fromPolar.html b/test/headless/geometry/Vector/fromPolar.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Vector/fromSpherical.html b/test/headless/geometry/Vector/fromSpherical.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Vector/getRaw.html b/test/headless/geometry/Vector/getRaw.html new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/Vector/index.mjs b/test/headless/geometry/Vector/index.mjs new file mode 100644 index 00000000..e69de29b diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs new file mode 100644 index 00000000..e69de29b From 21b3dfdfd0f8732face05ea572ea6abf4e1fbe9a Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 13 Jan 2025 14:21:50 +0200 Subject: [PATCH 060/118] make testAllOk test tool reusable --- test/headless/components/Item/index.mjs | 3 +- test/headless/components/index.mjs | 31 ++---------------- test/headless/utils.mjs | 43 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/test/headless/components/Item/index.mjs b/test/headless/components/Item/index.mjs index 6801945d..720f0381 100644 --- a/test/headless/components/Item/index.mjs +++ b/test/headless/components/Item/index.mjs @@ -1,4 +1,5 @@ export default function (test) { + const namespace = 'Item' const methods = [ 'at', 'boundaries', @@ -16,6 +17,6 @@ export default function (test) { let i, m for (i = 0; i < methods.length; i += 1) { m = methods[i] - test('Item:' + m, import.meta.dirname, m + '.html') + test(namespace + ':' + m, import.meta.dirname, m + '.html') } } diff --git a/test/headless/components/index.mjs b/test/headless/components/index.mjs index c33eea03..88821100 100644 --- a/test/headless/components/index.mjs +++ b/test/headless/components/index.mjs @@ -4,39 +4,12 @@ import testFrameComponent from './FrameComponent/index.mjs' import testItem from './Item/index.mjs' import testSpace from './Space/index.mjs' import testViewport from './Viewport/index.mjs' -import { getFileUrl } from '../utils.mjs' +import { makeTestAllOk } from '../utils.mjs' export default function (test, browser) { // Custom test runner to reduce boilerplate code. // Opens the test page and evaluates the test results. - const testAllOk = async (unitName, dirname, filename) => { - test(unitName, async (t) => { - // Setup - const pageUrl = getFileUrl(dirname, filename) - const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) - await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) - - // Wait max 5 sec for an async test to finish. - await page.waitForFunction('window.test.finished === true', { timeout: 5000 }) - // Collect test results. - const report = await page.evaluate(() => window.test.report()) - - // Check test results. - for (let i = 0; i < report.length; i += 1) { - t._assert(report[i].result, { - message: report[i].message, - operator: report[i].operator, - actual: report[i].actual, - expected: report[i].expected - }) - } - - // Exit - await page.close() - t.end() - }) - } + const testAllOk = makeTestAllOk(test, browser) testArc(testAllOk) testComponent(testAllOk) diff --git a/test/headless/utils.mjs b/test/headless/utils.mjs index 88eaed05..d07a858a 100644 --- a/test/headless/utils.mjs +++ b/test/headless/utils.mjs @@ -3,3 +3,46 @@ import { join } from 'path' export const getFileUrl = (dirname, filename) => { return 'file:' + join(dirname, filename) } + +export const makeTestAllOk = (test, browser) => { + // Create a custom test runner to reduce boilerplate code. + // Opens the test page and evaluates the test results. + // + // Parameters: + // test + // a tape.Test instance + // browser + // a puppeteer Browser instance + // + // Returns + // a function (unitName, dirname, filename) + // + return async (unitName, dirname, filename) => { + test(unitName, async (t) => { + // Setup + const pageUrl = getFileUrl(dirname, filename) + const page = await browser.newPage() + await page.setViewport({ width: 1000, height: 500 }) + await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) + + // Wait max 5 sec for an async test to finish. + await page.waitForFunction('window.test.finished === true', { timeout: 5000 }) + // Collect test results. + const report = await page.evaluate(() => window.test.report()) + + // Check test results. + for (let i = 0; i < report.length; i += 1) { + t._assert(report[i].result, { + message: report[i].message, + operator: report[i].operator, + actual: report[i].actual, + expected: report[i].expected + }) + } + + // Exit + await page.close() + t.end() + }) + } +} From e6056017eeb84521f3c765c1240a5c0afb4c090e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Mon, 13 Jan 2025 14:26:03 +0200 Subject: [PATCH 061/118] migrate first geometry tests: Area --- test/headless/geometry/Area/index.mjs | 13 +++++ test/headless/geometry/Area/projectTo.html | 59 +++++++++++++++++++++ test/headless/geometry/Area/transitRaw.html | 52 ++++++++++++++++++ test/headless/geometry/index.mjs | 10 ++++ test/headless/suites.mjs | 2 + 5 files changed, 136 insertions(+) diff --git a/test/headless/geometry/Area/index.mjs b/test/headless/geometry/Area/index.mjs index e69de29b..d82660c4 100644 --- a/test/headless/geometry/Area/index.mjs +++ b/test/headless/geometry/Area/index.mjs @@ -0,0 +1,13 @@ +export default function (test) { + const namespace = 'Area' + const methods = [ + 'projectTo', + 'transitRaw' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Area/projectTo.html b/test/headless/geometry/Area/projectTo.html index e69de29b..89a5115b 100644 --- a/test/headless/geometry/Area/projectTo.html +++ b/test/headless/geometry/Area/projectTo.html @@ -0,0 +1,59 @@ + + + + + Area:projectTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Area/transitRaw.html b/test/headless/geometry/Area/transitRaw.html index e69de29b..bc5f6472 100644 --- a/test/headless/geometry/Area/transitRaw.html +++ b/test/headless/geometry/Area/transitRaw.html @@ -0,0 +1,52 @@ + + + + + Area:transitRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index e69de29b..9be62b14 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -0,0 +1,10 @@ +import testArea from './Area/index.mjs' +import { makeTestAllOk } from '../utils.mjs' + +export default function (test, browser) { + // Custom test runner to reduce boilerplate code. + // Opens the test page and evaluates the test results. + const testAllOk = makeTestAllOk(test, browser) + + testArea(testAllOk) +} diff --git a/test/headless/suites.mjs b/test/headless/suites.mjs index b605dfae..4ebe76ba 100644 --- a/test/headless/suites.mjs +++ b/test/headless/suites.mjs @@ -1,7 +1,9 @@ import testComponents from './components/index.mjs' +import testGeometry from './geometry/index.mjs' import testVersion from './version/index.mjs' export default function (test, browser) { testComponents(test, browser) + testGeometry(test, browser) testVersion(test, browser) } From e5663d257c73ed8876171e267b4010aec00c722d Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 14 Jan 2025 14:45:22 +0200 Subject: [PATCH 062/118] implement Vector:equal --- lib/geometry/Vector/equal.js | 22 ++++++++++++++++++++++ lib/geometry/Vector/index.js | 1 + 2 files changed, 23 insertions(+) create mode 100644 lib/geometry/Vector/equal.js diff --git a/lib/geometry/Vector/equal.js b/lib/geometry/Vector/equal.js new file mode 100644 index 00000000..5d719f3f --- /dev/null +++ b/lib/geometry/Vector/equal.js @@ -0,0 +1,22 @@ +const vec3 = require('affineplane').vec3 + +module.exports = function (v) { + // @Vector:equal(v) + // + // Test if the vector is strictly equal to v. + // Strict equality requires strictly equal basis and numerical components. + // + // Parameters: + // v + // a Vector + // + // Return + // a boolean + // + + if (v && v.basis && this.basis === v.basis) { + return vec3.equal(this.vec, v.vec) + } + + return false +} diff --git a/lib/geometry/Vector/index.js b/lib/geometry/Vector/index.js index 687f8306..f0d7050e 100644 --- a/lib/geometry/Vector/index.js +++ b/lib/geometry/Vector/index.js @@ -35,6 +35,7 @@ proto.changeBasis = require('./changeBasis') proto.copy = require('./copy') proto.cross = require('./cross') proto.difference = require('./difference') +proto.equal = require('./equal') proto.getRaw = require('./getRaw') proto.multiply = require('./scaleBy') proto.negate = require('./negate') From 124b4ec67c0535f62038610a16c56ea44291ab0c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 14 Jan 2025 14:46:04 +0200 Subject: [PATCH 063/118] migrate Basis test suite --- test/headless/geometry/Basis/at.html | 49 ++++++++++ test/headless/geometry/Basis/changeBasis.html | 49 ++++++++++ .../geometry/Basis/createDirection.html | 53 +++++++++++ .../headless/geometry/Basis/createVector.html | 49 ++++++++++ .../geometry/Basis/getMatchedOuter.html | 60 +++++++++++++ .../geometry/Basis/getTransformTo.html | 67 ++++++++++++++ test/headless/geometry/Basis/index.mjs | 25 ++++++ test/headless/geometry/Basis/offsets.html | 89 +++++++++++++++++++ test/headless/geometry/Basis/rotateBy.html | 47 ++++++++++ .../geometry/Basis/rotateByDegrees.html | 48 ++++++++++ test/headless/geometry/Basis/scaleBy.html | 48 ++++++++++ test/headless/geometry/Basis/transformBy.html | 55 ++++++++++++ test/headless/geometry/Basis/transitRaw.html | 57 ++++++++++++ .../geometry/Basis/transitRawOuter.html | 51 +++++++++++ test/headless/geometry/Basis/translateBy.html | 49 ++++++++++ test/headless/geometry/index.mjs | 2 + 16 files changed, 798 insertions(+) diff --git a/test/headless/geometry/Basis/at.html b/test/headless/geometry/Basis/at.html index e69de29b..13873448 100644 --- a/test/headless/geometry/Basis/at.html +++ b/test/headless/geometry/Basis/at.html @@ -0,0 +1,49 @@ + + + + + Basis:at - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/changeBasis.html b/test/headless/geometry/Basis/changeBasis.html index e69de29b..887cb783 100644 --- a/test/headless/geometry/Basis/changeBasis.html +++ b/test/headless/geometry/Basis/changeBasis.html @@ -0,0 +1,49 @@ + + + + + Basis:changeBasis - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/createDirection.html b/test/headless/geometry/Basis/createDirection.html index e69de29b..91e9a22d 100644 --- a/test/headless/geometry/Basis/createDirection.html +++ b/test/headless/geometry/Basis/createDirection.html @@ -0,0 +1,53 @@ + + + + + Basis:createDirection - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/createVector.html b/test/headless/geometry/Basis/createVector.html index e69de29b..7b593d76 100644 --- a/test/headless/geometry/Basis/createVector.html +++ b/test/headless/geometry/Basis/createVector.html @@ -0,0 +1,49 @@ + + + + + Basis:createVector - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/getMatchedOuter.html b/test/headless/geometry/Basis/getMatchedOuter.html index e69de29b..6ceed311 100644 --- a/test/headless/geometry/Basis/getMatchedOuter.html +++ b/test/headless/geometry/Basis/getMatchedOuter.html @@ -0,0 +1,60 @@ + + + + + Basis:getMatchedOuter - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/getTransformTo.html b/test/headless/geometry/Basis/getTransformTo.html index e69de29b..1e05612b 100644 --- a/test/headless/geometry/Basis/getTransformTo.html +++ b/test/headless/geometry/Basis/getTransformTo.html @@ -0,0 +1,67 @@ + + + + + Basis:getTransformTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/index.mjs b/test/headless/geometry/Basis/index.mjs index e69de29b..04af7453 100644 --- a/test/headless/geometry/Basis/index.mjs +++ b/test/headless/geometry/Basis/index.mjs @@ -0,0 +1,25 @@ +export default function (test) { + const namespace = 'Basis' + const methods = [ + 'at', + 'changeBasis', + 'createDirection', + 'createVector', + 'getMatchedOuter', + 'getTransformTo', + 'offsets', + 'rotateBy', + 'rotateByDegrees', + 'scaleBy', + 'transformBy', + 'transitRaw', + 'transitRawOuter', + 'translateBy' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Basis/offsets.html b/test/headless/geometry/Basis/offsets.html index e69de29b..2a80e96d 100644 --- a/test/headless/geometry/Basis/offsets.html +++ b/test/headless/geometry/Basis/offsets.html @@ -0,0 +1,89 @@ + + + + + Basis offsets - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/rotateBy.html b/test/headless/geometry/Basis/rotateBy.html index e69de29b..11c7f219 100644 --- a/test/headless/geometry/Basis/rotateBy.html +++ b/test/headless/geometry/Basis/rotateBy.html @@ -0,0 +1,47 @@ + + + + + Basis:rotateBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/rotateByDegrees.html b/test/headless/geometry/Basis/rotateByDegrees.html index e69de29b..3e317ca8 100644 --- a/test/headless/geometry/Basis/rotateByDegrees.html +++ b/test/headless/geometry/Basis/rotateByDegrees.html @@ -0,0 +1,48 @@ + + + + + Basis:rotateByDegrees - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/scaleBy.html b/test/headless/geometry/Basis/scaleBy.html index e69de29b..43a6340e 100644 --- a/test/headless/geometry/Basis/scaleBy.html +++ b/test/headless/geometry/Basis/scaleBy.html @@ -0,0 +1,48 @@ + + + + + Basis:scaleBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/transformBy.html b/test/headless/geometry/Basis/transformBy.html index e69de29b..5cdd07f7 100644 --- a/test/headless/geometry/Basis/transformBy.html +++ b/test/headless/geometry/Basis/transformBy.html @@ -0,0 +1,55 @@ + + + + + Basis:transformBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/transitRaw.html b/test/headless/geometry/Basis/transitRaw.html index e69de29b..81dbce8b 100644 --- a/test/headless/geometry/Basis/transitRaw.html +++ b/test/headless/geometry/Basis/transitRaw.html @@ -0,0 +1,57 @@ + + + + + Basis:transitRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/transitRawOuter.html b/test/headless/geometry/Basis/transitRawOuter.html index e69de29b..513e6997 100644 --- a/test/headless/geometry/Basis/transitRawOuter.html +++ b/test/headless/geometry/Basis/transitRawOuter.html @@ -0,0 +1,51 @@ + + + + + Basis:transitRawOuter - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Basis/translateBy.html b/test/headless/geometry/Basis/translateBy.html index e69de29b..64350e1d 100644 --- a/test/headless/geometry/Basis/translateBy.html +++ b/test/headless/geometry/Basis/translateBy.html @@ -0,0 +1,49 @@ + + + + + Basis:translateBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 9be62b14..892389e1 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -1,4 +1,5 @@ import testArea from './Area/index.mjs' +import testBasis from './Basis/index.mjs' import { makeTestAllOk } from '../utils.mjs' export default function (test, browser) { @@ -7,4 +8,5 @@ export default function (test, browser) { const testAllOk = makeTestAllOk(test, browser) testArea(testAllOk) + testBasis(testAllOk) } From b77aa379bed176b079905eede843abac2959c7b5 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Tue, 14 Jan 2025 15:24:47 +0200 Subject: [PATCH 064/118] improve headless testlib: add assertions true, false --- test/headless/testlib.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/headless/testlib.js b/test/headless/testlib.js index b5686733..a0fd4e94 100644 --- a/test/headless/testlib.js +++ b/test/headless/testlib.js @@ -227,6 +227,11 @@ window.test = { }) }, + false: function (actual, message) { + // Alias for notOk + this.notOk(actual, message) + }, + notEqual: function (actual, expected, message) { const isNotEqual = actual !== expected this.assert({ @@ -281,5 +286,10 @@ window.test = { actual: result, expected: true }) + }, + + true: function (actual, message) { + // Alias for ok. + this.ok(actual, message) } } From 8f78b6f1769eaed8813612d893c5fe44e78f6108 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 15 Jan 2025 17:19:06 +0200 Subject: [PATCH 065/118] upgrade to affineplane 2.20.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e56245df..c61dade1 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "license": "MIT", "dependencies": { - "affineplane": "^2.19.0", + "affineplane": "^2.20.0", "component-emitter": "^1.3.0", "loadimages": "^1.0.0", "nudged": "^2.1.1" From bc5bc3c5c1e9ad322f76059353801d13469b2857 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Wed, 15 Jan 2025 17:21:19 +0200 Subject: [PATCH 066/118] implement Box :almostEqual :equal --- lib/geometry/Box/almostEqual.js | 25 +++++++++++++++++++++++++ lib/geometry/Box/equal.js | 23 +++++++++++++++++++++++ lib/geometry/Box/index.js | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 lib/geometry/Box/almostEqual.js create mode 100644 lib/geometry/Box/equal.js diff --git a/lib/geometry/Box/almostEqual.js b/lib/geometry/Box/almostEqual.js new file mode 100644 index 00000000..ebd5cfec --- /dev/null +++ b/lib/geometry/Box/almostEqual.js @@ -0,0 +1,25 @@ +const box3 = require('affineplane').box3 +const almostEqual = box3.almostEqual + +module.exports = function (b, tolerance) { + // @Box:almostEqual(b[, tolerance]) + // + // Test if this box is equal to the given box b within tolerance. + // Almost equality requires identical basis + // and that box size, position, and orientation are equal within tolerance. + // + // Parameters: + // b + // a Box + // tolerance + // optional number. Maximum tolerated distance between values. + // + // Return + // a boolean + // + if (!b || !b.basis) { + return false + } + + return this.basis === b.basis && almostEqual(this.box, b.box, tolerance) +} diff --git a/lib/geometry/Box/equal.js b/lib/geometry/Box/equal.js new file mode 100644 index 00000000..8ff0849e --- /dev/null +++ b/lib/geometry/Box/equal.js @@ -0,0 +1,23 @@ +const box3 = require('affineplane').box3 +const equal = box3.equal + +module.exports = function (b) { + // @Box:equal(b) + // + // Test if this box is strictly equal with the given box b. + // Strict equality requires that the boxes are on the same basis + // and have strictly equal size, position, and orientation. + // + // Parameters: + // b + // a Box + // + // Return + // a boolean + // + if (!b || !b.basis) { + return false + } + + return this.basis === b.basis && equal(this.box, b.box) +} diff --git a/lib/geometry/Box/index.js b/lib/geometry/Box/index.js index 8559a38a..de52b0fc 100644 --- a/lib/geometry/Box/index.js +++ b/lib/geometry/Box/index.js @@ -35,12 +35,14 @@ Box.fromPoints = require('./fromPoints')(Box) Box.fromBoxes = require('./fromBoxes')(Box) // Methods +proto.almostEqual = require('./almostEqual') proto.at = require('./at') proto.atCenter = require('./atCenter') proto.atMid = proto.atCenter proto.atNorm = require('./atNorm') proto.changeBasis = require('./changeBasis') proto.detectCollision = require('./detectCollision') +proto.equal = require('./equal') proto.getArea = require('./getArea') proto.getBoundingBox = require('./getBoundingBox') proto.getDepth = require('./getDepth') From d32390028dbe6d0c6d58c6cde5a0cad9828ff277 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 14:36:20 +0200 Subject: [PATCH 067/118] implement almostEqual,equal for Circle and Sphere --- lib/geometry/Circle/almostEqual.js | 25 +++++++++++++++++++++++++ lib/geometry/Circle/equal.js | 23 +++++++++++++++++++++++ lib/geometry/Circle/index.js | 2 ++ lib/geometry/Sphere/almostEqual.js | 25 +++++++++++++++++++++++++ lib/geometry/Sphere/equal.js | 23 +++++++++++++++++++++++ lib/geometry/Sphere/index.js | 2 ++ 6 files changed, 100 insertions(+) create mode 100644 lib/geometry/Circle/almostEqual.js create mode 100644 lib/geometry/Circle/equal.js create mode 100644 lib/geometry/Sphere/almostEqual.js create mode 100644 lib/geometry/Sphere/equal.js diff --git a/lib/geometry/Circle/almostEqual.js b/lib/geometry/Circle/almostEqual.js new file mode 100644 index 00000000..cafb0eda --- /dev/null +++ b/lib/geometry/Circle/almostEqual.js @@ -0,0 +1,25 @@ +const circle3 = require('affineplane').circle3 +const almostEqual = circle3.almostEqual + +module.exports = function (c, tolerance) { + // @Circle:almostEqual(c[, tolerance]) + // + // Test if this circle is equal to the given circle c within tolerance. + // Almost equality requires identical basis + // and that circle radius and position are equal within tolerance. + // + // Parameters: + // c + // a Circle + // tolerance + // optional number. Maximum tolerated distance between values. + // + // Return + // a boolean + // + if (!c || !c.basis) { + return false + } + + return this.basis === c.basis && almostEqual(this.circle, c.circle, tolerance) +} diff --git a/lib/geometry/Circle/equal.js b/lib/geometry/Circle/equal.js new file mode 100644 index 00000000..11b7cbd2 --- /dev/null +++ b/lib/geometry/Circle/equal.js @@ -0,0 +1,23 @@ +const circle3 = require('affineplane').circle3 +const equal = circle3.equal + +module.exports = function (c) { + // @Circle:equal(c) + // + // Test if this circle is strictly equal with the given circle c. + // Strict equality requires that the circles are on the same basis + // and have strictly equal radius and position. + // + // Parameters: + // c + // a Circle + // + // Return + // a boolean + // + if (!c || !c.basis) { + return false + } + + return this.basis === c.basis && equal(this.circle, c.circle) +} diff --git a/lib/geometry/Circle/index.js b/lib/geometry/Circle/index.js index 392e0cb7..240e882b 100644 --- a/lib/geometry/Circle/index.js +++ b/lib/geometry/Circle/index.js @@ -21,11 +21,13 @@ proto.isCircle = true Circle.fromPoints = require('./fromPoints')(Circle) // Methods +proto.almostEqual = require('./almostEqual') proto.atArc = require('./atArc') proto.atCenter = require('./atCenter') proto.atMid = proto.atCenter proto.changeBasis = require('./changeBasis') proto.detectCollision = require('./detectCollision') +proto.equal = require('./equal') proto.getArea = require('./getArea') proto.getCollisionArea = require('./getCollisionArea') proto.getDiameter = require('./getDiameter') diff --git a/lib/geometry/Sphere/almostEqual.js b/lib/geometry/Sphere/almostEqual.js new file mode 100644 index 00000000..5803f478 --- /dev/null +++ b/lib/geometry/Sphere/almostEqual.js @@ -0,0 +1,25 @@ +const sphere3 = require('affineplane').sphere3 +const almostEqual = sphere3.almostEqual + +module.exports = function (s, tolerance) { + // @Sphere:almostEqual(s[, tolerance]) + // + // Test if this sphere is equal to the given sphere s within tolerance. + // Almost equality requires identical basis + // and that radius and position of the spheres are equal within tolerance. + // + // Parameters: + // s + // a Sphere + // tolerance + // optional number. Maximum tolerated distance between values. + // + // Return + // a boolean + // + if (!s || !s.basis) { + return false + } + + return this.basis === s.basis && almostEqual(this.sphere, s.sphere, tolerance) +} diff --git a/lib/geometry/Sphere/equal.js b/lib/geometry/Sphere/equal.js new file mode 100644 index 00000000..5674de5e --- /dev/null +++ b/lib/geometry/Sphere/equal.js @@ -0,0 +1,23 @@ +const sphere3 = require('affineplane').sphere3 +const equal = sphere3.equal + +module.exports = function (s) { + // @Sphere:equal(s) + // + // Test if this sphere is strictly equal with the given sphere s. + // Strict equality requires that the spheres are on the same basis + // and have strictly equal radius and position. + // + // Parameters: + // s + // a Sphere + // + // Return + // a boolean + // + if (!s || !s.basis) { + return false + } + + return this.basis === s.basis && equal(this.sphere, s.sphere) +} diff --git a/lib/geometry/Sphere/index.js b/lib/geometry/Sphere/index.js index ca2853ee..87689943 100644 --- a/lib/geometry/Sphere/index.js +++ b/lib/geometry/Sphere/index.js @@ -31,10 +31,12 @@ proto.isSphere = true Sphere.fromPoints = require('./fromPoints')(Sphere) // Methods +proto.almostEqual = require('./almostEqual') proto.atCenter = require('./atCenter') proto.atMid = proto.atCenter proto.changeBasis = require('./changeBasis') proto.detectCollision = require('./detectCollision') +proto.equal = require('./equal') proto.getBoundingBox = require('./getBoundingBox') proto.getDepth = require('./getDiameter') proto.getDiameter = proto.getDepth From a3833a7544da0442a17dfd60543a1923a59058dd Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 14:37:21 +0200 Subject: [PATCH 068/118] migrate Box test suite --- test/headless/geometry/Box/at.html | 49 ++++++++++ test/headless/geometry/Box/atNorm.html | 49 ++++++++++ test/headless/geometry/Box/changeBasis.html | 56 ++++++++++++ test/headless/geometry/Box/collisions.html | 0 .../geometry/Box/detectCollision.html | 75 ++++++++++++++++ test/headless/geometry/Box/fromBoxes.html | 82 +++++++++++++++++ test/headless/geometry/Box/fromPoints.html | 69 ++++++++++++++ test/headless/geometry/Box/getArea.html | 51 +++++++++++ .../headless/geometry/Box/getBoundingBox.html | 90 +++++++++++++++++++ .../geometry/Box/getBoundingCircle.html | 57 ++++++++++++ .../geometry/Box/getBoundingSphere.html | 57 ++++++++++++ .../headless/geometry/Box/getInnerSquare.html | 58 ++++++++++++ test/headless/geometry/Box/getVolume.html | 65 ++++++++++++++ test/headless/geometry/Box/index.mjs | 32 +++++++ test/headless/geometry/Box/normAt.html | 56 ++++++++++++ test/headless/geometry/Box/projectTo.html | 67 ++++++++++++++ test/headless/geometry/Box/resizeTo.html | 73 +++++++++++++++ test/headless/geometry/Box/rotateBy.html | 54 +++++++++++ test/headless/geometry/Box/scaleBy.html | 56 ++++++++++++ test/headless/geometry/Box/transitRaw.html | 52 +++++++++++ test/headless/geometry/Box/translateBy.html | 51 +++++++++++ test/headless/geometry/index.mjs | 2 + 22 files changed, 1201 insertions(+) delete mode 100644 test/headless/geometry/Box/collisions.html create mode 100644 test/headless/geometry/Box/detectCollision.html diff --git a/test/headless/geometry/Box/at.html b/test/headless/geometry/Box/at.html index e69de29b..a1df0f90 100644 --- a/test/headless/geometry/Box/at.html +++ b/test/headless/geometry/Box/at.html @@ -0,0 +1,49 @@ + + + + + Box:at - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/atNorm.html b/test/headless/geometry/Box/atNorm.html index e69de29b..53a56df0 100644 --- a/test/headless/geometry/Box/atNorm.html +++ b/test/headless/geometry/Box/atNorm.html @@ -0,0 +1,49 @@ + + + + + Box:atNorm - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/changeBasis.html b/test/headless/geometry/Box/changeBasis.html index e69de29b..404f433e 100644 --- a/test/headless/geometry/Box/changeBasis.html +++ b/test/headless/geometry/Box/changeBasis.html @@ -0,0 +1,56 @@ + + + + + Box:changeBasis - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/collisions.html b/test/headless/geometry/Box/collisions.html deleted file mode 100644 index e69de29b..00000000 diff --git a/test/headless/geometry/Box/detectCollision.html b/test/headless/geometry/Box/detectCollision.html new file mode 100644 index 00000000..9c31b743 --- /dev/null +++ b/test/headless/geometry/Box/detectCollision.html @@ -0,0 +1,75 @@ + + + + + Box:detectCollision - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/fromBoxes.html b/test/headless/geometry/Box/fromBoxes.html index e69de29b..ff721901 100644 --- a/test/headless/geometry/Box/fromBoxes.html +++ b/test/headless/geometry/Box/fromBoxes.html @@ -0,0 +1,82 @@ + + + + + Box:fromBoxes - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/fromPoints.html b/test/headless/geometry/Box/fromPoints.html index e69de29b..944a2018 100644 --- a/test/headless/geometry/Box/fromPoints.html +++ b/test/headless/geometry/Box/fromPoints.html @@ -0,0 +1,69 @@ + + + + + Box:fromPoints - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/getArea.html b/test/headless/geometry/Box/getArea.html index e69de29b..f5e63213 100644 --- a/test/headless/geometry/Box/getArea.html +++ b/test/headless/geometry/Box/getArea.html @@ -0,0 +1,51 @@ + + + + + Box:getArea - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/getBoundingBox.html b/test/headless/geometry/Box/getBoundingBox.html index e69de29b..b5aaa708 100644 --- a/test/headless/geometry/Box/getBoundingBox.html +++ b/test/headless/geometry/Box/getBoundingBox.html @@ -0,0 +1,90 @@ + + + + + Box:getBoundingBox - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/getBoundingCircle.html b/test/headless/geometry/Box/getBoundingCircle.html index e69de29b..3665b359 100644 --- a/test/headless/geometry/Box/getBoundingCircle.html +++ b/test/headless/geometry/Box/getBoundingCircle.html @@ -0,0 +1,57 @@ + + + + + Box:getBoundingCircle - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/getBoundingSphere.html b/test/headless/geometry/Box/getBoundingSphere.html index e69de29b..37d31675 100644 --- a/test/headless/geometry/Box/getBoundingSphere.html +++ b/test/headless/geometry/Box/getBoundingSphere.html @@ -0,0 +1,57 @@ + + + + + Box:getBoundingSphere - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/getInnerSquare.html b/test/headless/geometry/Box/getInnerSquare.html index e69de29b..40193837 100644 --- a/test/headless/geometry/Box/getInnerSquare.html +++ b/test/headless/geometry/Box/getInnerSquare.html @@ -0,0 +1,58 @@ + + + + + Box:getInnerSquare - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/getVolume.html b/test/headless/geometry/Box/getVolume.html index e69de29b..fd0814e5 100644 --- a/test/headless/geometry/Box/getVolume.html +++ b/test/headless/geometry/Box/getVolume.html @@ -0,0 +1,65 @@ + + + + + Box:getVolume - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/index.mjs b/test/headless/geometry/Box/index.mjs index e69de29b..f538a73e 100644 --- a/test/headless/geometry/Box/index.mjs +++ b/test/headless/geometry/Box/index.mjs @@ -0,0 +1,32 @@ +export default function (test) { + const namespace = 'Box' + const methods = [ + // 'almostEqual', TODO + 'at', + 'atNorm', + 'changeBasis', + 'detectCollision', + // 'equal', TODO + 'fromBoxes', + 'fromPoints', + 'getArea', + 'getBoundingBox', + 'getBoundingCircle', + 'getBoundingSphere', + 'getInnerSquare', + 'getVolume', + 'normAt', + 'projectTo', + 'resizeTo', + 'rotateBy', + 'scaleBy', + 'transitRaw', + 'translateBy' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Box/normAt.html b/test/headless/geometry/Box/normAt.html index e69de29b..05e2ffe7 100644 --- a/test/headless/geometry/Box/normAt.html +++ b/test/headless/geometry/Box/normAt.html @@ -0,0 +1,56 @@ + + + + + Box:normAt - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/projectTo.html b/test/headless/geometry/Box/projectTo.html index e69de29b..0c5fe529 100644 --- a/test/headless/geometry/Box/projectTo.html +++ b/test/headless/geometry/Box/projectTo.html @@ -0,0 +1,67 @@ + + + + + Box:projectTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/resizeTo.html b/test/headless/geometry/Box/resizeTo.html index e69de29b..b47ec508 100644 --- a/test/headless/geometry/Box/resizeTo.html +++ b/test/headless/geometry/Box/resizeTo.html @@ -0,0 +1,73 @@ + + + + + Box:resizeTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/rotateBy.html b/test/headless/geometry/Box/rotateBy.html index e69de29b..10599592 100644 --- a/test/headless/geometry/Box/rotateBy.html +++ b/test/headless/geometry/Box/rotateBy.html @@ -0,0 +1,54 @@ + + + + + Box:rotateBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/scaleBy.html b/test/headless/geometry/Box/scaleBy.html index e69de29b..abc9860a 100644 --- a/test/headless/geometry/Box/scaleBy.html +++ b/test/headless/geometry/Box/scaleBy.html @@ -0,0 +1,56 @@ + + + + + Box:scaleBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/transitRaw.html b/test/headless/geometry/Box/transitRaw.html index e69de29b..d28cf5a6 100644 --- a/test/headless/geometry/Box/transitRaw.html +++ b/test/headless/geometry/Box/transitRaw.html @@ -0,0 +1,52 @@ + + + + + Box:transitRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/translateBy.html b/test/headless/geometry/Box/translateBy.html index e69de29b..75e4b40e 100644 --- a/test/headless/geometry/Box/translateBy.html +++ b/test/headless/geometry/Box/translateBy.html @@ -0,0 +1,51 @@ + + + + + Box:translateBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 892389e1..78af42b1 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -1,5 +1,6 @@ import testArea from './Area/index.mjs' import testBasis from './Basis/index.mjs' +import testBox from './Box/index.mjs' import { makeTestAllOk } from '../utils.mjs' export default function (test, browser) { @@ -9,4 +10,5 @@ export default function (test, browser) { testArea(testAllOk) testBasis(testAllOk) + testBox(testAllOk) } From 8c48c35f9c99ffd1dd890064225f3e7e8713679f Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 15:00:46 +0200 Subject: [PATCH 069/118] test Box:almostEqual, Box:equal --- test/headless/geometry/Box/almostEqual.html | 62 +++++++++++++++++++ test/headless/geometry/Box/equal.html | 67 +++++++++++++++++++++ test/headless/geometry/Box/index.mjs | 4 +- 3 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 test/headless/geometry/Box/almostEqual.html create mode 100644 test/headless/geometry/Box/equal.html diff --git a/test/headless/geometry/Box/almostEqual.html b/test/headless/geometry/Box/almostEqual.html new file mode 100644 index 00000000..9defc9fb --- /dev/null +++ b/test/headless/geometry/Box/almostEqual.html @@ -0,0 +1,62 @@ + + + + + Box:almostEqual - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/equal.html b/test/headless/geometry/Box/equal.html new file mode 100644 index 00000000..f410d7c8 --- /dev/null +++ b/test/headless/geometry/Box/equal.html @@ -0,0 +1,67 @@ + + + + + Box:equal - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Box/index.mjs b/test/headless/geometry/Box/index.mjs index f538a73e..badc3785 100644 --- a/test/headless/geometry/Box/index.mjs +++ b/test/headless/geometry/Box/index.mjs @@ -1,12 +1,12 @@ export default function (test) { const namespace = 'Box' const methods = [ - // 'almostEqual', TODO + 'almostEqual', 'at', 'atNorm', 'changeBasis', 'detectCollision', - // 'equal', TODO + 'equal', 'fromBoxes', 'fromPoints', 'getArea', From a3e280da18ba4a435c3032a55e647493f4427d45 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 15:37:25 +0200 Subject: [PATCH 070/118] migrate Circle test suite --- test/headless/geometry/Circle/boundaries.html | 49 +++++++++++ test/headless/geometry/Circle/collisions.html | 82 ++++++++++++++++++ .../geometry/Circle/construction.html | 55 ++++++++++++ test/headless/geometry/Circle/dimensions.html | 85 +++++++++++++++++++ test/headless/geometry/Circle/index.mjs | 20 +++++ test/headless/geometry/Circle/points.html | 65 ++++++++++++++ .../geometry/Circle/transformations.html | 58 +++++++++++++ .../headless/geometry/Circle/transitions.html | 75 ++++++++++++++++ .../geometry/Circle/translations.html | 59 +++++++++++++ test/headless/geometry/index.mjs | 2 + 10 files changed, 550 insertions(+) diff --git a/test/headless/geometry/Circle/boundaries.html b/test/headless/geometry/Circle/boundaries.html index e69de29b..14404c75 100644 --- a/test/headless/geometry/Circle/boundaries.html +++ b/test/headless/geometry/Circle/boundaries.html @@ -0,0 +1,49 @@ + + + + + Circle boundaries - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/collisions.html b/test/headless/geometry/Circle/collisions.html index e69de29b..d05adbdb 100644 --- a/test/headless/geometry/Circle/collisions.html +++ b/test/headless/geometry/Circle/collisions.html @@ -0,0 +1,82 @@ + + + + + Circle collisions - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/construction.html b/test/headless/geometry/Circle/construction.html index e69de29b..fc200794 100644 --- a/test/headless/geometry/Circle/construction.html +++ b/test/headless/geometry/Circle/construction.html @@ -0,0 +1,55 @@ + + + + + Circle construction - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/dimensions.html b/test/headless/geometry/Circle/dimensions.html index e69de29b..a918c6ab 100644 --- a/test/headless/geometry/Circle/dimensions.html +++ b/test/headless/geometry/Circle/dimensions.html @@ -0,0 +1,85 @@ + + + + + Circle dimensions - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/index.mjs b/test/headless/geometry/Circle/index.mjs index e69de29b..cc7da71a 100644 --- a/test/headless/geometry/Circle/index.mjs +++ b/test/headless/geometry/Circle/index.mjs @@ -0,0 +1,20 @@ +export default function (test) { + const namespace = 'Circle' + const methods = [ + 'boundaries', + 'collisions', + 'construction', + 'dimensions', + // 'equality', TODO + 'points', + 'transformations', + 'transitions', + 'translations' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Circle/points.html b/test/headless/geometry/Circle/points.html index e69de29b..81d36861 100644 --- a/test/headless/geometry/Circle/points.html +++ b/test/headless/geometry/Circle/points.html @@ -0,0 +1,65 @@ + + + + + Circle points - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/transformations.html b/test/headless/geometry/Circle/transformations.html index e69de29b..5bd5729b 100644 --- a/test/headless/geometry/Circle/transformations.html +++ b/test/headless/geometry/Circle/transformations.html @@ -0,0 +1,58 @@ + + + + + Circle transformations - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/transitions.html b/test/headless/geometry/Circle/transitions.html index e69de29b..88663944 100644 --- a/test/headless/geometry/Circle/transitions.html +++ b/test/headless/geometry/Circle/transitions.html @@ -0,0 +1,75 @@ + + + + + Circle transitions - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/translations.html b/test/headless/geometry/Circle/translations.html index e69de29b..f3934402 100644 --- a/test/headless/geometry/Circle/translations.html +++ b/test/headless/geometry/Circle/translations.html @@ -0,0 +1,59 @@ + + + + + Circle translations - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 78af42b1..a5215a4a 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -1,6 +1,7 @@ import testArea from './Area/index.mjs' import testBasis from './Basis/index.mjs' import testBox from './Box/index.mjs' +import testCircle from './Circle/index.mjs' import { makeTestAllOk } from '../utils.mjs' export default function (test, browser) { @@ -11,4 +12,5 @@ export default function (test, browser) { testArea(testAllOk) testBasis(testAllOk) testBox(testAllOk) + testCircle(testAllOk) } From b6c09773cb87911dce3ab29041d9248b15245a4c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 16:43:08 +0200 Subject: [PATCH 071/118] migrate Sphere test suite --- test/headless/geometry/Sphere/boundaries.html | 51 +++++++++++ test/headless/geometry/Sphere/collisions.html | 77 ++++++++++++++++ .../geometry/Sphere/construction.html | 56 ++++++++++++ test/headless/geometry/Sphere/dimensions.html | 91 +++++++++++++++++++ test/headless/geometry/Sphere/index.mjs | 21 +++++ test/headless/geometry/Sphere/measures.html | 49 ++++++++++ test/headless/geometry/Sphere/points.html | 51 +++++++++++ .../geometry/Sphere/transformations.html | 57 ++++++++++++ .../headless/geometry/Sphere/transitions.html | 75 +++++++++++++++ .../geometry/Sphere/translations.html | 59 ++++++++++++ test/headless/geometry/index.mjs | 2 + 11 files changed, 589 insertions(+) diff --git a/test/headless/geometry/Sphere/boundaries.html b/test/headless/geometry/Sphere/boundaries.html index e69de29b..de6c5ab3 100644 --- a/test/headless/geometry/Sphere/boundaries.html +++ b/test/headless/geometry/Sphere/boundaries.html @@ -0,0 +1,51 @@ + + + + + Sphere boundaries - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/collisions.html b/test/headless/geometry/Sphere/collisions.html index e69de29b..335749f0 100644 --- a/test/headless/geometry/Sphere/collisions.html +++ b/test/headless/geometry/Sphere/collisions.html @@ -0,0 +1,77 @@ + + + + + Sphere collisions - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/construction.html b/test/headless/geometry/Sphere/construction.html index e69de29b..997eb86a 100644 --- a/test/headless/geometry/Sphere/construction.html +++ b/test/headless/geometry/Sphere/construction.html @@ -0,0 +1,56 @@ + + + + + Sphere construction - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/dimensions.html b/test/headless/geometry/Sphere/dimensions.html index e69de29b..a38de9d2 100644 --- a/test/headless/geometry/Sphere/dimensions.html +++ b/test/headless/geometry/Sphere/dimensions.html @@ -0,0 +1,91 @@ + + + + + Sphere dimensions - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/index.mjs b/test/headless/geometry/Sphere/index.mjs index e69de29b..03823a9c 100644 --- a/test/headless/geometry/Sphere/index.mjs +++ b/test/headless/geometry/Sphere/index.mjs @@ -0,0 +1,21 @@ +export default function (test) { + const namespace = 'Sphere' + const methods = [ + 'boundaries', + 'collisions', + 'construction', + 'dimensions', + // 'equality', + 'measures', + 'points', + 'transformations', + 'transitions', + 'translations' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Sphere/measures.html b/test/headless/geometry/Sphere/measures.html index e69de29b..0c8bacb9 100644 --- a/test/headless/geometry/Sphere/measures.html +++ b/test/headless/geometry/Sphere/measures.html @@ -0,0 +1,49 @@ + + + + + Sphere measures - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/points.html b/test/headless/geometry/Sphere/points.html index e69de29b..9b56c0aa 100644 --- a/test/headless/geometry/Sphere/points.html +++ b/test/headless/geometry/Sphere/points.html @@ -0,0 +1,51 @@ + + + + + Sphere points - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/transformations.html b/test/headless/geometry/Sphere/transformations.html index e69de29b..c327dbba 100644 --- a/test/headless/geometry/Sphere/transformations.html +++ b/test/headless/geometry/Sphere/transformations.html @@ -0,0 +1,57 @@ + + + + + Sphere transformations - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/transitions.html b/test/headless/geometry/Sphere/transitions.html index e69de29b..5210f3ec 100644 --- a/test/headless/geometry/Sphere/transitions.html +++ b/test/headless/geometry/Sphere/transitions.html @@ -0,0 +1,75 @@ + + + + + Sphere transitions - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/translations.html b/test/headless/geometry/Sphere/translations.html index e69de29b..9b82a1af 100644 --- a/test/headless/geometry/Sphere/translations.html +++ b/test/headless/geometry/Sphere/translations.html @@ -0,0 +1,59 @@ + + + + + Sphere translations - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index a5215a4a..0efbdac5 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -2,6 +2,7 @@ import testArea from './Area/index.mjs' import testBasis from './Basis/index.mjs' import testBox from './Box/index.mjs' import testCircle from './Circle/index.mjs' +import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' export default function (test, browser) { @@ -13,4 +14,5 @@ export default function (test, browser) { testBasis(testAllOk) testBox(testAllOk) testCircle(testAllOk) + testSphere(testAllOk) } From 1f82c198dc415dca1b9606d97935c7fbe27580a0 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 16:53:35 +0200 Subject: [PATCH 072/118] test Circle :almostEqual :equal --- test/headless/geometry/Circle/equality.html | 72 +++++++++++++++++++++ test/headless/geometry/Circle/index.mjs | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 test/headless/geometry/Circle/equality.html diff --git a/test/headless/geometry/Circle/equality.html b/test/headless/geometry/Circle/equality.html new file mode 100644 index 00000000..aa5c7fba --- /dev/null +++ b/test/headless/geometry/Circle/equality.html @@ -0,0 +1,72 @@ + + + + + Circle equality - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Circle/index.mjs b/test/headless/geometry/Circle/index.mjs index cc7da71a..55b22d6f 100644 --- a/test/headless/geometry/Circle/index.mjs +++ b/test/headless/geometry/Circle/index.mjs @@ -5,7 +5,7 @@ export default function (test) { 'collisions', 'construction', 'dimensions', - // 'equality', TODO + 'equality', 'points', 'transformations', 'transitions', From f49f83d77a47c3798c610d061e4ac201dcb22c81 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 16:56:20 +0200 Subject: [PATCH 073/118] test Sphere :almostEqual :equal --- test/headless/geometry/Sphere/equality.html | 72 +++++++++++++++++++++ test/headless/geometry/Sphere/index.mjs | 2 +- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 test/headless/geometry/Sphere/equality.html diff --git a/test/headless/geometry/Sphere/equality.html b/test/headless/geometry/Sphere/equality.html new file mode 100644 index 00000000..dd5dc84f --- /dev/null +++ b/test/headless/geometry/Sphere/equality.html @@ -0,0 +1,72 @@ + + + + + Sphere equality - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Sphere/index.mjs b/test/headless/geometry/Sphere/index.mjs index 03823a9c..77bf4936 100644 --- a/test/headless/geometry/Sphere/index.mjs +++ b/test/headless/geometry/Sphere/index.mjs @@ -5,7 +5,7 @@ export default function (test) { 'collisions', 'construction', 'dimensions', - // 'equality', + 'equality', 'measures', 'points', 'transformations', From 8945f74fbc71d6fe1f96210f6fa41d6e38cfaa4c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 17:00:04 +0200 Subject: [PATCH 074/118] migrate Direction test suite --- test/headless/geometry/Direction/getRaw.html | 51 ++++++++++++++++++++ test/headless/geometry/Direction/index.mjs | 12 +++++ test/headless/geometry/index.mjs | 2 + 3 files changed, 65 insertions(+) diff --git a/test/headless/geometry/Direction/getRaw.html b/test/headless/geometry/Direction/getRaw.html index e69de29b..ca85ef48 100644 --- a/test/headless/geometry/Direction/getRaw.html +++ b/test/headless/geometry/Direction/getRaw.html @@ -0,0 +1,51 @@ + + + + + Direction :getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Direction/index.mjs b/test/headless/geometry/Direction/index.mjs index e69de29b..a5c5f5b1 100644 --- a/test/headless/geometry/Direction/index.mjs +++ b/test/headless/geometry/Direction/index.mjs @@ -0,0 +1,12 @@ +export default function (test) { + const namespace = 'Direction' + const methods = [ + 'getRaw' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 0efbdac5..13fe7726 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -2,6 +2,7 @@ import testArea from './Area/index.mjs' import testBasis from './Basis/index.mjs' import testBox from './Box/index.mjs' import testCircle from './Circle/index.mjs' +import testDirection from './Direction/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -14,5 +15,6 @@ export default function (test, browser) { testBasis(testAllOk) testBox(testAllOk) testCircle(testAllOk) + testDirection(testAllOk) testSphere(testAllOk) } From 2faf5ca20fb4afc1ed3bbe6b8c2506d604a33d1e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 17:02:34 +0200 Subject: [PATCH 075/118] remove migrated original geometry test suites --- test/geometry.test/Area.test/index.js | 10 --- .../geometry.test/Area.test/projectTo.test.js | 33 --------- test/geometry.test/Area.test/template.ejs | 1 - .../Area.test/transitRaw.test.js | 26 ------- test/geometry.test/Basis.test/at.test.js | 25 ------- .../Basis.test/changeBasis.test.js | 25 ------- .../Basis.test/createDirection.test.js | 29 -------- .../Basis.test/createVector.test.js | 25 ------- .../Basis.test/getMatchedOuter.test.js | 34 ---------- .../Basis.test/getTransformTo.test.js | 44 ------------ test/geometry.test/Basis.test/index.js | 22 ------ test/geometry.test/Basis.test/offsets.test.js | 67 ------------------- .../geometry.test/Basis.test/rotateBy.test.js | 25 ------- .../Basis.test/rotateByDegrees.test.js | 25 ------- test/geometry.test/Basis.test/scaleBy.test.js | 25 ------- test/geometry.test/Basis.test/template.ejs | 1 - .../Basis.test/transformBy.test.js | 29 -------- .../Basis.test/transitRaw.test.js | 31 --------- .../Basis.test/transitRawOuter.test.js | 25 ------- .../Basis.test/translateBy.test.js | 25 ------- test/geometry.test/Box.test/at.test.js | 25 ------- test/geometry.test/Box.test/atNorm.test.js | 25 ------- .../Box.test/changeBasis.test.js | 32 --------- .../geometry.test/Box.test/collisions.test.js | 49 -------------- test/geometry.test/Box.test/fromBoxes.test.js | 58 ---------------- .../geometry.test/Box.test/fromPoints.test.js | 43 ------------ test/geometry.test/Box.test/getArea.test.js | 25 ------- .../Box.test/getBoundingBox.test.js | 60 ----------------- .../Box.test/getBoundingCircle.test.js | 28 -------- .../Box.test/getBoundingSphere.test.js | 28 -------- .../Box.test/getInnerSquare.test.js | 34 ---------- test/geometry.test/Box.test/getVolume.test.js | 39 ----------- test/geometry.test/Box.test/index.js | 27 -------- test/geometry.test/Box.test/normAt.test.js | 30 --------- test/geometry.test/Box.test/projectTo.test.js | 43 ------------ test/geometry.test/Box.test/resizeTo.test.js | 47 ------------- test/geometry.test/Box.test/rotateBy.test.js | 30 --------- test/geometry.test/Box.test/scaleBy.test.js | 32 --------- test/geometry.test/Box.test/template.ejs | 1 - .../geometry.test/Box.test/transitRaw.test.js | 26 ------- .../Box.test/translateBy.test.js | 27 -------- .../Circle.test/boundaries.test.js | 23 ------- .../Circle.test/collisions.test.js | 56 ---------------- .../Circle.test/construction.test.js | 30 --------- .../Circle.test/dimensions.test.js | 66 ------------------ test/geometry.test/Circle.test/index.js | 16 ----- test/geometry.test/Circle.test/points.test.js | 55 --------------- test/geometry.test/Circle.test/template.ejs | 1 - .../Circle.test/transformations.test.js | 32 --------- .../Circle.test/transitions.test.js | 47 ------------- .../Circle.test/translations.test.js | 29 -------- test/geometry.test/Direction.test/index.js | 25 ------- .../geometry.test/Direction.test/template.ejs | 1 - .../Sphere.test/boundaries.test.js | 23 ------- .../Sphere.test/collisions.test.js | 49 -------------- .../Sphere.test/construction.test.js | 30 --------- .../Sphere.test/dimensions.test.js | 53 --------------- test/geometry.test/Sphere.test/index.js | 17 ----- .../Sphere.test/measures.test.js | 23 ------- test/geometry.test/Sphere.test/points.test.js | 23 ------- test/geometry.test/Sphere.test/template.ejs | 1 - .../Sphere.test/transformations.test.js | 32 --------- .../Sphere.test/transitions.test.js | 47 ------------- .../Sphere.test/translations.test.js | 29 -------- test/geometry.test/index.js | 6 -- 65 files changed, 1950 deletions(-) delete mode 100644 test/geometry.test/Area.test/index.js delete mode 100644 test/geometry.test/Area.test/projectTo.test.js delete mode 100644 test/geometry.test/Area.test/template.ejs delete mode 100644 test/geometry.test/Area.test/transitRaw.test.js delete mode 100644 test/geometry.test/Basis.test/at.test.js delete mode 100644 test/geometry.test/Basis.test/changeBasis.test.js delete mode 100644 test/geometry.test/Basis.test/createDirection.test.js delete mode 100644 test/geometry.test/Basis.test/createVector.test.js delete mode 100644 test/geometry.test/Basis.test/getMatchedOuter.test.js delete mode 100644 test/geometry.test/Basis.test/getTransformTo.test.js delete mode 100644 test/geometry.test/Basis.test/index.js delete mode 100644 test/geometry.test/Basis.test/offsets.test.js delete mode 100644 test/geometry.test/Basis.test/rotateBy.test.js delete mode 100644 test/geometry.test/Basis.test/rotateByDegrees.test.js delete mode 100644 test/geometry.test/Basis.test/scaleBy.test.js delete mode 100644 test/geometry.test/Basis.test/template.ejs delete mode 100644 test/geometry.test/Basis.test/transformBy.test.js delete mode 100644 test/geometry.test/Basis.test/transitRaw.test.js delete mode 100644 test/geometry.test/Basis.test/transitRawOuter.test.js delete mode 100644 test/geometry.test/Basis.test/translateBy.test.js delete mode 100644 test/geometry.test/Box.test/at.test.js delete mode 100644 test/geometry.test/Box.test/atNorm.test.js delete mode 100644 test/geometry.test/Box.test/changeBasis.test.js delete mode 100644 test/geometry.test/Box.test/collisions.test.js delete mode 100644 test/geometry.test/Box.test/fromBoxes.test.js delete mode 100644 test/geometry.test/Box.test/fromPoints.test.js delete mode 100644 test/geometry.test/Box.test/getArea.test.js delete mode 100644 test/geometry.test/Box.test/getBoundingBox.test.js delete mode 100644 test/geometry.test/Box.test/getBoundingCircle.test.js delete mode 100644 test/geometry.test/Box.test/getBoundingSphere.test.js delete mode 100644 test/geometry.test/Box.test/getInnerSquare.test.js delete mode 100644 test/geometry.test/Box.test/getVolume.test.js delete mode 100644 test/geometry.test/Box.test/index.js delete mode 100644 test/geometry.test/Box.test/normAt.test.js delete mode 100644 test/geometry.test/Box.test/projectTo.test.js delete mode 100644 test/geometry.test/Box.test/resizeTo.test.js delete mode 100644 test/geometry.test/Box.test/rotateBy.test.js delete mode 100644 test/geometry.test/Box.test/scaleBy.test.js delete mode 100644 test/geometry.test/Box.test/template.ejs delete mode 100644 test/geometry.test/Box.test/transitRaw.test.js delete mode 100644 test/geometry.test/Box.test/translateBy.test.js delete mode 100644 test/geometry.test/Circle.test/boundaries.test.js delete mode 100644 test/geometry.test/Circle.test/collisions.test.js delete mode 100644 test/geometry.test/Circle.test/construction.test.js delete mode 100644 test/geometry.test/Circle.test/dimensions.test.js delete mode 100644 test/geometry.test/Circle.test/index.js delete mode 100644 test/geometry.test/Circle.test/points.test.js delete mode 100644 test/geometry.test/Circle.test/template.ejs delete mode 100644 test/geometry.test/Circle.test/transformations.test.js delete mode 100644 test/geometry.test/Circle.test/transitions.test.js delete mode 100644 test/geometry.test/Circle.test/translations.test.js delete mode 100644 test/geometry.test/Direction.test/index.js delete mode 100644 test/geometry.test/Direction.test/template.ejs delete mode 100644 test/geometry.test/Sphere.test/boundaries.test.js delete mode 100644 test/geometry.test/Sphere.test/collisions.test.js delete mode 100644 test/geometry.test/Sphere.test/construction.test.js delete mode 100644 test/geometry.test/Sphere.test/dimensions.test.js delete mode 100644 test/geometry.test/Sphere.test/index.js delete mode 100644 test/geometry.test/Sphere.test/measures.test.js delete mode 100644 test/geometry.test/Sphere.test/points.test.js delete mode 100644 test/geometry.test/Sphere.test/template.ejs delete mode 100644 test/geometry.test/Sphere.test/transformations.test.js delete mode 100644 test/geometry.test/Sphere.test/transitions.test.js delete mode 100644 test/geometry.test/Sphere.test/translations.test.js diff --git a/test/geometry.test/Area.test/index.js b/test/geometry.test/Area.test/index.js deleted file mode 100644 index 3f5f7b29..00000000 --- a/test/geometry.test/Area.test/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const units = { - projectTo: require('./projectTo.test'), - transitRaw: require('./transitRaw.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Area.test/projectTo.test.js b/test/geometry.test/Area.test/projectTo.test.js deleted file mode 100644 index fa928ab9..00000000 --- a/test/geometry.test/Area.test/projectTo.test.js +++ /dev/null @@ -1,33 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Area:projectTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Virtual camera - const camDist = 300 - const camera = view.atCenter().offset(0, 0, -camDist) - - // Create an element - const hello = tapspace.createItem('hello') - hello.setSize({ w: 20, h: 20 }) - space.addChild(hello, space.at(10, 10, camDist)) - - // Create area - const area = hello.getArea() - - // Original area: 400 - t.equal( - area.projectTo(view, camera).getNumber(), - 100, - 'should have quarter of original area' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Area.test/template.ejs b/test/geometry.test/Area.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Area.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Area.test/transitRaw.test.js b/test/geometry.test/Area.test/transitRaw.test.js deleted file mode 100644 index 1db48d8a..00000000 --- a/test/geometry.test/Area.test/transitRaw.test.js +++ /dev/null @@ -1,26 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Area:transitRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - space.scaleBy(2, space.at(0, 0)) - - // Create an element - const hello = tapspace.createItem('hello') - hello.setSize({ w: 20, h: 20 }) - space.addChild(hello, space.at(10, 10, 10)) - - // Create area - const area = hello.getArea() - - t.deepEqual(area.getRaw(), 400, 'should have correct area') - t.deepEqual(area.transitRaw(view), 1600, 'should scale as area') - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/at.test.js b/test/geometry.test/Basis.test/at.test.js deleted file mode 100644 index 403566d8..00000000 --- a/test/geometry.test/Basis.test/at.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:at', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis() - - t.almostEqualPoint( - basis.at(0, 0).changeBasis(space), - space.at(10, 10), - 'should be same point' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/changeBasis.test.js b/test/geometry.test/Basis.test/changeBasis.test.js deleted file mode 100644 index 67195fbb..00000000 --- a/test/geometry.test/Basis.test/changeBasis.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:changeBasis', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis() - - t.almostEqualPoint( - basis.changeBasis(space).at(0, 0), - space.at(10, 10), - 'should be same point' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/createDirection.test.js b/test/geometry.test/Basis.test/createDirection.test.js deleted file mode 100644 index 82064542..00000000 --- a/test/geometry.test/Basis.test/createDirection.test.js +++ /dev/null @@ -1,29 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis :createDirection', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - space.rotateBy(Math.PI / 2) - - const spaceBasis = space.getBasis() - - t.almostEqualDirection( - spaceBasis.createDirection(Math.PI / 2).transitRaw(view), - { x: -1, y: 0, z: 0 }, - 'should handle default phi' - ) - - t.almostEqualDirection( - spaceBasis.createDirection(Math.PI / 2, 0).transitRaw(view), - { x: 0, y: 0, z: 1 }, - 'should handle zero phi' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/createVector.test.js b/test/geometry.test/Basis.test/createVector.test.js deleted file mode 100644 index d3aa13e7..00000000 --- a/test/geometry.test/Basis.test/createVector.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis :createVector', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20, 20)) - - const itemBasis = item.getBasis() - - t.almostEqualVector( - itemBasis.createVector(10, 20).transitRaw(space), - { x: 10, y: 20, z: 0 }, - 'should not be affected on basis translation' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/getMatchedOuter.test.js b/test/geometry.test/Basis.test/getMatchedOuter.test.js deleted file mode 100644 index 77f19c6f..00000000 --- a/test/geometry.test/Basis.test/getMatchedOuter.test.js +++ /dev/null @@ -1,34 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:getMatchedOuter', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // A target in space - const target = tapspace.createItem('Hello') - space.addChild(target) - target.translateBy({ x: 100, y: 50 }).scaleBy(0.5, space.at(50, 50)) - - // An item not in space. - const loose = tapspace.createItem('World') - const looseBasis = loose.getBasis() - .translateBy({ x: 100, y: 50 }) - .scaleBy(0.5, loose.at(50, 50)) - - // Find basis for the loose item - const outerBasis = looseBasis.getMatchedOuter(target.getBasis()) - - t.deepEqual( - outerBasis.changeBasis(space).getRaw(), - space.getBasis().getRaw(), - 'should match space basis' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/getTransformTo.test.js b/test/geometry.test/Basis.test/getTransformTo.test.js deleted file mode 100644 index 595630ec..00000000 --- a/test/geometry.test/Basis.test/getTransformTo.test.js +++ /dev/null @@ -1,44 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:getTransformTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Create two bases - const pa = space.getBasis() - const pb = space.getBasis().offset(10, 20).scaleBy(2, space.at(0, 0)) - - // Compute transform between them - const tr = pa.getTransformTo(pb).getRaw() - t.deepEqual( - tr, - { a: 2, b: 0, x: 20, y: 40, z: 0 }, - 'should be transformation' - ) - - // Create two bases - const pc = space.getBasis().offset(10, 20) - const pd = space.getBasis().offset(10, 20).scaleBy(2) - - // Compute transform between them - const trcd = pc.getTransformTo(pd) - t.deepEqual( - trcd.getRaw(), - { a: 2, b: 0, x: 0, y: 0, z: 0 }, - 'should be scaling transformation' - ) - - t.almostEqualBasis( - pc.transformBy(trcd), - pd, - 'should be same when applied' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/index.js b/test/geometry.test/Basis.test/index.js deleted file mode 100644 index 33cf11b5..00000000 --- a/test/geometry.test/Basis.test/index.js +++ /dev/null @@ -1,22 +0,0 @@ -const units = { - at: require('./at.test'), - changeBasis: require('./changeBasis.test'), - createDirection: require('./createDirection.test'), - createVector: require('./createVector.test'), - getMatchedOuter: require('./getMatchedOuter.test'), - getTransformTo: require('./getTransformTo.test'), - offsets: require('./offsets.test'), - rotateBy: require('./rotateBy.test'), - rotateByDegrees: require('./rotateByDegrees.test'), - scaleBy: require('./scaleBy.test'), - transformBy: require('./transformBy.test'), - transitRaw: require('./transitRaw.test'), - transitRawOuter: require('./transitRawOuter.test'), - translateBy: require('./translateBy.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Basis.test/offsets.test.js b/test/geometry.test/Basis.test/offsets.test.js deleted file mode 100644 index 0aaaf387..00000000 --- a/test/geometry.test/Basis.test/offsets.test.js +++ /dev/null @@ -1,67 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis :innerOffset :outerOffset :polarOffset', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - // Item origin at (10, 10) - // Item center at (20, 20) - - const itemBasis = item.getBasis() - const rotBasis = itemBasis.rotateBy(Math.PI / 2) - const scarotBasis = rotBasis.scaleBy(2) - // Item basis and tge scaled and rotated basis have origin at (10, 10) - - const innerOffsetBasis = scarotBasis.innerOffset(5, 2, 1) - // Item x-axis points down and is 2 units long. - // Item y-axis points left and is 2 units long. - // Dx of 5 is therefore 10 units long. - // Dy of 2 is therefore 4 units long. - // Dz of 1 is therefore 2 units long. - // Dx' is -Dy is -4 units. - // Dy' is Dx is 10 units. - // Dz' is Dz is 2 units. - // Item origin at (10, 10, 0) in space - // scarotBasis origin at (10, 10, 0) in space - t.almostEqualPoint( - innerOffsetBasis.at(0, 0).changeBasis(space), - space.at(6, 20, 2), - 'should rotate and scale' - ) - - const outerOffsetBasis = scarotBasis.outerOffset(5, 2, 1) - // scarotBasis origin at (10, 10, 0) in space - t.almostEqualPoint( - outerOffsetBasis.at(0, 0).changeBasis(space), - space.at(15, 12, 1), - 'should translate in outer basis' - ) - - // Polar offset - const geo = tapspace.geometry - const distance = new geo.Distance(space, 20) - const direction = new geo.Direction(space, { x: 0, y: 1, z: 0 }) - const polarBasis = scarotBasis.polarOffset(distance, direction) - const rawBasis = scarotBasis.polarOffset(10, 0) - - t.almostEqualPoint( - polarBasis.at(0, 0).changeBasis(space), - space.at(10, 30), - 'should do polar offset' - ) - t.almostEqualPoint( - rawBasis.at(0, 0).changeBasis(space), - polarBasis.at(0, 0).changeBasis(space), - 'should match raw' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/rotateBy.test.js b/test/geometry.test/Basis.test/rotateBy.test.js deleted file mode 100644 index e06f8db1..00000000 --- a/test/geometry.test/Basis.test/rotateBy.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:rotateBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis().rotateBy(Math.PI, item.atAnchor()) - - t.almostEqualBasis( - basis.getRaw(), - { a: -1, b: 0, x: 20, y: 20, z: 0 }, - 'should be rotated' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/rotateByDegrees.test.js b/test/geometry.test/Basis.test/rotateByDegrees.test.js deleted file mode 100644 index 9ea59b8b..00000000 --- a/test/geometry.test/Basis.test/rotateByDegrees.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:rotateByDegrees', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis().rotateByDegrees(180, item.atAnchor()) - - t.almostEqualBasis( - basis.getRaw(), - { a: -1, b: 0, x: 20, y: 20, z: 0 }, - 'should be rotated 180 deg' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/scaleBy.test.js b/test/geometry.test/Basis.test/scaleBy.test.js deleted file mode 100644 index fabe1c59..00000000 --- a/test/geometry.test/Basis.test/scaleBy.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:scaleBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis().scaleBy(2, item.atAnchor()) - - t.deepEqual( - basis.getRaw(), - { a: 2, b: 0, x: -10, y: -10, z: 0 }, - 'should be scaled' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/template.ejs b/test/geometry.test/Basis.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Basis.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Basis.test/transformBy.test.js b/test/geometry.test/Basis.test/transformBy.test.js deleted file mode 100644 index 75a5790f..00000000 --- a/test/geometry.test/Basis.test/transformBy.test.js +++ /dev/null @@ -1,29 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:transformBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const tr = tapspace.geometry.Transform.fromFeatures({ - basis: space, - scale: 2 // TODO dilation - }) - const basis = item.getBasis().transformBy(tr, item.atCenter()) - - t.deepEqual( - basis.getRaw(), - { a: 2, b: 0, x: -10, y: -10, z: 0 }, - 'should be scaled' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/transitRaw.test.js b/test/geometry.test/Basis.test/transitRaw.test.js deleted file mode 100644 index da5c4088..00000000 --- a/test/geometry.test/Basis.test/transitRaw.test.js +++ /dev/null @@ -1,31 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:transitRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis() - - t.deepEqual( - basis.transitRaw(item), - { a: 1, b: 0, x: 0, y: 0, z: 0 }, - 'should be default' - ) - - t.deepEqual( - basis.transitRaw(space), - { a: 1, b: 0, x: 10, y: 10, z: 0 }, - 'should be in space' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/transitRawOuter.test.js b/test/geometry.test/Basis.test/transitRawOuter.test.js deleted file mode 100644 index 67eb7eb3..00000000 --- a/test/geometry.test/Basis.test/transitRawOuter.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:transitRawOuter', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis() - - t.deepEqual( - basis.transitRawOuter(item), - { a: 1, b: 0, x: 10, y: 10, z: 0 }, - 'should be in space' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Basis.test/translateBy.test.js b/test/geometry.test/Basis.test/translateBy.test.js deleted file mode 100644 index d179da10..00000000 --- a/test/geometry.test/Basis.test/translateBy.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Basis:translateBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20)) - - const basis = item.getBasis().translateBy({ x: 30, y: 30 }) - - t.almostEqualPoint( - basis.at(0, 0).changeBasis(space), - space.at(40, 40), - 'should be same point' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/at.test.js b/test/geometry.test/Box.test/at.test.js deleted file mode 100644 index 4ad1ff79..00000000 --- a/test/geometry.test/Box.test/at.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:at', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item) - - // Get a box - const box = item.getBoundingBox() - - t.almostEqualPoint( - box.at(10, 10), - item.at(10, 10), - 'box and item share the basis' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/atNorm.test.js b/test/geometry.test/Box.test/atNorm.test.js deleted file mode 100644 index 99caea72..00000000 --- a/test/geometry.test/Box.test/atNorm.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:atNorm', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item) - - // Get a box - const box = item.getBoundingBox() - - t.almostEqualPoint( - box.atNorm(1, 1, 1), - item.at(20, 20, 0), - 'same back bottom right corner' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/changeBasis.test.js b/test/geometry.test/Box.test/changeBasis.test.js deleted file mode 100644 index 1af06a60..00000000 --- a/test/geometry.test/Box.test/changeBasis.test.js +++ /dev/null @@ -1,32 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:changeBasis', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(10, 20, 30)) - - // Get a box - const boxOnItem = item.getBoundingBox() - const boxOnSpace = boxOnItem.changeBasis(space) - - t.almostEqualPoint( - boxOnItem.at(10, 10, 20).transitRaw(view), - boxOnSpace.at(10, 10, 20).transitRaw(view), - 'same box' - ) - - t.notEqual( - boxOnItem.basis, - boxOnSpace.basis, - 'different basis' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/collisions.test.js b/test/geometry.test/Box.test/collisions.test.js deleted file mode 100644 index 5547101a..00000000 --- a/test/geometry.test/Box.test/collisions.test.js +++ /dev/null @@ -1,49 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box :detectCollision', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { a: 1, b: 0, x: 0, y: 0, z: 0, w: 1, h: 1, d: 1 } - const box = new tapspace.geometry.Box(space, plain) - - t.true( - box.detectCollision(space.at(0.5, 0.5, 0.5)), - 'point should hit box inside' - ) - t.true( - box.detectCollision(space.at(1, 1, 1)), - 'point should hit box corner' - ) - t.false( - box.detectCollision(space.at(0, 2)), - 'point should be outside the box' - ) - - t.throws(() => { - box.detectCollision(space.createVector(1, 0, 0)) - }, 'should detect unsupported geometry') - - const plainn = { a: 1, b: 0, x: -1, y: -1, z: 0, w: 1, h: 1, d: 1 } - const boxAlt = new tapspace.geometry.Box(view, plainn) - - t.true( - box.detectCollision(boxAlt), - 'boxes should touch at edge' - ) - - const boxRot = boxAlt.rotateBy(0.1, boxAlt.atNorm(0.5, 0.5)) - - t.false( - box.detectCollision(boxRot), - 'boxes should not touch' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/fromBoxes.test.js b/test/geometry.test/Box.test/fromBoxes.test.js deleted file mode 100644 index 32f9d6f1..00000000 --- a/test/geometry.test/Box.test/fromBoxes.test.js +++ /dev/null @@ -1,58 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - const Box = tapspace.geometry.Box - - test('Box:fromBoxes', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space, view.at(10, 10)) - - const items = [] - items.push(tapspace.createNode(1, 'black')) - space.addChild(items[0], space.at(0, 0, 0)) - items.push(tapspace.createNode(1, 'black')) - space.addChild(items[1], space.at(2, 2, 2)) - - const boxes = items.map(item => item.getBoundingBox()) - - // Get the box, represent on viewport - const bounds = Box.fromBoxes(view, boxes) - - t.deepEqual( - bounds.at(0, 0).getRaw(), - { x: 9, y: 9, z: 0 }, - 'should have correct origin' - ) - t.deepEqual( - bounds.getSize().getRaw(), - { w: 4, h: 4, d: 2 }, - 'should have correct origin' - ) - - // Get bounding box on custom basis - const scale = 1 - const angle = Math.PI / 4 // 45 deg - const basis = space.createBasis({ x: 0, y: 0 }, scale, angle) - const orientation = basis.getOrientation() - - const orientedBoxes = items.map(item => item.getBoundingBox(orientation)) - const orientedBounds = Box.fromBoxes(basis, orientedBoxes) - - t.almostEqualPoint( - orientedBounds.atNorm(0, 0).getRaw(), - { x: 0, y: -Math.SQRT2, z: 0 }, - 'should have correct oriented origin' - ) - t.deepEqual( - orientedBounds.atNorm(1, 1).getRaw(), - { x: 2, y: 2 + Math.SQRT2, z: 0 }, - 'should have correct oriented corner' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/fromPoints.test.js b/test/geometry.test/Box.test/fromPoints.test.js deleted file mode 100644 index 2b17a2d6..00000000 --- a/test/geometry.test/Box.test/fromPoints.test.js +++ /dev/null @@ -1,43 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:fromPoints', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(2, 'black') - space.addChild(item, space.at(4, 2, 1)) - - // A bunch of points: - // - // +orig - // +p0 +p1 - // +item - // +p2 - // - // Unit: - // ++ 1 - // +--+ 2 - // +----+ 3 - // - const points = [ - view.at(2, 1), - space.at(6, 1), - item.at(2, 3) - ] - - // Get the box, represent on item - const bounds = tapspace.geometry.Box.fromPoints(item, points) - - t.deepEqual( - bounds.getSize().getRaw(), - { w: 4, h: 2, d: 1 }, - 'should have correct depth' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/getArea.test.js b/test/geometry.test/Box.test/getArea.test.js deleted file mode 100644 index 5c7c6a2f..00000000 --- a/test/geometry.test/Box.test/getArea.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:getArea', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createItem('hello') - item.setSize(20, 10) - space.addChild(item, space.at(10, 20, 30)) - - // Get a box - const box = item.getBoundingBox() - // Get area - const area = box.getArea() - - t.deepEqual(area.transitRaw(view), 200, 'should be correct area') - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/getBoundingBox.test.js b/test/geometry.test/Box.test/getBoundingBox.test.js deleted file mode 100644 index 3ad72c0c..00000000 --- a/test/geometry.test/Box.test/getBoundingBox.test.js +++ /dev/null @@ -1,60 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:getBoundingBox', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(10, 10, 30)) - - // Get a box - const box = item.getBoundingBox() - const deg45 = Math.PI / 4 - const rotatedBox = box.rotateBy(deg45, box.atNorm(0.5, 0.5)) - - // Get boundary - const bounds = rotatedBox.getBoundingBox() - - t.almostEqual( - bounds.getWidth().getNumber(), - 20, - 'box size should not grow' - ) - - t.almostEqualPoint( - bounds.atNorm(0.5, 0.5), - box.atNorm(0.5, 0.5), - 'box still at same origin' - ) - - // Test custom orientation - const orientedBounds = rotatedBox.getBoundingBox(space) - - t.almostEqualBox( - rotatedBox.getBoundingBox(space.getOrientation()), - orientedBounds, - 'should allow Orientation' - ) - - const size = 20 * Math.sqrt(2) - const offset = 10 - size / 2 - - t.almostEqual( - orientedBounds.getWidth().getNumber(), - size, - 'box size should grow' - ) - - t.almostEqualBox( - orientedBounds.getRaw(), - { a: 1, b: 0, x: offset, y: offset, z: 0, w: size, h: size, d: 0 }, - 'box should be correct' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/getBoundingCircle.test.js b/test/geometry.test/Box.test/getBoundingCircle.test.js deleted file mode 100644 index ef0949e7..00000000 --- a/test/geometry.test/Box.test/getBoundingCircle.test.js +++ /dev/null @@ -1,28 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:getBoundingCircle', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(10, 20, 30)) - - // Get a box - const box = item.getBoundingBox() - - // Get circle boundary - const circle = box.getBoundingCircle() - - t.almostEqualSphere( - circle.transitRaw(view), - { x: 10, y: 20, z: 30, r: Math.sqrt(200) }, - 'should have larger circle' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/getBoundingSphere.test.js b/test/geometry.test/Box.test/getBoundingSphere.test.js deleted file mode 100644 index 74cd043d..00000000 --- a/test/geometry.test/Box.test/getBoundingSphere.test.js +++ /dev/null @@ -1,28 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:getBoundingSphere', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(10, 20, 30)) - - // Get a box - const box = item.getBoundingBox() - - // Get spherical boundary - const sphere = box.getBoundingCircle() - - t.almostEqualSphere( - sphere.transitRaw(view), - { x: 10, y: 20, z: 30, r: Math.sqrt(200) }, - 'should have larger sphere' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/getInnerSquare.test.js b/test/geometry.test/Box.test/getInnerSquare.test.js deleted file mode 100644 index a9ffe0d5..00000000 --- a/test/geometry.test/Box.test/getInnerSquare.test.js +++ /dev/null @@ -1,34 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:getInnerSquare', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createItem('hello') - item.setSize(20, 10) - space.addChild(item, space.at(10, 20, 30)) - - // Get a box - const box = item.getBoundingBox() - // Inner square 10x10 - const square = box.getInnerSquare() - - // Test position - t.almostEqualPoint( - square.atNorm(0.5, 0).changeBasis(view), - box.atNorm(0.5, 0).changeBasis(view), - 'should have matching top center' - ) - - // Test area - const area = square.getArea() - t.deepEqual(area.transitRaw(view), 100, 'should be correct area') - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/getVolume.test.js b/test/geometry.test/Box.test/getVolume.test.js deleted file mode 100644 index 7d923653..00000000 --- a/test/geometry.test/Box.test/getVolume.test.js +++ /dev/null @@ -1,39 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:getVolume', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Scaled space - space.scaleBy(2) - - const front = tapspace.createItem('hello') - front.setSize(20, 10) - space.addChild(front, space.at(10, 20, 30)) - - const back = tapspace.createItem('hello') - back.setSize(20, 10) - space.addChild(back, space.at(10, 20, 50)) - - // Get a box - const box = space.getBoundingBox() - // Get volume - const vol = box.getVolume() - - t.deepEqual( - box.getSize().transitRaw(space), - { w: 20, h: 10, d: 20 }, - 'should have correct boundary' - ) - - t.equal(vol.transitRaw(space), 4000, 'should be correct volume in space') - t.equal(vol.transitRaw(view), 32000, 'should be correct volume in view') - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/index.js b/test/geometry.test/Box.test/index.js deleted file mode 100644 index f46f2bcd..00000000 --- a/test/geometry.test/Box.test/index.js +++ /dev/null @@ -1,27 +0,0 @@ -const units = { - at: require('./at.test'), - atNorm: require('./atNorm.test'), - changeBasis: require('./changeBasis.test'), - collisions: require('./collisions.test'), - fromBoxes: require('./fromBoxes.test'), - fromPoints: require('./fromPoints.test'), - getArea: require('./getArea.test'), - getBoundingBox: require('./getBoundingBox.test'), - getBoundingCircle: require('./getBoundingCircle.test'), - getBoundingSphere: require('./getBoundingSphere.test'), - getInnerSquare: require('./getInnerSquare.test'), - getVolume: require('./getVolume.test'), - normAt: require('./normAt.test'), - projectTo: require('./projectTo.test'), - resizeTo: require('./resizeTo.test'), - rotateBy: require('./rotateBy.test'), - scaleBy: require('./scaleBy.test'), - transitRaw: require('./transitRaw.test'), - translateBy: require('./translateBy.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Box.test/normAt.test.js b/test/geometry.test/Box.test/normAt.test.js deleted file mode 100644 index dd657f93..00000000 --- a/test/geometry.test/Box.test/normAt.test.js +++ /dev/null @@ -1,30 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:normAt', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(0, 0)) - - // Get a box. Size is { w: 20, h: 20, d: 0 } - const box = item.getBoundingBox() - - t.deepEqual( - box.normAt(0, 0, 0), - { rx: 0, ry: 0, rz: 0 }, - 'trivial' - ) - t.deepEqual( - box.normAt(20, 20, 20), - { rx: 1, ry: 1, rz: 0 }, - 'should handle zero depth' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/projectTo.test.js b/test/geometry.test/Box.test/projectTo.test.js deleted file mode 100644 index 04b3f8f9..00000000 --- a/test/geometry.test/Box.test/projectTo.test.js +++ /dev/null @@ -1,43 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:projectTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Virtual camera - const camDist = 300 - const camera = view.at(0, 0, -camDist) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(10, 10, camDist)) - // Get a box. It should be at space (0, 0, 300) and have size (20, 20, 0) - const box = item.getBoundingBox() - - const projectedBox = box.projectTo(view, camera) - - t.equal( - projectedBox.getWidth().getNumber(), - 10, - 'box size halved' - ) - - t.equal( - projectedBox.getDepth().getNumber(), - 0, - 'box has valid zero depth' - ) - - t.almostEqualPoint( - projectedBox.at(0, 0, 0).changeBasis(space), - space.at(0, 0, 0), - 'should stay near viewport zero' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/resizeTo.test.js b/test/geometry.test/Box.test/resizeTo.test.js deleted file mode 100644 index 5811722b..00000000 --- a/test/geometry.test/Box.test/resizeTo.test.js +++ /dev/null @@ -1,47 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:resizeTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createItem('hello') - item.setSize(20, 10) - space.addChild(item, space.at(10, 10, 30)) - - // Get a box - const box = item.getBoundingBox() - - t.deepEqual( - box.getSize().transitRaw(view), - { w: 20, h: 10, d: 0 }, - 'should have correct initial size' - ) - t.deepEqual( - box.at(0, 0).transitRaw(view), - { x: 10, y: 10, z: 30 }, - 'should have correct initial position' - ) - - const nextSize = { w: 40, h: 40, d: 10 } - const resizedBox = box.resizeTo(nextSize, box.atNorm(0.5, 0.5)) - - t.deepEqual( - resizedBox.getSize().transitRaw(view), - { w: 40, h: 40, d: 10 }, - 'should have new size' - ) - - t.deepEqual( - resizedBox.at(0, 0).transitRaw(view), - { x: 0, y: -5, z: 30 }, - 'should be translated' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/rotateBy.test.js b/test/geometry.test/Box.test/rotateBy.test.js deleted file mode 100644 index 1b685203..00000000 --- a/test/geometry.test/Box.test/rotateBy.test.js +++ /dev/null @@ -1,30 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:rotateBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createItem('hello') - item.setSize(20, 10) - item.setAnchor(0, 0) - space.addChild(item, space.at(10, 10, 30)) - - // Get a box - const box = item.getBoundingBox() - - // Flip around corner - const rotated = box.rotateBy(Math.PI, item.atBottomRight()) - - t.almostEqualPoint( - rotated.at(0, 0).transitRaw(view), - { x: 50, y: 30, z: 30 }, - 'the corner should be far' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/scaleBy.test.js b/test/geometry.test/Box.test/scaleBy.test.js deleted file mode 100644 index a88be6f4..00000000 --- a/test/geometry.test/Box.test/scaleBy.test.js +++ /dev/null @@ -1,32 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:scaleBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(10, 10, 30)) - - // Get a box - const box = item.getBoundingBox() - const scaledBox = box.scaleBy(2, item.atAnchor()) - - t.equal( - scaledBox.getWidth().getNumber(), - 40, - 'box size has doubled' - ) - - t.almostEqualPoint( - scaledBox.at(0, 0, 0).changeBasis(space), - space.at(-10, -10, 30), - 'left top corner has moved' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/template.ejs b/test/geometry.test/Box.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Box.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Box.test/transitRaw.test.js b/test/geometry.test/Box.test/transitRaw.test.js deleted file mode 100644 index 85ab93c6..00000000 --- a/test/geometry.test/Box.test/transitRaw.test.js +++ /dev/null @@ -1,26 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:transitRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(10, 20, 30)) - - // Get a box - const boxOnItem = item.getBoundingBox() - const plainBoxOnSpace = boxOnItem.transitRaw(space) - - t.deepEqual( - plainBoxOnSpace, - { a: 1, b: 0, x: 0, y: 10, z: 30, w: 20, h: 20, d: 0 }, - 'correct box type and position' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Box.test/translateBy.test.js b/test/geometry.test/Box.test/translateBy.test.js deleted file mode 100644 index ca0e327b..00000000 --- a/test/geometry.test/Box.test/translateBy.test.js +++ /dev/null @@ -1,27 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Box:translateBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createItem('hello') - item.setSize(20, 10) - item.setAnchor(0, 0) - space.addChild(item, space.at(10, 10, 30)) - - // Get a box - const box = item.getBoundingBox() - - t.almostEqualPoint( - box.translateBy({ x: 1, y: 2, z: 3 }).at(0, 0).transitRaw(view), - { x: 11, y: 12, z: 33 }, - 'should move the corner' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Circle.test/boundaries.test.js b/test/geometry.test/Circle.test/boundaries.test.js deleted file mode 100644 index 99800578..00000000 --- a/test/geometry.test/Circle.test/boundaries.test.js +++ /dev/null @@ -1,23 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Circle :getBoundingBox', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.deepEqual( - circle.getBoundingBox().getRaw(), - { a: 1, b: 0, x: 0, y: 0, z: 1, w: 2, h: 2, d: 0 }, - 'should have correct box' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Circle.test/collisions.test.js b/test/geometry.test/Circle.test/collisions.test.js deleted file mode 100644 index b3e0c032..00000000 --- a/test/geometry.test/Circle.test/collisions.test.js +++ /dev/null @@ -1,56 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Circle :detectCollision', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.true( - circle.detectCollision(space.at(1, 1, 1)), - 'point should hit circle inside' - ) - t.true( - circle.detectCollision(space.at(1, 0, 1)), - 'point should hit circle surface' - ) - t.false( - circle.detectCollision(space.at(0, 0, 0)), - 'point should be outside the circle' - ) - - t.throws(() => { - circle.detectCollision(space.createVector(1, 0, 0)) - }, 'should detect unsupported geometry') - - const plainn = { x: 3, y: 1, z: 1, r: 1 } - const circlee = new tapspace.geometry.Circle(view, plainn) - - t.true( - circle.detectCollision(circlee), - 'circles should touch' - ) - - const plainnn = { x: 4, y: 1, z: 1, r: 1 } - const circleee = new tapspace.geometry.Circle(view, plainnn) - t.false( - circle.detectCollision(circleee), - 'circles should not touch' - ) - - // Test getCollisionArea - t.equal( - circle.getCollisionArea(circlee).getRaw(), - 0, - 'circles should not overlap' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Circle.test/construction.test.js b/test/geometry.test/Circle.test/construction.test.js deleted file mode 100644 index bae68366..00000000 --- a/test/geometry.test/Circle.test/construction.test.js +++ /dev/null @@ -1,30 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - const Circle = tapspace.geometry.Circle - - test('Circle :fromPoints', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Extreme case: halved cube - const points = [ - space.at(0, 0, 0), - space.at(0, 0, 1), // z should not matter - space.at(0, 1, 0), - space.at(1, 0, 0) - ] - - t.deepEqual( - Circle.fromPoints(space, points).getRaw(), - { x: 0.5, y: 0.5, z: 0, r: Math.sqrt(2) / 2 }, - 'should be centered to bounding box' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Circle.test/dimensions.test.js b/test/geometry.test/Circle.test/dimensions.test.js deleted file mode 100644 index 7643e5d9..00000000 --- a/test/geometry.test/Circle.test/dimensions.test.js +++ /dev/null @@ -1,66 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Circle :getSize :getDiameter :getRadius', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.deepEqual( - circle.getSize().getRaw(), - { w: 2, h: 2, d: 0 }, - 'should have correct size' - ) - - t.deepEqual( - circle.getDiameter().getRaw(), - 2, - 'should have correct diameter' - ) - - t.deepEqual( - circle.getRadius().getRaw(), - 1, - 'should have correct radius' - ) - - t.deepEqual( - circle.getWidth().getRaw(), - 2, - 'should have correct width' - ) - - t.deepEqual( - circle.getHeight().getRaw(), - 2, - 'should have correct height' - ) - - t.end() - }) - - test('Circle :getArea', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.equal( - circle.getArea().getRaw(), - Math.PI, // πr² - 'should have correct area' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Circle.test/index.js b/test/geometry.test/Circle.test/index.js deleted file mode 100644 index 8674ac58..00000000 --- a/test/geometry.test/Circle.test/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const units = { - boundaries: require('./boundaries.test'), - collisions: require('./collisions.test'), - construction: require('./construction.test'), - dimensions: require('./dimensions.test'), - points: require('./points.test'), - transformations: require('./transformations.test'), - transitions: require('./transitions.test'), - translations: require('./translations.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Circle.test/points.test.js b/test/geometry.test/Circle.test/points.test.js deleted file mode 100644 index 9093eee6..00000000 --- a/test/geometry.test/Circle.test/points.test.js +++ /dev/null @@ -1,55 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Circle :atArc', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.almostEqualPoint( - circle.atArc(Math.PI), - space.at(0, 1, 1), - 'should match point at left perimeter' - ) - - t.almostEqualPoint( - circle.atArc(0), - space.at(2, 1, 1), - 'should match point at right perimeter' - ) - - t.almostEqualPoint( - circle.atArc(space.createDirection(Math.PI / 2)), - space.at(1, 2, 1), - 'should handle direction tensor' - ) - - t.end() - }) - - // - test('Circle :atCenter', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.almostEqualPoint( - circle.atCenter(), - space.at(1, 1, 1), - 'should match point at center' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Circle.test/template.ejs b/test/geometry.test/Circle.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Circle.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Circle.test/transformations.test.js b/test/geometry.test/Circle.test/transformations.test.js deleted file mode 100644 index b57c24d3..00000000 --- a/test/geometry.test/Circle.test/transformations.test.js +++ /dev/null @@ -1,32 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Circle :scaleBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.deepEqual( - circle.scaleBy(2).getRaw(), - { x: 1, y: 1, z: 1, r: 2 }, - 'should scale around center' - ) - - t.deepEqual( - circle.scaleBy(2, space.at(0, 0, 0)).getRaw(), - { x: 2, y: 2, z: 2, r: 2 }, - 'should scale around space origin' - ) - - t.end() - }) - - // TODO rotateAroundLine - // TODO rotateBy -} diff --git a/test/geometry.test/Circle.test/transitions.test.js b/test/geometry.test/Circle.test/transitions.test.js deleted file mode 100644 index 1b3e5cf3..00000000 --- a/test/geometry.test/Circle.test/transitions.test.js +++ /dev/null @@ -1,47 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Circle :changeBasis :transitRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20, 20)) - // item zero at 10 10 20 - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - const sphereOnItem = circle.changeBasis(item) - - t.equal( - circle.basis, - space, - 'should still have old basis' - ) - - t.equal( - sphereOnItem.basis, - item, - 'should have new basis' - ) - - t.almostEqualPoint( - sphereOnItem.atCenter().getRaw(), - { x: -9, y: -9, z: -19 }, - 'should be relative to item' - ) - - t.deepEqual( - circle.transitRaw(item), - { x: -9, y: -9, z: -19, r: 1 }, - 'should transit to item' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Circle.test/translations.test.js b/test/geometry.test/Circle.test/translations.test.js deleted file mode 100644 index 1c9154e5..00000000 --- a/test/geometry.test/Circle.test/translations.test.js +++ /dev/null @@ -1,29 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Circle :translateBy :offset :getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const circle = new tapspace.geometry.Circle(space, plain) - - t.deepEqual( - circle.translateBy({ x: 1, y: 1, z: 1 }).getRaw(), - { x: 2, y: 2, z: 2, r: 1 }, - 'should translate' - ) - - t.deepEqual( - circle.offset(1, 1, 1).getRaw(), - { x: 2, y: 2, z: 2, r: 1 }, - 'should offset' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Direction.test/index.js b/test/geometry.test/Direction.test/index.js deleted file mode 100644 index aa80bdfb..00000000 --- a/test/geometry.test/Direction.test/index.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Direction:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - // Create two Points - const pa = space.at(10, 6) - const pb = space.at(14, 9) - // Get a Direction from a to b - const d = pa.getDirectionTo(pb) - - t.deepEqual( - d.getRaw(), - { x: 0.8, y: 0.6, z: 0 }, - 'should convert to dir3 unit vector' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Direction.test/template.ejs b/test/geometry.test/Direction.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Direction.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Sphere.test/boundaries.test.js b/test/geometry.test/Sphere.test/boundaries.test.js deleted file mode 100644 index 866d7ecd..00000000 --- a/test/geometry.test/Sphere.test/boundaries.test.js +++ /dev/null @@ -1,23 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :getBoundingBox', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - t.deepEqual( - sphere.getBoundingBox().getRaw(), - { a: 1, b: 0, x: 0, y: 0, z: 0, w: 2, h: 2, d: 2 }, - 'should have correct box' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Sphere.test/collisions.test.js b/test/geometry.test/Sphere.test/collisions.test.js deleted file mode 100644 index 9338ec08..00000000 --- a/test/geometry.test/Sphere.test/collisions.test.js +++ /dev/null @@ -1,49 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :detectCollision', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - t.true( - sphere.detectCollision(space.at(1, 1, 1)), - 'point should hit sphere inside' - ) - t.true( - sphere.detectCollision(space.at(1, 0, 1)), - 'point should hit sphere surface' - ) - t.false( - sphere.detectCollision(space.at(0, 0, 0)), - 'point should be outside the sphere' - ) - - t.throws(() => { - sphere.detectCollision(space.createVector(1, 0, 0)) - }, 'should detect unsupported geometry') - - const plainn = { x: 3, y: 1, z: 1, r: 1 } - const spheree = new tapspace.geometry.Sphere(view, plainn) - - t.true( - sphere.detectCollision(spheree), - 'spheres should touch' - ) - - const plainnn = { x: 4, y: 1, z: 1, r: 1 } - const sphereee = new tapspace.geometry.Sphere(view, plainnn) - t.false( - sphere.detectCollision(sphereee), - 'spheres should not touch' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Sphere.test/construction.test.js b/test/geometry.test/Sphere.test/construction.test.js deleted file mode 100644 index 9a373e93..00000000 --- a/test/geometry.test/Sphere.test/construction.test.js +++ /dev/null @@ -1,30 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - const Sphere = tapspace.geometry.Sphere - - test('Sphere :fromPoints', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Extreme case: halved cube - const points = [ - space.at(0, 0, 0), - space.at(0, 0, 1), - space.at(0, 1, 0), - space.at(1, 0, 0) - ] - - t.deepEqual( - Sphere.fromPoints(space, points).getRaw(), - { x: 0.5, y: 0.5, z: 0.5, r: Math.sqrt(3) / 2 }, - 'should be centered to bounding box' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Sphere.test/dimensions.test.js b/test/geometry.test/Sphere.test/dimensions.test.js deleted file mode 100644 index 861640ee..00000000 --- a/test/geometry.test/Sphere.test/dimensions.test.js +++ /dev/null @@ -1,53 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :getSize :getDiameter :getRadius :getDepth', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - t.deepEqual( - sphere.getSize().getRaw(), - { w: 2, h: 2, d: 2 }, - 'should have correct size' - ) - - t.deepEqual( - sphere.getDiameter().getRaw(), - 2, - 'should have correct diameter' - ) - - t.deepEqual( - sphere.getRadius().getRaw(), - 1, - 'should have correct radius' - ) - - t.deepEqual( - sphere.getWidth().getRaw(), - 2, - 'should have correct width' - ) - - t.deepEqual( - sphere.getHeight().getRaw(), - 2, - 'should have correct height' - ) - - t.deepEqual( - sphere.getDepth().getRaw(), - 2, - 'should have correct depth' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Sphere.test/index.js b/test/geometry.test/Sphere.test/index.js deleted file mode 100644 index 11de146b..00000000 --- a/test/geometry.test/Sphere.test/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const units = { - boundaries: require('./boundaries.test'), - collisions: require('./collisions.test'), - construction: require('./construction.test'), - dimensions: require('./dimensions.test'), - measures: require('./measures.test'), - points: require('./points.test'), - transformations: require('./transformations.test'), - transitions: require('./transitions.test'), - translations: require('./translations.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Sphere.test/measures.test.js b/test/geometry.test/Sphere.test/measures.test.js deleted file mode 100644 index 292c4ea1..00000000 --- a/test/geometry.test/Sphere.test/measures.test.js +++ /dev/null @@ -1,23 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :getVolume', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - t.equal( - sphere.getVolume().getRaw(), - 4 * Math.PI / 3, - 'should have correct volume' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Sphere.test/points.test.js b/test/geometry.test/Sphere.test/points.test.js deleted file mode 100644 index a597c615..00000000 --- a/test/geometry.test/Sphere.test/points.test.js +++ /dev/null @@ -1,23 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :atCenter', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - t.almostEqualPoint( - sphere.atCenter(), - space.at(1, 1, 1), - 'should match point' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Sphere.test/template.ejs b/test/geometry.test/Sphere.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Sphere.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Sphere.test/transformations.test.js b/test/geometry.test/Sphere.test/transformations.test.js deleted file mode 100644 index 01c8dffe..00000000 --- a/test/geometry.test/Sphere.test/transformations.test.js +++ /dev/null @@ -1,32 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :scaleBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - t.deepEqual( - sphere.scaleBy(2).getRaw(), - { x: 1, y: 1, z: 1, r: 2 }, - 'should scale around center' - ) - - t.deepEqual( - sphere.scaleBy(2, space.at(0, 0, 0)).getRaw(), - { x: 2, y: 2, z: 2, r: 2 }, - 'should scale around space origin' - ) - - t.end() - }) - - // TODO rotateAroundLine - // TODO rotateBy -} diff --git a/test/geometry.test/Sphere.test/transitions.test.js b/test/geometry.test/Sphere.test/transitions.test.js deleted file mode 100644 index c931c31b..00000000 --- a/test/geometry.test/Sphere.test/transitions.test.js +++ /dev/null @@ -1,47 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :changeBasis :transitRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(20, 20, 20)) - // item zero at 10 10 20 - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - const sphereOnItem = sphere.changeBasis(item) - - t.equal( - sphere.basis, - space, - 'should still have old basis' - ) - - t.equal( - sphereOnItem.basis, - item, - 'should have new basis' - ) - - t.almostEqualPoint( - sphereOnItem.atCenter().getRaw(), - { x: -9, y: -9, z: -19 }, - 'should be relative to item' - ) - - t.deepEqual( - sphere.transitRaw(item), - { x: -9, y: -9, z: -19, r: 1 }, - 'should transit to item' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Sphere.test/translations.test.js b/test/geometry.test/Sphere.test/translations.test.js deleted file mode 100644 index 767591b2..00000000 --- a/test/geometry.test/Sphere.test/translations.test.js +++ /dev/null @@ -1,29 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Sphere :translateBy :offset :getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - const plain = { x: 1, y: 1, z: 1, r: 1 } - const sphere = new tapspace.geometry.Sphere(space, plain) - - t.deepEqual( - sphere.translateBy({ x: 1, y: 1, z: 1 }).getRaw(), - { x: 2, y: 2, z: 2, r: 1 }, - 'should translate' - ) - - t.deepEqual( - sphere.offset(1, 1, 1).getRaw(), - { x: 2, y: 2, z: 2, r: 1 }, - 'should offset' - ) - - t.end() - }) -} diff --git a/test/geometry.test/index.js b/test/geometry.test/index.js index 633b3792..bbc8ad9c 100644 --- a/test/geometry.test/index.js +++ b/test/geometry.test/index.js @@ -1,9 +1,4 @@ const units = { - Area: require('./Area.test'), - Basis: require('./Basis.test'), - Box: require('./Box.test'), - Circle: require('./Circle.test'), - Direction: require('./Direction.test'), Distance: require('./Distance.test'), Orientation: require('./Orientation.test'), Path: require('./Path.test'), @@ -11,7 +6,6 @@ const units = { Ray: require('./Ray.test'), Scale: require('./Scale.test'), Size: require('./Size.test'), - Sphere: require('./Sphere.test'), Transform: require('./Transform.test'), Vector: require('./Vector.test') } From 5e918744cf10048327e2d2c767104e262013b4e8 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 17:26:09 +0200 Subject: [PATCH 076/118] migrate Distance test suite --- .../Distance.test/comparison.test.js | 32 ----------- .../Distance.test/getRaw.test.js | 25 --------- test/geometry.test/Distance.test/index.js | 11 ---- .../Distance.test/projection.test.js | 25 --------- test/geometry.test/Distance.test/template.ejs | 1 - test/geometry.test/index.js | 1 - .../geometry/Distance/comparison.html | 56 +++++++++++++++++++ test/headless/geometry/Distance/getRaw.html | 51 +++++++++++++++++ test/headless/geometry/Distance/index.mjs | 14 +++++ .../geometry/Distance/projection.html | 53 ++++++++++++++++++ test/headless/geometry/index.mjs | 2 + 11 files changed, 176 insertions(+), 95 deletions(-) delete mode 100644 test/geometry.test/Distance.test/comparison.test.js delete mode 100644 test/geometry.test/Distance.test/getRaw.test.js delete mode 100644 test/geometry.test/Distance.test/index.js delete mode 100644 test/geometry.test/Distance.test/projection.test.js delete mode 100644 test/geometry.test/Distance.test/template.ejs diff --git a/test/geometry.test/Distance.test/comparison.test.js b/test/geometry.test/Distance.test/comparison.test.js deleted file mode 100644 index faaa23ca..00000000 --- a/test/geometry.test/Distance.test/comparison.test.js +++ /dev/null @@ -1,32 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Distance :isAlmostEqual :isGreaterThan :isLessThan :min :max', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const ba = tapspace.createSpace().setParent(view) - const bb = tapspace.createSpace().setParent(view) - bb.scaleBy(2) - - const da = new tapspace.geometry.Distance(ba, 10) - const db = new tapspace.geometry.Distance(bb, 10) - - t.true(da.isLessThan(db), 'non-scaled should be less') - t.true(db.isGreaterThan(da), 'non-scaled should be less') - - t.true(da.isAlmostEqual(da), 'is equal with self') - t.false(da.isAlmostEqual(db), 'not almost equal') - t.true(da.isAlmostEqual(db, 11), 'equal within tolerance') - - t.almostEqualDistance(da, da, 'test utility should work') - - t.equal(da.max(da), da, 'should equal self') - t.equal(da.min(da), da, 'should equal self') - t.equal(da.max(db), db, 'should be same max distance') - t.equal(da.min(db), da, 'should be same min distance') - - t.end() - }) -} diff --git a/test/geometry.test/Distance.test/getRaw.test.js b/test/geometry.test/Distance.test/getRaw.test.js deleted file mode 100644 index 74f1da3e..00000000 --- a/test/geometry.test/Distance.test/getRaw.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Distance:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - // Create two Points - const pa = space.at(10, 6) - const pb = space.at(14, 9) - // Get a Distance between them - const d = pa.getDistanceTo(pb) - - t.equal( - d.getRaw(), - 5, - 'should convert to dist3 number' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Distance.test/index.js b/test/geometry.test/Distance.test/index.js deleted file mode 100644 index 5adc6887..00000000 --- a/test/geometry.test/Distance.test/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const units = { - comparison: require('./comparison.test'), - getRaw: require('./getRaw.test'), - projection: require('./projection.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Distance.test/projection.test.js b/test/geometry.test/Distance.test/projection.test.js deleted file mode 100644 index 0711d71a..00000000 --- a/test/geometry.test/Distance.test/projection.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Distance :projectTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace().setParent(view) - - // Virtual camera - const camDist = 300 - const camera = view.atCenter().offset(0, 0, -camDist) - - // Move the space by the default cam distance for nice half scale - space.translateBy({ x: 0, y: 0, z: camDist }) - - const dist = new tapspace.geometry.Distance(space, 100) - const distProj = dist.projectTo(view, camera) - - t.equal(distProj.getNumber(), 50, 'shrinks to half due to perspective') - - t.end() - }) -} diff --git a/test/geometry.test/Distance.test/template.ejs b/test/geometry.test/Distance.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Distance.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/index.js b/test/geometry.test/index.js index bbc8ad9c..9550ad98 100644 --- a/test/geometry.test/index.js +++ b/test/geometry.test/index.js @@ -1,5 +1,4 @@ const units = { - Distance: require('./Distance.test'), Orientation: require('./Orientation.test'), Path: require('./Path.test'), Point: require('./Point.test'), diff --git a/test/headless/geometry/Distance/comparison.html b/test/headless/geometry/Distance/comparison.html index e69de29b..b2f003fa 100644 --- a/test/headless/geometry/Distance/comparison.html +++ b/test/headless/geometry/Distance/comparison.html @@ -0,0 +1,56 @@ + + + + + Distance comparison - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Distance/getRaw.html b/test/headless/geometry/Distance/getRaw.html index e69de29b..e4e235af 100644 --- a/test/headless/geometry/Distance/getRaw.html +++ b/test/headless/geometry/Distance/getRaw.html @@ -0,0 +1,51 @@ + + + + + Distance :getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Distance/index.mjs b/test/headless/geometry/Distance/index.mjs index e69de29b..1a8da355 100644 --- a/test/headless/geometry/Distance/index.mjs +++ b/test/headless/geometry/Distance/index.mjs @@ -0,0 +1,14 @@ +export default function (test) { + const namespace = 'Distance' + const methods = [ + 'comparison', + 'getRaw', + 'projection' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Distance/projection.html b/test/headless/geometry/Distance/projection.html index e69de29b..05770b52 100644 --- a/test/headless/geometry/Distance/projection.html +++ b/test/headless/geometry/Distance/projection.html @@ -0,0 +1,53 @@ + + + + + Distance projection - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 13fe7726..57288c95 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -3,6 +3,7 @@ import testBasis from './Basis/index.mjs' import testBox from './Box/index.mjs' import testCircle from './Circle/index.mjs' import testDirection from './Direction/index.mjs' +import testDistance from './Distance/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -16,5 +17,6 @@ export default function (test, browser) { testBox(testAllOk) testCircle(testAllOk) testDirection(testAllOk) + testDistance(testAllOk) testSphere(testAllOk) } From c916b19e1a30720113ede6c28dff51e245da821a Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 17:36:20 +0200 Subject: [PATCH 077/118] migrate Orientation test suite --- .../Orientation.test/getRaw.test.js | 26 --------- test/geometry.test/Orientation.test/index.js | 9 --- .../Orientation.test/template.ejs | 1 - test/geometry.test/index.js | 1 - .../headless/geometry/Orientation/getRaw.html | 58 +++++++++++++++++++ test/headless/geometry/Orientation/index.mjs | 12 ++++ test/headless/geometry/index.mjs | 2 + 7 files changed, 72 insertions(+), 37 deletions(-) delete mode 100644 test/geometry.test/Orientation.test/getRaw.test.js delete mode 100644 test/geometry.test/Orientation.test/index.js delete mode 100644 test/geometry.test/Orientation.test/template.ejs diff --git a/test/geometry.test/Orientation.test/getRaw.test.js b/test/geometry.test/Orientation.test/getRaw.test.js deleted file mode 100644 index 6e9b7ad1..00000000 --- a/test/geometry.test/Orientation.test/getRaw.test.js +++ /dev/null @@ -1,26 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Orientation:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - const item = tapspace.createItem('

Hello

') - item.setSize(200, 200) - space.addChild(item) - - item.rotateBy(Math.PI) - const orientation = item.getOrientation() - - t.almostEqualOrientation( - orientation.changeBasis(view).getRaw(), - { a: -1, b: 0 }, - 'should produce plain object' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Orientation.test/index.js b/test/geometry.test/Orientation.test/index.js deleted file mode 100644 index efef013c..00000000 --- a/test/geometry.test/Orientation.test/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const units = { - getRaw: require('./getRaw.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Orientation.test/template.ejs b/test/geometry.test/Orientation.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Orientation.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/index.js b/test/geometry.test/index.js index 9550ad98..2bfac7c9 100644 --- a/test/geometry.test/index.js +++ b/test/geometry.test/index.js @@ -1,5 +1,4 @@ const units = { - Orientation: require('./Orientation.test'), Path: require('./Path.test'), Point: require('./Point.test'), Ray: require('./Ray.test'), diff --git a/test/headless/geometry/Orientation/getRaw.html b/test/headless/geometry/Orientation/getRaw.html index e69de29b..e3d2c030 100644 --- a/test/headless/geometry/Orientation/getRaw.html +++ b/test/headless/geometry/Orientation/getRaw.html @@ -0,0 +1,58 @@ + + + + + Orientation :getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Orientation/index.mjs b/test/headless/geometry/Orientation/index.mjs index e69de29b..4dd877df 100644 --- a/test/headless/geometry/Orientation/index.mjs +++ b/test/headless/geometry/Orientation/index.mjs @@ -0,0 +1,12 @@ +export default function (test) { + const namespace = 'Orientation' + const methods = [ + 'getRaw' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 57288c95..95626735 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -4,6 +4,7 @@ import testBox from './Box/index.mjs' import testCircle from './Circle/index.mjs' import testDirection from './Direction/index.mjs' import testDistance from './Distance/index.mjs' +import testOrientation from './Orientation/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -18,5 +19,6 @@ export default function (test, browser) { testCircle(testAllOk) testDirection(testAllOk) testDistance(testAllOk) + testOrientation(testAllOk) testSphere(testAllOk) } From 3ebe2c24c058bc1e8c615925d49ceea0ce89110e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 21:27:51 +0200 Subject: [PATCH 078/118] migrate Path test suite --- test/geometry.test/Path.test/index.js | 27 ------------ test/geometry.test/Path.test/template.ejs | 1 - test/geometry.test/index.js | 1 - test/headless/geometry/Path/getRaw.html | 53 +++++++++++++++++++++++ test/headless/geometry/Path/index.mjs | 12 +++++ test/headless/geometry/index.mjs | 2 + 6 files changed, 67 insertions(+), 29 deletions(-) delete mode 100644 test/geometry.test/Path.test/index.js delete mode 100644 test/geometry.test/Path.test/template.ejs diff --git a/test/geometry.test/Path.test/index.js b/test/geometry.test/Path.test/index.js deleted file mode 100644 index 43bc486d..00000000 --- a/test/geometry.test/Path.test/index.js +++ /dev/null @@ -1,27 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Path:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace().setParent(view) - - // Create a Path - const path = [ - { x: 1, y: 2, z: 3 }, - { x: 2, y: 3, z: 4 }, - { x: 3, y: 4, z: 5 } - ] - const ps = new tapspace.geometry.Path(basis, path) - - t.deepEqual( - ps.getRaw(), - path, - 'should convert to path3' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Path.test/template.ejs b/test/geometry.test/Path.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Path.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/index.js b/test/geometry.test/index.js index 2bfac7c9..6b68bd69 100644 --- a/test/geometry.test/index.js +++ b/test/geometry.test/index.js @@ -1,5 +1,4 @@ const units = { - Path: require('./Path.test'), Point: require('./Point.test'), Ray: require('./Ray.test'), Scale: require('./Scale.test'), diff --git a/test/headless/geometry/Path/getRaw.html b/test/headless/geometry/Path/getRaw.html index e69de29b..1100b24b 100644 --- a/test/headless/geometry/Path/getRaw.html +++ b/test/headless/geometry/Path/getRaw.html @@ -0,0 +1,53 @@ + + + + + Path :getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Path/index.mjs b/test/headless/geometry/Path/index.mjs index e69de29b..55826a39 100644 --- a/test/headless/geometry/Path/index.mjs +++ b/test/headless/geometry/Path/index.mjs @@ -0,0 +1,12 @@ +export default function (test) { + const namespace = 'Path' + const methods = [ + 'getRaw' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 95626735..25a38abf 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -5,6 +5,7 @@ import testCircle from './Circle/index.mjs' import testDirection from './Direction/index.mjs' import testDistance from './Distance/index.mjs' import testOrientation from './Orientation/index.mjs' +import testPath from './Path/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -20,5 +21,6 @@ export default function (test, browser) { testDirection(testAllOk) testDistance(testAllOk) testOrientation(testAllOk) + testPath(testAllOk) testSphere(testAllOk) } From 869d8c272f6f0e889978a33dffb5f5e6eb2b3892 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 21:36:18 +0200 Subject: [PATCH 079/118] migrate Ray test suite --- test/geometry.test/Ray.test/creation.test.js | 33 ------------- test/geometry.test/Ray.test/index.js | 9 ---- test/geometry.test/Ray.test/template.ejs | 1 - test/geometry.test/index.js | 1 - test/headless/geometry/Ray/creation.html | 50 ++++++++++++++++++++ test/headless/geometry/Ray/index.mjs | 12 +++++ test/headless/geometry/index.mjs | 2 + 7 files changed, 64 insertions(+), 44 deletions(-) delete mode 100644 test/geometry.test/Ray.test/creation.test.js delete mode 100644 test/geometry.test/Ray.test/index.js delete mode 100644 test/geometry.test/Ray.test/template.ejs diff --git a/test/geometry.test/Ray.test/creation.test.js b/test/geometry.test/Ray.test/creation.test.js deleted file mode 100644 index c26c500f..00000000 --- a/test/geometry.test/Ray.test/creation.test.js +++ /dev/null @@ -1,33 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - const Ray = tapspace.geometry.Ray - - test('Ray .create', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Create a ray - const p = space.at(2, 3) - const v = space.createVector(1, 0, 0) - const ray = Ray.create(space, p, v) - - t.almostEqualPoint( - ray.at(0), - p, - 'should have origin at 0' - ) - - t.almostEqualPoint( - ray.at(1), - space.at(3, 3), - 'should have working span' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Ray.test/index.js b/test/geometry.test/Ray.test/index.js deleted file mode 100644 index 14f35dca..00000000 --- a/test/geometry.test/Ray.test/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const units = { - creation: require('./creation.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Ray.test/template.ejs b/test/geometry.test/Ray.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Ray.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/index.js b/test/geometry.test/index.js index 6b68bd69..978f6e26 100644 --- a/test/geometry.test/index.js +++ b/test/geometry.test/index.js @@ -1,6 +1,5 @@ const units = { Point: require('./Point.test'), - Ray: require('./Ray.test'), Scale: require('./Scale.test'), Size: require('./Size.test'), Transform: require('./Transform.test'), diff --git a/test/headless/geometry/Ray/creation.html b/test/headless/geometry/Ray/creation.html index e69de29b..10ef9cd0 100644 --- a/test/headless/geometry/Ray/creation.html +++ b/test/headless/geometry/Ray/creation.html @@ -0,0 +1,50 @@ + + + + + Ray creation - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Ray/index.mjs b/test/headless/geometry/Ray/index.mjs index e69de29b..d64ac131 100644 --- a/test/headless/geometry/Ray/index.mjs +++ b/test/headless/geometry/Ray/index.mjs @@ -0,0 +1,12 @@ +export default function (test) { + const namespace = 'Ray' + const methods = [ + 'creation' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 25a38abf..57f03844 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -6,6 +6,7 @@ import testDirection from './Direction/index.mjs' import testDistance from './Distance/index.mjs' import testOrientation from './Orientation/index.mjs' import testPath from './Path/index.mjs' +import testRay from './Ray/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -22,5 +23,6 @@ export default function (test, browser) { testDistance(testAllOk) testOrientation(testAllOk) testPath(testAllOk) + testRay(testAllOk) testSphere(testAllOk) } From eb87a89f372be20ad67fdf9067b514b989e7a5ad Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:09:45 +0200 Subject: [PATCH 080/118] migrate Point test suite --- test/headless/geometry/Point/addVector.html | 50 +++++++++++++ .../geometry/Point/getDistanceTo.html | 51 +++++++++++++ test/headless/geometry/Point/getRaw.html | 48 ++++++++++++ test/headless/geometry/Point/index.mjs | 16 ++++ test/headless/geometry/Point/transformBy.html | 75 +++++++++++++++++++ .../geometry/Point/transitRawOuter.html | 58 ++++++++++++++ test/headless/geometry/index.mjs | 2 + 7 files changed, 300 insertions(+) diff --git a/test/headless/geometry/Point/addVector.html b/test/headless/geometry/Point/addVector.html index e69de29b..f49051fa 100644 --- a/test/headless/geometry/Point/addVector.html +++ b/test/headless/geometry/Point/addVector.html @@ -0,0 +1,50 @@ + + + + + Point:addVector - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Point/getDistanceTo.html b/test/headless/geometry/Point/getDistanceTo.html index e69de29b..461a29f0 100644 --- a/test/headless/geometry/Point/getDistanceTo.html +++ b/test/headless/geometry/Point/getDistanceTo.html @@ -0,0 +1,51 @@ + + + + + Point:getDistanceTo - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Point/getRaw.html b/test/headless/geometry/Point/getRaw.html index e69de29b..b351cf6b 100644 --- a/test/headless/geometry/Point/getRaw.html +++ b/test/headless/geometry/Point/getRaw.html @@ -0,0 +1,48 @@ + + + + + Point:getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Point/index.mjs b/test/headless/geometry/Point/index.mjs index e69de29b..5b884960 100644 --- a/test/headless/geometry/Point/index.mjs +++ b/test/headless/geometry/Point/index.mjs @@ -0,0 +1,16 @@ +export default function (test) { + const namespace = 'Point' + const methods = [ + 'addVector', + 'getDistanceTo', + 'getRaw', + 'transformBy', + 'transitRawOuter' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Point/transformBy.html b/test/headless/geometry/Point/transformBy.html index e69de29b..3d28bc02 100644 --- a/test/headless/geometry/Point/transformBy.html +++ b/test/headless/geometry/Point/transformBy.html @@ -0,0 +1,75 @@ + + + + + Point:transformBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Point/transitRawOuter.html b/test/headless/geometry/Point/transitRawOuter.html index e69de29b..e8c6ebc4 100644 --- a/test/headless/geometry/Point/transitRawOuter.html +++ b/test/headless/geometry/Point/transitRawOuter.html @@ -0,0 +1,58 @@ + + + + + Point:transitRawOuter - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 57f03844..77dabbbd 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -6,6 +6,7 @@ import testDirection from './Direction/index.mjs' import testDistance from './Distance/index.mjs' import testOrientation from './Orientation/index.mjs' import testPath from './Path/index.mjs' +import testPoint from './Point/index.mjs' import testRay from './Ray/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -24,5 +25,6 @@ export default function (test, browser) { testOrientation(testAllOk) testPath(testAllOk) testRay(testAllOk) + testPoint(testAllOk) testSphere(testAllOk) } From 5e4729c880dd6ae249148dbb4a4e57f58fb4e8fe Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:10:11 +0200 Subject: [PATCH 081/118] migrate Scale test suite --- test/headless/geometry/Scale/changeBasis.html | 60 +++++++++++++++++++ test/headless/geometry/Scale/getRaw.html | 0 test/headless/geometry/Scale/index.mjs | 12 ++++ test/headless/geometry/index.mjs | 2 + 4 files changed, 74 insertions(+) delete mode 100644 test/headless/geometry/Scale/getRaw.html diff --git a/test/headless/geometry/Scale/changeBasis.html b/test/headless/geometry/Scale/changeBasis.html index e69de29b..3ac52b5f 100644 --- a/test/headless/geometry/Scale/changeBasis.html +++ b/test/headless/geometry/Scale/changeBasis.html @@ -0,0 +1,60 @@ + + + + + Scale:changeBasis - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Scale/getRaw.html b/test/headless/geometry/Scale/getRaw.html deleted file mode 100644 index e69de29b..00000000 diff --git a/test/headless/geometry/Scale/index.mjs b/test/headless/geometry/Scale/index.mjs index e69de29b..ce7f3393 100644 --- a/test/headless/geometry/Scale/index.mjs +++ b/test/headless/geometry/Scale/index.mjs @@ -0,0 +1,12 @@ +export default function (test) { + const namespace = 'Scale' + const methods = [ + 'changeBasis' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 77dabbbd..28ffe650 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -8,6 +8,7 @@ import testOrientation from './Orientation/index.mjs' import testPath from './Path/index.mjs' import testPoint from './Point/index.mjs' import testRay from './Ray/index.mjs' +import testScale from './Scale/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -26,5 +27,6 @@ export default function (test, browser) { testPath(testAllOk) testRay(testAllOk) testPoint(testAllOk) + testScale(testAllOk) testSphere(testAllOk) } From 0020ee3d0c3c68386a1c94fe3360293fff1215c1 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:10:31 +0200 Subject: [PATCH 082/118] migrate Size test suite --- test/headless/geometry/Size/getRaw.html | 52 ++++++++++++++++++++++++ test/headless/geometry/Size/index.mjs | 13 ++++++ test/headless/geometry/Size/scaleBy.html | 52 ++++++++++++++++++++++++ test/headless/geometry/index.mjs | 2 + 4 files changed, 119 insertions(+) diff --git a/test/headless/geometry/Size/getRaw.html b/test/headless/geometry/Size/getRaw.html index e69de29b..a88a14ad 100644 --- a/test/headless/geometry/Size/getRaw.html +++ b/test/headless/geometry/Size/getRaw.html @@ -0,0 +1,52 @@ + + + + + Size:getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Size/index.mjs b/test/headless/geometry/Size/index.mjs index e69de29b..7f51a896 100644 --- a/test/headless/geometry/Size/index.mjs +++ b/test/headless/geometry/Size/index.mjs @@ -0,0 +1,13 @@ +export default function (test) { + const namespace = 'Size' + const methods = [ + 'getRaw', + 'scaleBy' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/Size/scaleBy.html b/test/headless/geometry/Size/scaleBy.html index e69de29b..99179c8f 100644 --- a/test/headless/geometry/Size/scaleBy.html +++ b/test/headless/geometry/Size/scaleBy.html @@ -0,0 +1,52 @@ + + + + + Size:scaleBy - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 28ffe650..d9667db3 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -9,6 +9,7 @@ import testPath from './Path/index.mjs' import testPoint from './Point/index.mjs' import testRay from './Ray/index.mjs' import testScale from './Scale/index.mjs' +import testSize from './Size/index.mjs' import testSphere from './Sphere/index.mjs' import { makeTestAllOk } from '../utils.mjs' @@ -28,5 +29,6 @@ export default function (test, browser) { testRay(testAllOk) testPoint(testAllOk) testScale(testAllOk) + testSize(testAllOk) testSphere(testAllOk) } From d926998b9b25fe9d42147489371bb22de022583e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:10:56 +0200 Subject: [PATCH 083/118] migrate Transform test suite --- test/headless/geometry/Transform/getRaw.html | 49 ++++++++++++++++++++ test/headless/geometry/Transform/index.mjs | 12 +++++ test/headless/geometry/index.mjs | 2 + 3 files changed, 63 insertions(+) diff --git a/test/headless/geometry/Transform/getRaw.html b/test/headless/geometry/Transform/getRaw.html index e69de29b..27a98dd0 100644 --- a/test/headless/geometry/Transform/getRaw.html +++ b/test/headless/geometry/Transform/getRaw.html @@ -0,0 +1,49 @@ + + + + + Transform:getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Transform/index.mjs b/test/headless/geometry/Transform/index.mjs index e69de29b..71f345b7 100644 --- a/test/headless/geometry/Transform/index.mjs +++ b/test/headless/geometry/Transform/index.mjs @@ -0,0 +1,12 @@ +export default function (test) { + const namespace = 'Transform' + const methods = [ + 'getRaw' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index d9667db3..4e01c048 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -11,6 +11,7 @@ import testRay from './Ray/index.mjs' import testScale from './Scale/index.mjs' import testSize from './Size/index.mjs' import testSphere from './Sphere/index.mjs' +import testTransform from './Transform/index.mjs' import { makeTestAllOk } from '../utils.mjs' export default function (test, browser) { @@ -31,4 +32,5 @@ export default function (test, browser) { testScale(testAllOk) testSize(testAllOk) testSphere(testAllOk) + testTransform(testAllOk) } From 9621bffb4f4fcb804ac6ded849da8cc2d9d240ad Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:11:30 +0200 Subject: [PATCH 084/118] migrate Vector test suite --- test/headless/geometry/Vector/fromPolar.html | 47 +++++++++++++++++ .../geometry/Vector/fromSpherical.html | 47 +++++++++++++++++ test/headless/geometry/Vector/getRaw.html | 51 +++++++++++++++++++ test/headless/geometry/Vector/index.mjs | 14 +++++ test/headless/geometry/index.mjs | 3 ++ 5 files changed, 162 insertions(+) diff --git a/test/headless/geometry/Vector/fromPolar.html b/test/headless/geometry/Vector/fromPolar.html index e69de29b..c77ff882 100644 --- a/test/headless/geometry/Vector/fromPolar.html +++ b/test/headless/geometry/Vector/fromPolar.html @@ -0,0 +1,47 @@ + + + + + Vector:fromPolar - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Vector/fromSpherical.html b/test/headless/geometry/Vector/fromSpherical.html index e69de29b..de17e648 100644 --- a/test/headless/geometry/Vector/fromSpherical.html +++ b/test/headless/geometry/Vector/fromSpherical.html @@ -0,0 +1,47 @@ + + + + + Vector:fromSpherical - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Vector/getRaw.html b/test/headless/geometry/Vector/getRaw.html index e69de29b..45bfa055 100644 --- a/test/headless/geometry/Vector/getRaw.html +++ b/test/headless/geometry/Vector/getRaw.html @@ -0,0 +1,51 @@ + + + + + Vector:getRaw - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/headless/geometry/Vector/index.mjs b/test/headless/geometry/Vector/index.mjs index e69de29b..5512c2a5 100644 --- a/test/headless/geometry/Vector/index.mjs +++ b/test/headless/geometry/Vector/index.mjs @@ -0,0 +1,14 @@ +export default function (test) { + const namespace = 'Vector' + const methods = [ + 'fromPolar', + 'fromSpherical', + 'getRaw' + ] + + let i, m + for (i = 0; i < methods.length; i += 1) { + m = methods[i] + test(namespace + ':' + m, import.meta.dirname, m + '.html') + } +} diff --git a/test/headless/geometry/index.mjs b/test/headless/geometry/index.mjs index 4e01c048..502d8f34 100644 --- a/test/headless/geometry/index.mjs +++ b/test/headless/geometry/index.mjs @@ -12,6 +12,8 @@ import testScale from './Scale/index.mjs' import testSize from './Size/index.mjs' import testSphere from './Sphere/index.mjs' import testTransform from './Transform/index.mjs' +import testVector from './Vector/index.mjs' + import { makeTestAllOk } from '../utils.mjs' export default function (test, browser) { @@ -33,4 +35,5 @@ export default function (test, browser) { testSize(testAllOk) testSphere(testAllOk) testTransform(testAllOk) + testVector(testAllOk) } From b22a61765bd70b8a3b88b56093d850724d759a4c Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:13:54 +0200 Subject: [PATCH 085/118] remove migrated original geometry test suites --- .../Point.test/addVector.test.js | 24 --------- .../Point.test/getDistanceTo.test.js | 25 ---------- test/geometry.test/Point.test/getRaw.test.js | 22 --------- test/geometry.test/Point.test/index.js | 13 ----- test/geometry.test/Point.test/template.ejs | 1 - .../Point.test/transformBy.test.js | 49 ------------------- .../Point.test/transitRawOuter.test.js | 32 ------------ test/geometry.test/Scale.test/index.js | 30 ------------ test/geometry.test/Scale.test/template.ejs | 1 - test/geometry.test/Size.test/getRaw.test.js | 26 ---------- test/geometry.test/Size.test/index.js | 10 ---- test/geometry.test/Size.test/scaleBy.test.js | 26 ---------- test/geometry.test/Size.test/template.ejs | 1 - test/geometry.test/Transform.test/index.js | 23 --------- .../geometry.test/Transform.test/template.ejs | 1 - .../Vector.test/fromPolar.test.js | 24 --------- .../Vector.test/fromSpherical.test.js | 24 --------- test/geometry.test/Vector.test/getRaw.test.js | 25 ---------- test/geometry.test/Vector.test/index.js | 11 ----- test/geometry.test/Vector.test/template.ejs | 1 - test/geometry.test/index.js | 13 ----- test/index.test.js | 2 - 22 files changed, 384 deletions(-) delete mode 100644 test/geometry.test/Point.test/addVector.test.js delete mode 100644 test/geometry.test/Point.test/getDistanceTo.test.js delete mode 100644 test/geometry.test/Point.test/getRaw.test.js delete mode 100644 test/geometry.test/Point.test/index.js delete mode 100644 test/geometry.test/Point.test/template.ejs delete mode 100644 test/geometry.test/Point.test/transformBy.test.js delete mode 100644 test/geometry.test/Point.test/transitRawOuter.test.js delete mode 100644 test/geometry.test/Scale.test/index.js delete mode 100644 test/geometry.test/Scale.test/template.ejs delete mode 100644 test/geometry.test/Size.test/getRaw.test.js delete mode 100644 test/geometry.test/Size.test/index.js delete mode 100644 test/geometry.test/Size.test/scaleBy.test.js delete mode 100644 test/geometry.test/Size.test/template.ejs delete mode 100644 test/geometry.test/Transform.test/index.js delete mode 100644 test/geometry.test/Transform.test/template.ejs delete mode 100644 test/geometry.test/Vector.test/fromPolar.test.js delete mode 100644 test/geometry.test/Vector.test/fromSpherical.test.js delete mode 100644 test/geometry.test/Vector.test/getRaw.test.js delete mode 100644 test/geometry.test/Vector.test/index.js delete mode 100644 test/geometry.test/Vector.test/template.ejs delete mode 100644 test/geometry.test/index.js diff --git a/test/geometry.test/Point.test/addVector.test.js b/test/geometry.test/Point.test/addVector.test.js deleted file mode 100644 index 4bc21a32..00000000 --- a/test/geometry.test/Point.test/addVector.test.js +++ /dev/null @@ -1,24 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Point:addVector', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create a Point - const p = basis.at(10, 6) - // Create a Vector - const v = new tapspace.geometry.Vector(basis, { x: 2, y: 3, z: 4 }) - - t.deepEqual( - p.addVector(v).getRaw(), - { x: 12, y: 9, z: 4 }, - 'should increase properties' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Point.test/getDistanceTo.test.js b/test/geometry.test/Point.test/getDistanceTo.test.js deleted file mode 100644 index 7db53a77..00000000 --- a/test/geometry.test/Point.test/getDistanceTo.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Point:getDistanceTo', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create two points - const pa = basis.at(10, 6) - const pb = basis.at(20, 6) - - // Distance between them - const dist = pa.getDistanceTo(pb) - t.equal(dist.dist, 10) - - // Vector between them - const vec = pa.getVectorTo(pb) - t.deepEqual(vec.vec, { x: 10, y: 0, z: 0 }) - - t.end() - }) -} diff --git a/test/geometry.test/Point.test/getRaw.test.js b/test/geometry.test/Point.test/getRaw.test.js deleted file mode 100644 index fe0bce70..00000000 --- a/test/geometry.test/Point.test/getRaw.test.js +++ /dev/null @@ -1,22 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Point:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create a Point - const p = basis.at(10, 6) - - t.deepEqual( - p.getRaw(), - { x: 10, y: 6, z: 0 }, - 'should convert to point3' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Point.test/index.js b/test/geometry.test/Point.test/index.js deleted file mode 100644 index 175dac1d..00000000 --- a/test/geometry.test/Point.test/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const units = { - addVector: require('./addVector.test'), - getDistanceTo: require('./getDistanceTo.test'), - getRaw: require('./getRaw.test'), - transformBy: require('./transformBy.test'), - transitRawOuter: require('./transitRawOuter.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Point.test/template.ejs b/test/geometry.test/Point.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Point.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Point.test/transformBy.test.js b/test/geometry.test/Point.test/transformBy.test.js deleted file mode 100644 index 17c003b7..00000000 --- a/test/geometry.test/Point.test/transformBy.test.js +++ /dev/null @@ -1,49 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Point:transformBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space) - - // Create a Point - const p = space.at(10, 6) - - // Create a Transformation - const traw = { a: 2, b: 0, x: 0, y: 0, z: 0 } - const tr = new tapspace.geometry.Transform(space, traw) - - t.deepEqual( - p.transformBy(tr, p).getRaw(), - p.getRaw(), - 'should not scale same origin' - ) - - t.deepEqual( - p.transformBy(tr, space.at(10, 10)).getRaw(), - space.at(10, 2).getRaw(), - 'should scale about the point' - ) - - // Create a transformation with translation - const traw2 = { a: 2, b: 0, x: 10, y: 10, z: 10 } - const tr2 = new tapspace.geometry.Transform(space, traw2) - - t.deepEqual( - p.transformBy(tr2, p).getRaw(), - space.at(20, 16, 10).getRaw(), - 'should translate regardless the same origin' - ) - - t.deepEqual( - p.transformBy(tr2, space.at(10, 10)).getRaw(), - space.at(20, 12, 10).getRaw(), - 'should scale and translate' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Point.test/transitRawOuter.test.js b/test/geometry.test/Point.test/transitRawOuter.test.js deleted file mode 100644 index 6676cbb8..00000000 --- a/test/geometry.test/Point.test/transitRawOuter.test.js +++ /dev/null @@ -1,32 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Point:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const space = tapspace.createSpace() - view.addChild(space, view.at(10, 20)) - const item = tapspace.createNode(10, 'black') - space.addChild(item, space.at(30, 40)) - // item (0,0) at space (20, 30) - - // Create a Point - const p = item.at(10, 6) - - t.deepEqual( - p.transitRaw(space), - { x: 30, y: 36, z: 0 }, - 'ensure transitRaw behavior' - ) - - t.deepEqual( - p.transitRawOuter(space), - { x: 40, y: 56, z: 0 }, - 'should transit to hyperspace' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Scale.test/index.js b/test/geometry.test/Scale.test/index.js deleted file mode 100644 index 1fa97a15..00000000 --- a/test/geometry.test/Scale.test/index.js +++ /dev/null @@ -1,30 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Scale :changeBasis :getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - // Create two bases - const ba = tapspace.createSpace().setParent(view) - const bb = tapspace.createSpace().setParent(view) - // Scale another - bb.scaleBy(4) - const scale = bb.getScale() - - t.equal( - scale.getRaw(), - 1, - 'should convert scale to number' - ) - - t.equal( - scale.changeBasis(ba).getRaw(), - 4, - 'should convert scale to number' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Scale.test/template.ejs b/test/geometry.test/Scale.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Scale.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Size.test/getRaw.test.js b/test/geometry.test/Size.test/getRaw.test.js deleted file mode 100644 index 509192de..00000000 --- a/test/geometry.test/Size.test/getRaw.test.js +++ /dev/null @@ -1,26 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Size:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create an element - const hel = tapspace.createItem('hello') - hel.setSize({ w: 200, h: 200 }) - basis.addChild(hel) - // Get its size - const size = hel.getSize() - - t.deepEqual( - size.getRaw(), - { w: 200, h: 200, d: 0 }, - 'should convert size to object' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Size.test/index.js b/test/geometry.test/Size.test/index.js deleted file mode 100644 index 79adf43b..00000000 --- a/test/geometry.test/Size.test/index.js +++ /dev/null @@ -1,10 +0,0 @@ -const units = { - getRaw: require('./getRaw.test'), - scaleBy: require('./scaleBy.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Size.test/scaleBy.test.js b/test/geometry.test/Size.test/scaleBy.test.js deleted file mode 100644 index e652a80f..00000000 --- a/test/geometry.test/Size.test/scaleBy.test.js +++ /dev/null @@ -1,26 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Size:scaleBy', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create an element - const hel = tapspace.createItem('hello') - hel.setSize(200, 200) - basis.addChild(hel) - // Get its size - const size = hel.getSize() - - t.deepEqual( - size.scaleBy(2).getRaw(), - { w: 400, h: 400, d: 0 }, - 'should double the width and height' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Size.test/template.ejs b/test/geometry.test/Size.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Size.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Transform.test/index.js b/test/geometry.test/Transform.test/index.js deleted file mode 100644 index 847970eb..00000000 --- a/test/geometry.test/Transform.test/index.js +++ /dev/null @@ -1,23 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Transform:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create a Transformation - const helm = { a: 1, b: 2, x: 3, y: 4, z: 5 } - const tr = new tapspace.geometry.Transform(basis, helm) - - t.deepEqual( - tr.getRaw(), - helm, - 'should convert to helm3' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Transform.test/template.ejs b/test/geometry.test/Transform.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Transform.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/Vector.test/fromPolar.test.js b/test/geometry.test/Vector.test/fromPolar.test.js deleted file mode 100644 index ea0b1cf8..00000000 --- a/test/geometry.test/Vector.test/fromPolar.test.js +++ /dev/null @@ -1,24 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Vector.fromPolar', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create a vector - const radius = 2 - const d90 = Math.PI / 2 - const vec = tapspace.geometry.Vector.fromPolar(basis, radius, d90, 3) - - t.almostEqualVector( - vec.getRaw(), - { x: 0, y: 2, z: 3 }, - 'should point back down' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Vector.test/fromSpherical.test.js b/test/geometry.test/Vector.test/fromSpherical.test.js deleted file mode 100644 index 562d4617..00000000 --- a/test/geometry.test/Vector.test/fromSpherical.test.js +++ /dev/null @@ -1,24 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Vector.fromSpherical', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create a vector - const magn = 2 - const d90 = Math.PI / 2 - const vec = tapspace.geometry.Vector.fromSpherical(basis, magn, d90, d90) - - t.almostEqualVector( - vec.getRaw(), - { x: 0, y: 2, z: 0 }, - 'should point down' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Vector.test/getRaw.test.js b/test/geometry.test/Vector.test/getRaw.test.js deleted file mode 100644 index 96300c5a..00000000 --- a/test/geometry.test/Vector.test/getRaw.test.js +++ /dev/null @@ -1,25 +0,0 @@ -const template = require('./template.ejs') - -module.exports = function (test, container, tapspace) { - // - test('Vector:getRaw', (t) => { - // Setup - container.innerHTML = template() - const view = tapspace.createView('#testspace') - const basis = tapspace.createSpace() - view.addChild(basis) - // Create two Points - const pa = basis.at(10, 6) - const pb = basis.at(20, 16) - // Get a Vector between them - const v = pa.getVectorTo(pb) - - t.deepEqual( - v.getRaw(), - { x: 10, y: 10, z: 0 }, - 'should convert to vec3' - ) - - t.end() - }) -} diff --git a/test/geometry.test/Vector.test/index.js b/test/geometry.test/Vector.test/index.js deleted file mode 100644 index 1ee93637..00000000 --- a/test/geometry.test/Vector.test/index.js +++ /dev/null @@ -1,11 +0,0 @@ -const units = { - fromPolar: require('./fromPolar.test'), - fromSpherical: require('./fromSpherical.test'), - getRaw: require('./getRaw.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/geometry.test/Vector.test/template.ejs b/test/geometry.test/Vector.test/template.ejs deleted file mode 100644 index 5c316ef1..00000000 --- a/test/geometry.test/Vector.test/template.ejs +++ /dev/null @@ -1 +0,0 @@ -
diff --git a/test/geometry.test/index.js b/test/geometry.test/index.js deleted file mode 100644 index 978f6e26..00000000 --- a/test/geometry.test/index.js +++ /dev/null @@ -1,13 +0,0 @@ -const units = { - Point: require('./Point.test'), - Scale: require('./Scale.test'), - Size: require('./Size.test'), - Transform: require('./Transform.test'), - Vector: require('./Vector.test') -} - -module.exports = (test, container, tapspace) => { - Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) - }) -} diff --git a/test/index.test.js b/test/index.test.js index a27594cb..b862acb9 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -2,8 +2,6 @@ const test = require('tape') const tapspace = window.tapspace const units = { - // Geometry - geometry: require('./geometry.test') } // Custom assertations From 87370b8379058829d4ec965f7cb2af83c4687545 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:20:14 +0200 Subject: [PATCH 086/118] remove manual browser test build framework --- .gitignore | 2 - package.json | 4 -- test/browser.html | 25 ---------- test/dist/.gitkeep | 0 test/index.test.js | 27 ----------- test/utils/almostEqual.js | 15 ------ test/utils/almostEqualBasis.js | 26 ----------- test/utils/almostEqualBox.js | 26 ----------- test/utils/almostEqualDirection.js | 26 ----------- test/utils/almostEqualDistance.js | 26 ----------- test/utils/almostEqualOrientation.js | 26 ----------- test/utils/almostEqualPoint.js | 26 ----------- test/utils/almostEqualSphere.js | 26 ----------- test/utils/almostEqualVector.js | 26 ----------- test/webpack.browser.config.js | 68 ---------------------------- 15 files changed, 349 deletions(-) delete mode 100644 test/browser.html delete mode 100644 test/dist/.gitkeep delete mode 100644 test/index.test.js delete mode 100644 test/utils/almostEqual.js delete mode 100644 test/utils/almostEqualBasis.js delete mode 100644 test/utils/almostEqualBox.js delete mode 100644 test/utils/almostEqualDirection.js delete mode 100644 test/utils/almostEqualDistance.js delete mode 100644 test/utils/almostEqualOrientation.js delete mode 100644 test/utils/almostEqualPoint.js delete mode 100644 test/utils/almostEqualSphere.js delete mode 100644 test/utils/almostEqualVector.js delete mode 100644 test/webpack.browser.config.js diff --git a/.gitignore b/.gitignore index 870f9a60..5396e3bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,6 @@ # Bundle builds /dist/* !/dist/.gitkeep -/test/dist/* -!/test/dist/.gitkeep # Logs logs diff --git a/package.json b/package.json index c61dade1..19bb2090 100644 --- a/package.json +++ b/package.json @@ -71,10 +71,6 @@ "lint:lib": "standard 'lib/**/*.js'", "test": "npm run lint", "test:headless": "npm run lint && npm run build && node test/headless/run.mjs", - "test:browser": "npm run test:browser:build && npm run test:browser:open", - "test:browser:open": "open -a \"Google Chrome\" test/browser.html", - "test:browser:build": "webpack --config test/webpack.browser.config.js", - "test:browser:watch": "webpack --watch --config test/webpack.browser.config.js", "release": "npm run lint && npm run gv && npm run build:production && npm run build:docs && npm publish --tag alpha", "gv": "genversion lib/version.js" } diff --git a/test/browser.html b/test/browser.html deleted file mode 100644 index b6f8d18e..00000000 --- a/test/browser.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - Tapspace Test - - - - -
-
- - - - diff --git a/test/dist/.gitkeep b/test/dist/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/test/index.test.js b/test/index.test.js deleted file mode 100644 index b862acb9..00000000 --- a/test/index.test.js +++ /dev/null @@ -1,27 +0,0 @@ -const test = require('tape') -const tapspace = window.tapspace - -const units = { -} - -// Custom assertations -const proto = test.Test.prototype -proto.almostEqual = require('./utils/almostEqual') -proto.almostEqualBasis = require('./utils/almostEqualBasis') -proto.almostEqualBox = require('./utils/almostEqualBox') -proto.almostEqualDirection = require('./utils/almostEqualDirection') -proto.almostEqualDistance = require('./utils/almostEqualDistance') -proto.almostEqualOrientation = require('./utils/almostEqualOrientation') -proto.almostEqualPoint = require('./utils/almostEqualPoint') -proto.almostEqualSphere = require('./utils/almostEqualSphere') -proto.almostEqualVector = require('./utils/almostEqualVector') - -// Reusable container element. Each test is allowed to clear innerHTML. -const container = document.querySelector('#container') - -Object.keys(units).forEach((unitName) => { - units[unitName](test, container, tapspace) -}) - -// Mark tests finished. Puppeteer runner reads this. -window.done = true diff --git a/test/utils/almostEqual.js b/test/utils/almostEqual.js deleted file mode 100644 index 4d4e93d7..00000000 --- a/test/utils/almostEqual.js +++ /dev/null @@ -1,15 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.dist3.almostEqual - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - const isEqual = almostEqual(actual, expected) - - this._assert(isEqual, { - message: message || 'numbers should be almost equal', - operator: 'almostEqual', - actual, - expected - }) -} diff --git a/test/utils/almostEqualBasis.js b/test/utils/almostEqualBasis.js deleted file mode 100644 index e7d20b43..00000000 --- a/test/utils/almostEqualBasis.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.plane3.almostEqual -const validate = fine.plane3.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.tran) && validate(actual.tran) - isEqual = isEqual && almostEqual(actual.tran, expected.tran) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'basis should have correct elements', - operator: 'almostEqualBasis', - actual, - expected - }) -} diff --git a/test/utils/almostEqualBox.js b/test/utils/almostEqualBox.js deleted file mode 100644 index a63e7aa3..00000000 --- a/test/utils/almostEqualBox.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.box3.almostEqual -const validate = fine.box3.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.box) && validate(actual.box) - isEqual = isEqual && almostEqual(actual.box, expected.box) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'box should have correct elements', - operator: 'almostEqualBox', - actual, - expected - }) -} diff --git a/test/utils/almostEqualDirection.js b/test/utils/almostEqualDirection.js deleted file mode 100644 index dbe15f83..00000000 --- a/test/utils/almostEqualDirection.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.dir3.almostEqual -const validate = fine.dir3.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.dir) && validate(actual.dir) - isEqual = isEqual && almostEqual(actual.dir, expected.dir) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'direction should almost equal', - operator: 'almostEqualDirection', - actual, - expected - }) -} diff --git a/test/utils/almostEqualDistance.js b/test/utils/almostEqualDistance.js deleted file mode 100644 index dd11915e..00000000 --- a/test/utils/almostEqualDistance.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.dist3.almostEqual -const validate = fine.dist3.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.dist) && validate(actual.dist) - isEqual = isEqual && almostEqual(actual.dist, expected.dist) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'distance should almost equal', - operator: 'almostEqualDistance', - actual, - expected - }) -} diff --git a/test/utils/almostEqualOrientation.js b/test/utils/almostEqualOrientation.js deleted file mode 100644 index e1e052d1..00000000 --- a/test/utils/almostEqualOrientation.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.orient2.almostEqual -const validate = fine.orient2.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.orient) && validate(actual.orient) - isEqual = isEqual && almostEqual(actual.orient, expected.orient) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'orientation should have correct elements', - operator: 'almostEqualOrientation', - actual, - expected - }) -} diff --git a/test/utils/almostEqualPoint.js b/test/utils/almostEqualPoint.js deleted file mode 100644 index a49da91f..00000000 --- a/test/utils/almostEqualPoint.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.point3.almostEqual -const validate = fine.point3.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.point) && validate(actual.point) - isEqual = isEqual && almostEqual(actual.point, expected.point) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'point should have correct elements', - operator: 'almostEqualPoint', - actual, - expected - }) -} diff --git a/test/utils/almostEqualSphere.js b/test/utils/almostEqualSphere.js deleted file mode 100644 index a687c27e..00000000 --- a/test/utils/almostEqualSphere.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.sphere3.almostEqual -const validate = fine.sphere3.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.sphere) && validate(actual.sphere) - isEqual = isEqual && almostEqual(actual.sphere, expected.sphere) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'sphere should have correct elements', - operator: 'almostEqualSphere', - actual, - expected - }) -} diff --git a/test/utils/almostEqualVector.js b/test/utils/almostEqualVector.js deleted file mode 100644 index 20c35e08..00000000 --- a/test/utils/almostEqualVector.js +++ /dev/null @@ -1,26 +0,0 @@ -const fine = require('affineplane') -const almostEqual = fine.vec3.almostEqual -const validate = fine.vec3.validate - -module.exports = function (actual, expected, message) { - // Custom tape.js assertion. - - let isEqual = false - if (expected.basis) { - // Based - isEqual = actual.basis === expected.basis - isEqual = isEqual && validate(expected.vec) && validate(actual.vec) - isEqual = isEqual && almostEqual(actual.vec, expected.vec) - } else { - // Raw - isEqual = validate(expected) && validate(actual) - isEqual = isEqual && almostEqual(actual, expected) - } - - this._assert(isEqual, { - message: message || 'vector should have correct elements', - operator: 'almostEqualVector', - actual, - expected - }) -} diff --git a/test/webpack.browser.config.js b/test/webpack.browser.config.js deleted file mode 100644 index b932c765..00000000 --- a/test/webpack.browser.config.js +++ /dev/null @@ -1,68 +0,0 @@ -const webpack = require('webpack') -const path = require('path') -const LiveReloadPlugin = require('webpack-livereload-plugin') - -module.exports = { - entry: { - index: './index.test.js' - }, - context: __dirname, - - output: { - filename: '[name].test.js', - path: path.join(__dirname, 'dist') - }, - - mode: 'development', - target: 'web', - - resolve: { - modules: ['node_modules'], - extensions: ['*', '.js'], - fallback: { - fs: false, // for tape - buffer: false, // for tape - path: require.resolve('path-browserify'), // for tape - stream: require.resolve('stream-browserify'), // for tape - util: false // for semver v7.5 - } - }, - - module: { - rules: [ - { - // Due to problems in serving static files with tape-run, - // we import images as data URLs. Thus asset/inline. - test: /\.(png|jpg|gif)$/, - type: 'asset/inline' - }, - { - test: /\.css$/, - use: [ - { loader: 'style-loader' }, - { loader: 'css-loader' } - ] - }, - { - test: /\.ejs$/, - loader: 'ejs-loader', - options: { - esModule: false // enable CommonJS modules. - } - } - ] - }, - - plugins: [ - // Provide process module for tape to work. - new webpack.ProvidePlugin({ - process: 'process/browser' - }), - // Rerun the test after each build in watch mode. - new LiveReloadPlugin() - ], - - devtool: 'eval-source-map', - - stats: 'minimal' -} From 455bd32c070814dfb2e200d1202ca4a90e84cfb8 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:23:20 +0200 Subject: [PATCH 087/118] promote headless test framework the top-level test --- test/{headless => }/components/Arc/getLength.html | 0 test/{headless => }/components/Arc/index.mjs | 0 test/{headless => }/components/Component/findCommonAncestor.html | 0 test/{headless => }/components/Component/geometryCreation.html | 0 test/{headless => }/components/Component/index.mjs | 0 test/{headless => }/components/Component/prependChild.html | 0 test/{headless => }/components/Component/removeChild.html | 0 test/{headless => }/components/Component/replaceChild.html | 0 test/{headless => }/components/Component/replaceParent.html | 0 test/{headless => }/components/Component/setId.html | 0 test/{headless => }/components/Component/setParent.html | 0 test/{headless => }/components/FrameComponent/index.mjs | 0 test/{headless => }/components/FrameComponent/resizeTo.html | 0 .../{headless => }/components/FrameComponent/transformToFill.html | 0 test/{headless => }/components/FrameComponent/transformToFit.html | 0 test/{headless => }/components/Item/at.html | 0 test/{headless => }/components/Item/boundaries.html | 0 test/{headless => }/components/Item/createVector.html | 0 test/{headless => }/components/Item/getDistanceTo.html | 0 test/{headless => }/components/Item/getVectorTo.html | 0 test/{headless => }/components/Item/index.mjs | 0 test/{headless => }/components/Item/matchBasis.html | 0 test/{headless => }/components/Item/rotateBy.html | 0 test/{headless => }/components/Item/setBasis.html | 0 test/{headless => }/components/Item/setOrientation.html | 0 test/{headless => }/components/Item/setScale.html | 0 test/{headless => }/components/Item/transformBy.html | 0 test/{headless => }/components/Space/at.html | 0 test/{headless => }/components/Space/getBoundingBox.html | 0 test/{headless => }/components/Space/index.mjs | 0 test/{headless => }/components/Viewport/getAspectRatio.html | 0 test/{headless => }/components/Viewport/index.mjs | 0 test/{headless => }/components/Viewport/measureGroup.html | 0 test/{headless => }/components/index.mjs | 0 test/{headless => }/geometry/Area/index.mjs | 0 test/{headless => }/geometry/Area/projectTo.html | 0 test/{headless => }/geometry/Area/transitRaw.html | 0 test/{headless => }/geometry/Basis/at.html | 0 test/{headless => }/geometry/Basis/changeBasis.html | 0 test/{headless => }/geometry/Basis/createDirection.html | 0 test/{headless => }/geometry/Basis/createVector.html | 0 test/{headless => }/geometry/Basis/getMatchedOuter.html | 0 test/{headless => }/geometry/Basis/getTransformTo.html | 0 test/{headless => }/geometry/Basis/index.mjs | 0 test/{headless => }/geometry/Basis/offsets.html | 0 test/{headless => }/geometry/Basis/rotateBy.html | 0 test/{headless => }/geometry/Basis/rotateByDegrees.html | 0 test/{headless => }/geometry/Basis/scaleBy.html | 0 test/{headless => }/geometry/Basis/transformBy.html | 0 test/{headless => }/geometry/Basis/transitRaw.html | 0 test/{headless => }/geometry/Basis/transitRawOuter.html | 0 test/{headless => }/geometry/Basis/translateBy.html | 0 test/{headless => }/geometry/Box/almostEqual.html | 0 test/{headless => }/geometry/Box/at.html | 0 test/{headless => }/geometry/Box/atNorm.html | 0 test/{headless => }/geometry/Box/changeBasis.html | 0 test/{headless => }/geometry/Box/detectCollision.html | 0 test/{headless => }/geometry/Box/equal.html | 0 test/{headless => }/geometry/Box/fromBoxes.html | 0 test/{headless => }/geometry/Box/fromPoints.html | 0 test/{headless => }/geometry/Box/getArea.html | 0 test/{headless => }/geometry/Box/getBoundingBox.html | 0 test/{headless => }/geometry/Box/getBoundingCircle.html | 0 test/{headless => }/geometry/Box/getBoundingSphere.html | 0 test/{headless => }/geometry/Box/getInnerSquare.html | 0 test/{headless => }/geometry/Box/getVolume.html | 0 test/{headless => }/geometry/Box/index.mjs | 0 test/{headless => }/geometry/Box/normAt.html | 0 test/{headless => }/geometry/Box/projectTo.html | 0 test/{headless => }/geometry/Box/resizeTo.html | 0 test/{headless => }/geometry/Box/rotateBy.html | 0 test/{headless => }/geometry/Box/scaleBy.html | 0 test/{headless => }/geometry/Box/transitRaw.html | 0 test/{headless => }/geometry/Box/translateBy.html | 0 test/{headless => }/geometry/Circle/boundaries.html | 0 test/{headless => }/geometry/Circle/collisions.html | 0 test/{headless => }/geometry/Circle/construction.html | 0 test/{headless => }/geometry/Circle/dimensions.html | 0 test/{headless => }/geometry/Circle/equality.html | 0 test/{headless => }/geometry/Circle/index.mjs | 0 test/{headless => }/geometry/Circle/points.html | 0 test/{headless => }/geometry/Circle/transformations.html | 0 test/{headless => }/geometry/Circle/transitions.html | 0 test/{headless => }/geometry/Circle/translations.html | 0 test/{headless => }/geometry/Direction/getRaw.html | 0 test/{headless => }/geometry/Direction/index.mjs | 0 test/{headless => }/geometry/Distance/comparison.html | 0 test/{headless => }/geometry/Distance/getRaw.html | 0 test/{headless => }/geometry/Distance/index.mjs | 0 test/{headless => }/geometry/Distance/projection.html | 0 test/{headless => }/geometry/Orientation/getRaw.html | 0 test/{headless => }/geometry/Orientation/index.mjs | 0 test/{headless => }/geometry/Path/getRaw.html | 0 test/{headless => }/geometry/Path/index.mjs | 0 test/{headless => }/geometry/Point/addVector.html | 0 test/{headless => }/geometry/Point/getDistanceTo.html | 0 test/{headless => }/geometry/Point/getRaw.html | 0 test/{headless => }/geometry/Point/index.mjs | 0 test/{headless => }/geometry/Point/transformBy.html | 0 test/{headless => }/geometry/Point/transitRawOuter.html | 0 test/{headless => }/geometry/Ray/creation.html | 0 test/{headless => }/geometry/Ray/index.mjs | 0 test/{headless => }/geometry/Scale/changeBasis.html | 0 test/{headless => }/geometry/Scale/index.mjs | 0 test/{headless => }/geometry/Size/getRaw.html | 0 test/{headless => }/geometry/Size/index.mjs | 0 test/{headless => }/geometry/Size/scaleBy.html | 0 test/{headless => }/geometry/Sphere/boundaries.html | 0 test/{headless => }/geometry/Sphere/collisions.html | 0 test/{headless => }/geometry/Sphere/construction.html | 0 test/{headless => }/geometry/Sphere/dimensions.html | 0 test/{headless => }/geometry/Sphere/equality.html | 0 test/{headless => }/geometry/Sphere/index.mjs | 0 test/{headless => }/geometry/Sphere/measures.html | 0 test/{headless => }/geometry/Sphere/points.html | 0 test/{headless => }/geometry/Sphere/transformations.html | 0 test/{headless => }/geometry/Sphere/transitions.html | 0 test/{headless => }/geometry/Sphere/translations.html | 0 test/{headless => }/geometry/Transform/getRaw.html | 0 test/{headless => }/geometry/Transform/index.mjs | 0 test/{headless => }/geometry/Vector/fromPolar.html | 0 test/{headless => }/geometry/Vector/fromSpherical.html | 0 test/{headless => }/geometry/Vector/getRaw.html | 0 test/{headless => }/geometry/Vector/index.mjs | 0 test/{headless => }/geometry/index.mjs | 0 test/{headless => }/run.mjs | 0 test/{headless => }/suites.mjs | 0 test/{headless => }/testlib.js | 0 test/{headless => }/utils.mjs | 0 test/{headless => }/version/index.mjs | 0 test/{headless => }/version/version.html | 0 131 files changed, 0 insertions(+), 0 deletions(-) rename test/{headless => }/components/Arc/getLength.html (100%) rename test/{headless => }/components/Arc/index.mjs (100%) rename test/{headless => }/components/Component/findCommonAncestor.html (100%) rename test/{headless => }/components/Component/geometryCreation.html (100%) rename test/{headless => }/components/Component/index.mjs (100%) rename test/{headless => }/components/Component/prependChild.html (100%) rename test/{headless => }/components/Component/removeChild.html (100%) rename test/{headless => }/components/Component/replaceChild.html (100%) rename test/{headless => }/components/Component/replaceParent.html (100%) rename test/{headless => }/components/Component/setId.html (100%) rename test/{headless => }/components/Component/setParent.html (100%) rename test/{headless => }/components/FrameComponent/index.mjs (100%) rename test/{headless => }/components/FrameComponent/resizeTo.html (100%) rename test/{headless => }/components/FrameComponent/transformToFill.html (100%) rename test/{headless => }/components/FrameComponent/transformToFit.html (100%) rename test/{headless => }/components/Item/at.html (100%) rename test/{headless => }/components/Item/boundaries.html (100%) rename test/{headless => }/components/Item/createVector.html (100%) rename test/{headless => }/components/Item/getDistanceTo.html (100%) rename test/{headless => }/components/Item/getVectorTo.html (100%) rename test/{headless => }/components/Item/index.mjs (100%) rename test/{headless => }/components/Item/matchBasis.html (100%) rename test/{headless => }/components/Item/rotateBy.html (100%) rename test/{headless => }/components/Item/setBasis.html (100%) rename test/{headless => }/components/Item/setOrientation.html (100%) rename test/{headless => }/components/Item/setScale.html (100%) rename test/{headless => }/components/Item/transformBy.html (100%) rename test/{headless => }/components/Space/at.html (100%) rename test/{headless => }/components/Space/getBoundingBox.html (100%) rename test/{headless => }/components/Space/index.mjs (100%) rename test/{headless => }/components/Viewport/getAspectRatio.html (100%) rename test/{headless => }/components/Viewport/index.mjs (100%) rename test/{headless => }/components/Viewport/measureGroup.html (100%) rename test/{headless => }/components/index.mjs (100%) rename test/{headless => }/geometry/Area/index.mjs (100%) rename test/{headless => }/geometry/Area/projectTo.html (100%) rename test/{headless => }/geometry/Area/transitRaw.html (100%) rename test/{headless => }/geometry/Basis/at.html (100%) rename test/{headless => }/geometry/Basis/changeBasis.html (100%) rename test/{headless => }/geometry/Basis/createDirection.html (100%) rename test/{headless => }/geometry/Basis/createVector.html (100%) rename test/{headless => }/geometry/Basis/getMatchedOuter.html (100%) rename test/{headless => }/geometry/Basis/getTransformTo.html (100%) rename test/{headless => }/geometry/Basis/index.mjs (100%) rename test/{headless => }/geometry/Basis/offsets.html (100%) rename test/{headless => }/geometry/Basis/rotateBy.html (100%) rename test/{headless => }/geometry/Basis/rotateByDegrees.html (100%) rename test/{headless => }/geometry/Basis/scaleBy.html (100%) rename test/{headless => }/geometry/Basis/transformBy.html (100%) rename test/{headless => }/geometry/Basis/transitRaw.html (100%) rename test/{headless => }/geometry/Basis/transitRawOuter.html (100%) rename test/{headless => }/geometry/Basis/translateBy.html (100%) rename test/{headless => }/geometry/Box/almostEqual.html (100%) rename test/{headless => }/geometry/Box/at.html (100%) rename test/{headless => }/geometry/Box/atNorm.html (100%) rename test/{headless => }/geometry/Box/changeBasis.html (100%) rename test/{headless => }/geometry/Box/detectCollision.html (100%) rename test/{headless => }/geometry/Box/equal.html (100%) rename test/{headless => }/geometry/Box/fromBoxes.html (100%) rename test/{headless => }/geometry/Box/fromPoints.html (100%) rename test/{headless => }/geometry/Box/getArea.html (100%) rename test/{headless => }/geometry/Box/getBoundingBox.html (100%) rename test/{headless => }/geometry/Box/getBoundingCircle.html (100%) rename test/{headless => }/geometry/Box/getBoundingSphere.html (100%) rename test/{headless => }/geometry/Box/getInnerSquare.html (100%) rename test/{headless => }/geometry/Box/getVolume.html (100%) rename test/{headless => }/geometry/Box/index.mjs (100%) rename test/{headless => }/geometry/Box/normAt.html (100%) rename test/{headless => }/geometry/Box/projectTo.html (100%) rename test/{headless => }/geometry/Box/resizeTo.html (100%) rename test/{headless => }/geometry/Box/rotateBy.html (100%) rename test/{headless => }/geometry/Box/scaleBy.html (100%) rename test/{headless => }/geometry/Box/transitRaw.html (100%) rename test/{headless => }/geometry/Box/translateBy.html (100%) rename test/{headless => }/geometry/Circle/boundaries.html (100%) rename test/{headless => }/geometry/Circle/collisions.html (100%) rename test/{headless => }/geometry/Circle/construction.html (100%) rename test/{headless => }/geometry/Circle/dimensions.html (100%) rename test/{headless => }/geometry/Circle/equality.html (100%) rename test/{headless => }/geometry/Circle/index.mjs (100%) rename test/{headless => }/geometry/Circle/points.html (100%) rename test/{headless => }/geometry/Circle/transformations.html (100%) rename test/{headless => }/geometry/Circle/transitions.html (100%) rename test/{headless => }/geometry/Circle/translations.html (100%) rename test/{headless => }/geometry/Direction/getRaw.html (100%) rename test/{headless => }/geometry/Direction/index.mjs (100%) rename test/{headless => }/geometry/Distance/comparison.html (100%) rename test/{headless => }/geometry/Distance/getRaw.html (100%) rename test/{headless => }/geometry/Distance/index.mjs (100%) rename test/{headless => }/geometry/Distance/projection.html (100%) rename test/{headless => }/geometry/Orientation/getRaw.html (100%) rename test/{headless => }/geometry/Orientation/index.mjs (100%) rename test/{headless => }/geometry/Path/getRaw.html (100%) rename test/{headless => }/geometry/Path/index.mjs (100%) rename test/{headless => }/geometry/Point/addVector.html (100%) rename test/{headless => }/geometry/Point/getDistanceTo.html (100%) rename test/{headless => }/geometry/Point/getRaw.html (100%) rename test/{headless => }/geometry/Point/index.mjs (100%) rename test/{headless => }/geometry/Point/transformBy.html (100%) rename test/{headless => }/geometry/Point/transitRawOuter.html (100%) rename test/{headless => }/geometry/Ray/creation.html (100%) rename test/{headless => }/geometry/Ray/index.mjs (100%) rename test/{headless => }/geometry/Scale/changeBasis.html (100%) rename test/{headless => }/geometry/Scale/index.mjs (100%) rename test/{headless => }/geometry/Size/getRaw.html (100%) rename test/{headless => }/geometry/Size/index.mjs (100%) rename test/{headless => }/geometry/Size/scaleBy.html (100%) rename test/{headless => }/geometry/Sphere/boundaries.html (100%) rename test/{headless => }/geometry/Sphere/collisions.html (100%) rename test/{headless => }/geometry/Sphere/construction.html (100%) rename test/{headless => }/geometry/Sphere/dimensions.html (100%) rename test/{headless => }/geometry/Sphere/equality.html (100%) rename test/{headless => }/geometry/Sphere/index.mjs (100%) rename test/{headless => }/geometry/Sphere/measures.html (100%) rename test/{headless => }/geometry/Sphere/points.html (100%) rename test/{headless => }/geometry/Sphere/transformations.html (100%) rename test/{headless => }/geometry/Sphere/transitions.html (100%) rename test/{headless => }/geometry/Sphere/translations.html (100%) rename test/{headless => }/geometry/Transform/getRaw.html (100%) rename test/{headless => }/geometry/Transform/index.mjs (100%) rename test/{headless => }/geometry/Vector/fromPolar.html (100%) rename test/{headless => }/geometry/Vector/fromSpherical.html (100%) rename test/{headless => }/geometry/Vector/getRaw.html (100%) rename test/{headless => }/geometry/Vector/index.mjs (100%) rename test/{headless => }/geometry/index.mjs (100%) rename test/{headless => }/run.mjs (100%) rename test/{headless => }/suites.mjs (100%) rename test/{headless => }/testlib.js (100%) rename test/{headless => }/utils.mjs (100%) rename test/{headless => }/version/index.mjs (100%) rename test/{headless => }/version/version.html (100%) diff --git a/test/headless/components/Arc/getLength.html b/test/components/Arc/getLength.html similarity index 100% rename from test/headless/components/Arc/getLength.html rename to test/components/Arc/getLength.html diff --git a/test/headless/components/Arc/index.mjs b/test/components/Arc/index.mjs similarity index 100% rename from test/headless/components/Arc/index.mjs rename to test/components/Arc/index.mjs diff --git a/test/headless/components/Component/findCommonAncestor.html b/test/components/Component/findCommonAncestor.html similarity index 100% rename from test/headless/components/Component/findCommonAncestor.html rename to test/components/Component/findCommonAncestor.html diff --git a/test/headless/components/Component/geometryCreation.html b/test/components/Component/geometryCreation.html similarity index 100% rename from test/headless/components/Component/geometryCreation.html rename to test/components/Component/geometryCreation.html diff --git a/test/headless/components/Component/index.mjs b/test/components/Component/index.mjs similarity index 100% rename from test/headless/components/Component/index.mjs rename to test/components/Component/index.mjs diff --git a/test/headless/components/Component/prependChild.html b/test/components/Component/prependChild.html similarity index 100% rename from test/headless/components/Component/prependChild.html rename to test/components/Component/prependChild.html diff --git a/test/headless/components/Component/removeChild.html b/test/components/Component/removeChild.html similarity index 100% rename from test/headless/components/Component/removeChild.html rename to test/components/Component/removeChild.html diff --git a/test/headless/components/Component/replaceChild.html b/test/components/Component/replaceChild.html similarity index 100% rename from test/headless/components/Component/replaceChild.html rename to test/components/Component/replaceChild.html diff --git a/test/headless/components/Component/replaceParent.html b/test/components/Component/replaceParent.html similarity index 100% rename from test/headless/components/Component/replaceParent.html rename to test/components/Component/replaceParent.html diff --git a/test/headless/components/Component/setId.html b/test/components/Component/setId.html similarity index 100% rename from test/headless/components/Component/setId.html rename to test/components/Component/setId.html diff --git a/test/headless/components/Component/setParent.html b/test/components/Component/setParent.html similarity index 100% rename from test/headless/components/Component/setParent.html rename to test/components/Component/setParent.html diff --git a/test/headless/components/FrameComponent/index.mjs b/test/components/FrameComponent/index.mjs similarity index 100% rename from test/headless/components/FrameComponent/index.mjs rename to test/components/FrameComponent/index.mjs diff --git a/test/headless/components/FrameComponent/resizeTo.html b/test/components/FrameComponent/resizeTo.html similarity index 100% rename from test/headless/components/FrameComponent/resizeTo.html rename to test/components/FrameComponent/resizeTo.html diff --git a/test/headless/components/FrameComponent/transformToFill.html b/test/components/FrameComponent/transformToFill.html similarity index 100% rename from test/headless/components/FrameComponent/transformToFill.html rename to test/components/FrameComponent/transformToFill.html diff --git a/test/headless/components/FrameComponent/transformToFit.html b/test/components/FrameComponent/transformToFit.html similarity index 100% rename from test/headless/components/FrameComponent/transformToFit.html rename to test/components/FrameComponent/transformToFit.html diff --git a/test/headless/components/Item/at.html b/test/components/Item/at.html similarity index 100% rename from test/headless/components/Item/at.html rename to test/components/Item/at.html diff --git a/test/headless/components/Item/boundaries.html b/test/components/Item/boundaries.html similarity index 100% rename from test/headless/components/Item/boundaries.html rename to test/components/Item/boundaries.html diff --git a/test/headless/components/Item/createVector.html b/test/components/Item/createVector.html similarity index 100% rename from test/headless/components/Item/createVector.html rename to test/components/Item/createVector.html diff --git a/test/headless/components/Item/getDistanceTo.html b/test/components/Item/getDistanceTo.html similarity index 100% rename from test/headless/components/Item/getDistanceTo.html rename to test/components/Item/getDistanceTo.html diff --git a/test/headless/components/Item/getVectorTo.html b/test/components/Item/getVectorTo.html similarity index 100% rename from test/headless/components/Item/getVectorTo.html rename to test/components/Item/getVectorTo.html diff --git a/test/headless/components/Item/index.mjs b/test/components/Item/index.mjs similarity index 100% rename from test/headless/components/Item/index.mjs rename to test/components/Item/index.mjs diff --git a/test/headless/components/Item/matchBasis.html b/test/components/Item/matchBasis.html similarity index 100% rename from test/headless/components/Item/matchBasis.html rename to test/components/Item/matchBasis.html diff --git a/test/headless/components/Item/rotateBy.html b/test/components/Item/rotateBy.html similarity index 100% rename from test/headless/components/Item/rotateBy.html rename to test/components/Item/rotateBy.html diff --git a/test/headless/components/Item/setBasis.html b/test/components/Item/setBasis.html similarity index 100% rename from test/headless/components/Item/setBasis.html rename to test/components/Item/setBasis.html diff --git a/test/headless/components/Item/setOrientation.html b/test/components/Item/setOrientation.html similarity index 100% rename from test/headless/components/Item/setOrientation.html rename to test/components/Item/setOrientation.html diff --git a/test/headless/components/Item/setScale.html b/test/components/Item/setScale.html similarity index 100% rename from test/headless/components/Item/setScale.html rename to test/components/Item/setScale.html diff --git a/test/headless/components/Item/transformBy.html b/test/components/Item/transformBy.html similarity index 100% rename from test/headless/components/Item/transformBy.html rename to test/components/Item/transformBy.html diff --git a/test/headless/components/Space/at.html b/test/components/Space/at.html similarity index 100% rename from test/headless/components/Space/at.html rename to test/components/Space/at.html diff --git a/test/headless/components/Space/getBoundingBox.html b/test/components/Space/getBoundingBox.html similarity index 100% rename from test/headless/components/Space/getBoundingBox.html rename to test/components/Space/getBoundingBox.html diff --git a/test/headless/components/Space/index.mjs b/test/components/Space/index.mjs similarity index 100% rename from test/headless/components/Space/index.mjs rename to test/components/Space/index.mjs diff --git a/test/headless/components/Viewport/getAspectRatio.html b/test/components/Viewport/getAspectRatio.html similarity index 100% rename from test/headless/components/Viewport/getAspectRatio.html rename to test/components/Viewport/getAspectRatio.html diff --git a/test/headless/components/Viewport/index.mjs b/test/components/Viewport/index.mjs similarity index 100% rename from test/headless/components/Viewport/index.mjs rename to test/components/Viewport/index.mjs diff --git a/test/headless/components/Viewport/measureGroup.html b/test/components/Viewport/measureGroup.html similarity index 100% rename from test/headless/components/Viewport/measureGroup.html rename to test/components/Viewport/measureGroup.html diff --git a/test/headless/components/index.mjs b/test/components/index.mjs similarity index 100% rename from test/headless/components/index.mjs rename to test/components/index.mjs diff --git a/test/headless/geometry/Area/index.mjs b/test/geometry/Area/index.mjs similarity index 100% rename from test/headless/geometry/Area/index.mjs rename to test/geometry/Area/index.mjs diff --git a/test/headless/geometry/Area/projectTo.html b/test/geometry/Area/projectTo.html similarity index 100% rename from test/headless/geometry/Area/projectTo.html rename to test/geometry/Area/projectTo.html diff --git a/test/headless/geometry/Area/transitRaw.html b/test/geometry/Area/transitRaw.html similarity index 100% rename from test/headless/geometry/Area/transitRaw.html rename to test/geometry/Area/transitRaw.html diff --git a/test/headless/geometry/Basis/at.html b/test/geometry/Basis/at.html similarity index 100% rename from test/headless/geometry/Basis/at.html rename to test/geometry/Basis/at.html diff --git a/test/headless/geometry/Basis/changeBasis.html b/test/geometry/Basis/changeBasis.html similarity index 100% rename from test/headless/geometry/Basis/changeBasis.html rename to test/geometry/Basis/changeBasis.html diff --git a/test/headless/geometry/Basis/createDirection.html b/test/geometry/Basis/createDirection.html similarity index 100% rename from test/headless/geometry/Basis/createDirection.html rename to test/geometry/Basis/createDirection.html diff --git a/test/headless/geometry/Basis/createVector.html b/test/geometry/Basis/createVector.html similarity index 100% rename from test/headless/geometry/Basis/createVector.html rename to test/geometry/Basis/createVector.html diff --git a/test/headless/geometry/Basis/getMatchedOuter.html b/test/geometry/Basis/getMatchedOuter.html similarity index 100% rename from test/headless/geometry/Basis/getMatchedOuter.html rename to test/geometry/Basis/getMatchedOuter.html diff --git a/test/headless/geometry/Basis/getTransformTo.html b/test/geometry/Basis/getTransformTo.html similarity index 100% rename from test/headless/geometry/Basis/getTransformTo.html rename to test/geometry/Basis/getTransformTo.html diff --git a/test/headless/geometry/Basis/index.mjs b/test/geometry/Basis/index.mjs similarity index 100% rename from test/headless/geometry/Basis/index.mjs rename to test/geometry/Basis/index.mjs diff --git a/test/headless/geometry/Basis/offsets.html b/test/geometry/Basis/offsets.html similarity index 100% rename from test/headless/geometry/Basis/offsets.html rename to test/geometry/Basis/offsets.html diff --git a/test/headless/geometry/Basis/rotateBy.html b/test/geometry/Basis/rotateBy.html similarity index 100% rename from test/headless/geometry/Basis/rotateBy.html rename to test/geometry/Basis/rotateBy.html diff --git a/test/headless/geometry/Basis/rotateByDegrees.html b/test/geometry/Basis/rotateByDegrees.html similarity index 100% rename from test/headless/geometry/Basis/rotateByDegrees.html rename to test/geometry/Basis/rotateByDegrees.html diff --git a/test/headless/geometry/Basis/scaleBy.html b/test/geometry/Basis/scaleBy.html similarity index 100% rename from test/headless/geometry/Basis/scaleBy.html rename to test/geometry/Basis/scaleBy.html diff --git a/test/headless/geometry/Basis/transformBy.html b/test/geometry/Basis/transformBy.html similarity index 100% rename from test/headless/geometry/Basis/transformBy.html rename to test/geometry/Basis/transformBy.html diff --git a/test/headless/geometry/Basis/transitRaw.html b/test/geometry/Basis/transitRaw.html similarity index 100% rename from test/headless/geometry/Basis/transitRaw.html rename to test/geometry/Basis/transitRaw.html diff --git a/test/headless/geometry/Basis/transitRawOuter.html b/test/geometry/Basis/transitRawOuter.html similarity index 100% rename from test/headless/geometry/Basis/transitRawOuter.html rename to test/geometry/Basis/transitRawOuter.html diff --git a/test/headless/geometry/Basis/translateBy.html b/test/geometry/Basis/translateBy.html similarity index 100% rename from test/headless/geometry/Basis/translateBy.html rename to test/geometry/Basis/translateBy.html diff --git a/test/headless/geometry/Box/almostEqual.html b/test/geometry/Box/almostEqual.html similarity index 100% rename from test/headless/geometry/Box/almostEqual.html rename to test/geometry/Box/almostEqual.html diff --git a/test/headless/geometry/Box/at.html b/test/geometry/Box/at.html similarity index 100% rename from test/headless/geometry/Box/at.html rename to test/geometry/Box/at.html diff --git a/test/headless/geometry/Box/atNorm.html b/test/geometry/Box/atNorm.html similarity index 100% rename from test/headless/geometry/Box/atNorm.html rename to test/geometry/Box/atNorm.html diff --git a/test/headless/geometry/Box/changeBasis.html b/test/geometry/Box/changeBasis.html similarity index 100% rename from test/headless/geometry/Box/changeBasis.html rename to test/geometry/Box/changeBasis.html diff --git a/test/headless/geometry/Box/detectCollision.html b/test/geometry/Box/detectCollision.html similarity index 100% rename from test/headless/geometry/Box/detectCollision.html rename to test/geometry/Box/detectCollision.html diff --git a/test/headless/geometry/Box/equal.html b/test/geometry/Box/equal.html similarity index 100% rename from test/headless/geometry/Box/equal.html rename to test/geometry/Box/equal.html diff --git a/test/headless/geometry/Box/fromBoxes.html b/test/geometry/Box/fromBoxes.html similarity index 100% rename from test/headless/geometry/Box/fromBoxes.html rename to test/geometry/Box/fromBoxes.html diff --git a/test/headless/geometry/Box/fromPoints.html b/test/geometry/Box/fromPoints.html similarity index 100% rename from test/headless/geometry/Box/fromPoints.html rename to test/geometry/Box/fromPoints.html diff --git a/test/headless/geometry/Box/getArea.html b/test/geometry/Box/getArea.html similarity index 100% rename from test/headless/geometry/Box/getArea.html rename to test/geometry/Box/getArea.html diff --git a/test/headless/geometry/Box/getBoundingBox.html b/test/geometry/Box/getBoundingBox.html similarity index 100% rename from test/headless/geometry/Box/getBoundingBox.html rename to test/geometry/Box/getBoundingBox.html diff --git a/test/headless/geometry/Box/getBoundingCircle.html b/test/geometry/Box/getBoundingCircle.html similarity index 100% rename from test/headless/geometry/Box/getBoundingCircle.html rename to test/geometry/Box/getBoundingCircle.html diff --git a/test/headless/geometry/Box/getBoundingSphere.html b/test/geometry/Box/getBoundingSphere.html similarity index 100% rename from test/headless/geometry/Box/getBoundingSphere.html rename to test/geometry/Box/getBoundingSphere.html diff --git a/test/headless/geometry/Box/getInnerSquare.html b/test/geometry/Box/getInnerSquare.html similarity index 100% rename from test/headless/geometry/Box/getInnerSquare.html rename to test/geometry/Box/getInnerSquare.html diff --git a/test/headless/geometry/Box/getVolume.html b/test/geometry/Box/getVolume.html similarity index 100% rename from test/headless/geometry/Box/getVolume.html rename to test/geometry/Box/getVolume.html diff --git a/test/headless/geometry/Box/index.mjs b/test/geometry/Box/index.mjs similarity index 100% rename from test/headless/geometry/Box/index.mjs rename to test/geometry/Box/index.mjs diff --git a/test/headless/geometry/Box/normAt.html b/test/geometry/Box/normAt.html similarity index 100% rename from test/headless/geometry/Box/normAt.html rename to test/geometry/Box/normAt.html diff --git a/test/headless/geometry/Box/projectTo.html b/test/geometry/Box/projectTo.html similarity index 100% rename from test/headless/geometry/Box/projectTo.html rename to test/geometry/Box/projectTo.html diff --git a/test/headless/geometry/Box/resizeTo.html b/test/geometry/Box/resizeTo.html similarity index 100% rename from test/headless/geometry/Box/resizeTo.html rename to test/geometry/Box/resizeTo.html diff --git a/test/headless/geometry/Box/rotateBy.html b/test/geometry/Box/rotateBy.html similarity index 100% rename from test/headless/geometry/Box/rotateBy.html rename to test/geometry/Box/rotateBy.html diff --git a/test/headless/geometry/Box/scaleBy.html b/test/geometry/Box/scaleBy.html similarity index 100% rename from test/headless/geometry/Box/scaleBy.html rename to test/geometry/Box/scaleBy.html diff --git a/test/headless/geometry/Box/transitRaw.html b/test/geometry/Box/transitRaw.html similarity index 100% rename from test/headless/geometry/Box/transitRaw.html rename to test/geometry/Box/transitRaw.html diff --git a/test/headless/geometry/Box/translateBy.html b/test/geometry/Box/translateBy.html similarity index 100% rename from test/headless/geometry/Box/translateBy.html rename to test/geometry/Box/translateBy.html diff --git a/test/headless/geometry/Circle/boundaries.html b/test/geometry/Circle/boundaries.html similarity index 100% rename from test/headless/geometry/Circle/boundaries.html rename to test/geometry/Circle/boundaries.html diff --git a/test/headless/geometry/Circle/collisions.html b/test/geometry/Circle/collisions.html similarity index 100% rename from test/headless/geometry/Circle/collisions.html rename to test/geometry/Circle/collisions.html diff --git a/test/headless/geometry/Circle/construction.html b/test/geometry/Circle/construction.html similarity index 100% rename from test/headless/geometry/Circle/construction.html rename to test/geometry/Circle/construction.html diff --git a/test/headless/geometry/Circle/dimensions.html b/test/geometry/Circle/dimensions.html similarity index 100% rename from test/headless/geometry/Circle/dimensions.html rename to test/geometry/Circle/dimensions.html diff --git a/test/headless/geometry/Circle/equality.html b/test/geometry/Circle/equality.html similarity index 100% rename from test/headless/geometry/Circle/equality.html rename to test/geometry/Circle/equality.html diff --git a/test/headless/geometry/Circle/index.mjs b/test/geometry/Circle/index.mjs similarity index 100% rename from test/headless/geometry/Circle/index.mjs rename to test/geometry/Circle/index.mjs diff --git a/test/headless/geometry/Circle/points.html b/test/geometry/Circle/points.html similarity index 100% rename from test/headless/geometry/Circle/points.html rename to test/geometry/Circle/points.html diff --git a/test/headless/geometry/Circle/transformations.html b/test/geometry/Circle/transformations.html similarity index 100% rename from test/headless/geometry/Circle/transformations.html rename to test/geometry/Circle/transformations.html diff --git a/test/headless/geometry/Circle/transitions.html b/test/geometry/Circle/transitions.html similarity index 100% rename from test/headless/geometry/Circle/transitions.html rename to test/geometry/Circle/transitions.html diff --git a/test/headless/geometry/Circle/translations.html b/test/geometry/Circle/translations.html similarity index 100% rename from test/headless/geometry/Circle/translations.html rename to test/geometry/Circle/translations.html diff --git a/test/headless/geometry/Direction/getRaw.html b/test/geometry/Direction/getRaw.html similarity index 100% rename from test/headless/geometry/Direction/getRaw.html rename to test/geometry/Direction/getRaw.html diff --git a/test/headless/geometry/Direction/index.mjs b/test/geometry/Direction/index.mjs similarity index 100% rename from test/headless/geometry/Direction/index.mjs rename to test/geometry/Direction/index.mjs diff --git a/test/headless/geometry/Distance/comparison.html b/test/geometry/Distance/comparison.html similarity index 100% rename from test/headless/geometry/Distance/comparison.html rename to test/geometry/Distance/comparison.html diff --git a/test/headless/geometry/Distance/getRaw.html b/test/geometry/Distance/getRaw.html similarity index 100% rename from test/headless/geometry/Distance/getRaw.html rename to test/geometry/Distance/getRaw.html diff --git a/test/headless/geometry/Distance/index.mjs b/test/geometry/Distance/index.mjs similarity index 100% rename from test/headless/geometry/Distance/index.mjs rename to test/geometry/Distance/index.mjs diff --git a/test/headless/geometry/Distance/projection.html b/test/geometry/Distance/projection.html similarity index 100% rename from test/headless/geometry/Distance/projection.html rename to test/geometry/Distance/projection.html diff --git a/test/headless/geometry/Orientation/getRaw.html b/test/geometry/Orientation/getRaw.html similarity index 100% rename from test/headless/geometry/Orientation/getRaw.html rename to test/geometry/Orientation/getRaw.html diff --git a/test/headless/geometry/Orientation/index.mjs b/test/geometry/Orientation/index.mjs similarity index 100% rename from test/headless/geometry/Orientation/index.mjs rename to test/geometry/Orientation/index.mjs diff --git a/test/headless/geometry/Path/getRaw.html b/test/geometry/Path/getRaw.html similarity index 100% rename from test/headless/geometry/Path/getRaw.html rename to test/geometry/Path/getRaw.html diff --git a/test/headless/geometry/Path/index.mjs b/test/geometry/Path/index.mjs similarity index 100% rename from test/headless/geometry/Path/index.mjs rename to test/geometry/Path/index.mjs diff --git a/test/headless/geometry/Point/addVector.html b/test/geometry/Point/addVector.html similarity index 100% rename from test/headless/geometry/Point/addVector.html rename to test/geometry/Point/addVector.html diff --git a/test/headless/geometry/Point/getDistanceTo.html b/test/geometry/Point/getDistanceTo.html similarity index 100% rename from test/headless/geometry/Point/getDistanceTo.html rename to test/geometry/Point/getDistanceTo.html diff --git a/test/headless/geometry/Point/getRaw.html b/test/geometry/Point/getRaw.html similarity index 100% rename from test/headless/geometry/Point/getRaw.html rename to test/geometry/Point/getRaw.html diff --git a/test/headless/geometry/Point/index.mjs b/test/geometry/Point/index.mjs similarity index 100% rename from test/headless/geometry/Point/index.mjs rename to test/geometry/Point/index.mjs diff --git a/test/headless/geometry/Point/transformBy.html b/test/geometry/Point/transformBy.html similarity index 100% rename from test/headless/geometry/Point/transformBy.html rename to test/geometry/Point/transformBy.html diff --git a/test/headless/geometry/Point/transitRawOuter.html b/test/geometry/Point/transitRawOuter.html similarity index 100% rename from test/headless/geometry/Point/transitRawOuter.html rename to test/geometry/Point/transitRawOuter.html diff --git a/test/headless/geometry/Ray/creation.html b/test/geometry/Ray/creation.html similarity index 100% rename from test/headless/geometry/Ray/creation.html rename to test/geometry/Ray/creation.html diff --git a/test/headless/geometry/Ray/index.mjs b/test/geometry/Ray/index.mjs similarity index 100% rename from test/headless/geometry/Ray/index.mjs rename to test/geometry/Ray/index.mjs diff --git a/test/headless/geometry/Scale/changeBasis.html b/test/geometry/Scale/changeBasis.html similarity index 100% rename from test/headless/geometry/Scale/changeBasis.html rename to test/geometry/Scale/changeBasis.html diff --git a/test/headless/geometry/Scale/index.mjs b/test/geometry/Scale/index.mjs similarity index 100% rename from test/headless/geometry/Scale/index.mjs rename to test/geometry/Scale/index.mjs diff --git a/test/headless/geometry/Size/getRaw.html b/test/geometry/Size/getRaw.html similarity index 100% rename from test/headless/geometry/Size/getRaw.html rename to test/geometry/Size/getRaw.html diff --git a/test/headless/geometry/Size/index.mjs b/test/geometry/Size/index.mjs similarity index 100% rename from test/headless/geometry/Size/index.mjs rename to test/geometry/Size/index.mjs diff --git a/test/headless/geometry/Size/scaleBy.html b/test/geometry/Size/scaleBy.html similarity index 100% rename from test/headless/geometry/Size/scaleBy.html rename to test/geometry/Size/scaleBy.html diff --git a/test/headless/geometry/Sphere/boundaries.html b/test/geometry/Sphere/boundaries.html similarity index 100% rename from test/headless/geometry/Sphere/boundaries.html rename to test/geometry/Sphere/boundaries.html diff --git a/test/headless/geometry/Sphere/collisions.html b/test/geometry/Sphere/collisions.html similarity index 100% rename from test/headless/geometry/Sphere/collisions.html rename to test/geometry/Sphere/collisions.html diff --git a/test/headless/geometry/Sphere/construction.html b/test/geometry/Sphere/construction.html similarity index 100% rename from test/headless/geometry/Sphere/construction.html rename to test/geometry/Sphere/construction.html diff --git a/test/headless/geometry/Sphere/dimensions.html b/test/geometry/Sphere/dimensions.html similarity index 100% rename from test/headless/geometry/Sphere/dimensions.html rename to test/geometry/Sphere/dimensions.html diff --git a/test/headless/geometry/Sphere/equality.html b/test/geometry/Sphere/equality.html similarity index 100% rename from test/headless/geometry/Sphere/equality.html rename to test/geometry/Sphere/equality.html diff --git a/test/headless/geometry/Sphere/index.mjs b/test/geometry/Sphere/index.mjs similarity index 100% rename from test/headless/geometry/Sphere/index.mjs rename to test/geometry/Sphere/index.mjs diff --git a/test/headless/geometry/Sphere/measures.html b/test/geometry/Sphere/measures.html similarity index 100% rename from test/headless/geometry/Sphere/measures.html rename to test/geometry/Sphere/measures.html diff --git a/test/headless/geometry/Sphere/points.html b/test/geometry/Sphere/points.html similarity index 100% rename from test/headless/geometry/Sphere/points.html rename to test/geometry/Sphere/points.html diff --git a/test/headless/geometry/Sphere/transformations.html b/test/geometry/Sphere/transformations.html similarity index 100% rename from test/headless/geometry/Sphere/transformations.html rename to test/geometry/Sphere/transformations.html diff --git a/test/headless/geometry/Sphere/transitions.html b/test/geometry/Sphere/transitions.html similarity index 100% rename from test/headless/geometry/Sphere/transitions.html rename to test/geometry/Sphere/transitions.html diff --git a/test/headless/geometry/Sphere/translations.html b/test/geometry/Sphere/translations.html similarity index 100% rename from test/headless/geometry/Sphere/translations.html rename to test/geometry/Sphere/translations.html diff --git a/test/headless/geometry/Transform/getRaw.html b/test/geometry/Transform/getRaw.html similarity index 100% rename from test/headless/geometry/Transform/getRaw.html rename to test/geometry/Transform/getRaw.html diff --git a/test/headless/geometry/Transform/index.mjs b/test/geometry/Transform/index.mjs similarity index 100% rename from test/headless/geometry/Transform/index.mjs rename to test/geometry/Transform/index.mjs diff --git a/test/headless/geometry/Vector/fromPolar.html b/test/geometry/Vector/fromPolar.html similarity index 100% rename from test/headless/geometry/Vector/fromPolar.html rename to test/geometry/Vector/fromPolar.html diff --git a/test/headless/geometry/Vector/fromSpherical.html b/test/geometry/Vector/fromSpherical.html similarity index 100% rename from test/headless/geometry/Vector/fromSpherical.html rename to test/geometry/Vector/fromSpherical.html diff --git a/test/headless/geometry/Vector/getRaw.html b/test/geometry/Vector/getRaw.html similarity index 100% rename from test/headless/geometry/Vector/getRaw.html rename to test/geometry/Vector/getRaw.html diff --git a/test/headless/geometry/Vector/index.mjs b/test/geometry/Vector/index.mjs similarity index 100% rename from test/headless/geometry/Vector/index.mjs rename to test/geometry/Vector/index.mjs diff --git a/test/headless/geometry/index.mjs b/test/geometry/index.mjs similarity index 100% rename from test/headless/geometry/index.mjs rename to test/geometry/index.mjs diff --git a/test/headless/run.mjs b/test/run.mjs similarity index 100% rename from test/headless/run.mjs rename to test/run.mjs diff --git a/test/headless/suites.mjs b/test/suites.mjs similarity index 100% rename from test/headless/suites.mjs rename to test/suites.mjs diff --git a/test/headless/testlib.js b/test/testlib.js similarity index 100% rename from test/headless/testlib.js rename to test/testlib.js diff --git a/test/headless/utils.mjs b/test/utils.mjs similarity index 100% rename from test/headless/utils.mjs rename to test/utils.mjs diff --git a/test/headless/version/index.mjs b/test/version/index.mjs similarity index 100% rename from test/headless/version/index.mjs rename to test/version/index.mjs diff --git a/test/headless/version/version.html b/test/version/version.html similarity index 100% rename from test/headless/version/version.html rename to test/version/version.html From c532b967217e33a1839c37facaf13d72c1c42a4a Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:32:39 +0200 Subject: [PATCH 088/118] repair test suite paths --- package.json | 4 ++-- test/components/Arc/getLength.html | 2 +- test/components/Component/findCommonAncestor.html | 2 +- test/components/Component/geometryCreation.html | 2 +- test/components/Component/prependChild.html | 2 +- test/components/Component/removeChild.html | 2 +- test/components/Component/replaceChild.html | 2 +- test/components/Component/replaceParent.html | 2 +- test/components/Component/setId.html | 2 +- test/components/Component/setParent.html | 2 +- test/components/FrameComponent/resizeTo.html | 2 +- test/components/FrameComponent/transformToFill.html | 2 +- test/components/FrameComponent/transformToFit.html | 2 +- test/components/Item/at.html | 2 +- test/components/Item/boundaries.html | 2 +- test/components/Item/createVector.html | 2 +- test/components/Item/getDistanceTo.html | 2 +- test/components/Item/getVectorTo.html | 2 +- test/components/Item/matchBasis.html | 2 +- test/components/Item/rotateBy.html | 2 +- test/components/Item/setBasis.html | 2 +- test/components/Item/setOrientation.html | 2 +- test/components/Item/setScale.html | 2 +- test/components/Item/transformBy.html | 2 +- test/components/Space/at.html | 2 +- test/components/Space/getBoundingBox.html | 2 +- test/components/Viewport/getAspectRatio.html | 2 +- test/components/Viewport/measureGroup.html | 2 +- test/geometry/Area/projectTo.html | 2 +- test/geometry/Area/transitRaw.html | 2 +- test/geometry/Basis/at.html | 2 +- test/geometry/Basis/changeBasis.html | 2 +- test/geometry/Basis/createDirection.html | 2 +- test/geometry/Basis/createVector.html | 2 +- test/geometry/Basis/getMatchedOuter.html | 2 +- test/geometry/Basis/getTransformTo.html | 2 +- test/geometry/Basis/offsets.html | 2 +- test/geometry/Basis/rotateBy.html | 2 +- test/geometry/Basis/rotateByDegrees.html | 2 +- test/geometry/Basis/scaleBy.html | 2 +- test/geometry/Basis/transformBy.html | 2 +- test/geometry/Basis/transitRaw.html | 2 +- test/geometry/Basis/transitRawOuter.html | 2 +- test/geometry/Basis/translateBy.html | 2 +- test/geometry/Box/almostEqual.html | 2 +- test/geometry/Box/at.html | 2 +- test/geometry/Box/atNorm.html | 2 +- test/geometry/Box/changeBasis.html | 2 +- test/geometry/Box/detectCollision.html | 2 +- test/geometry/Box/equal.html | 2 +- test/geometry/Box/fromBoxes.html | 2 +- test/geometry/Box/fromPoints.html | 2 +- test/geometry/Box/getArea.html | 2 +- test/geometry/Box/getBoundingBox.html | 2 +- test/geometry/Box/getBoundingCircle.html | 2 +- test/geometry/Box/getBoundingSphere.html | 2 +- test/geometry/Box/getInnerSquare.html | 2 +- test/geometry/Box/getVolume.html | 2 +- test/geometry/Box/normAt.html | 2 +- test/geometry/Box/projectTo.html | 2 +- test/geometry/Box/resizeTo.html | 2 +- test/geometry/Box/rotateBy.html | 2 +- test/geometry/Box/scaleBy.html | 2 +- test/geometry/Box/transitRaw.html | 2 +- test/geometry/Box/translateBy.html | 2 +- test/geometry/Circle/boundaries.html | 2 +- test/geometry/Circle/collisions.html | 2 +- test/geometry/Circle/construction.html | 2 +- test/geometry/Circle/dimensions.html | 2 +- test/geometry/Circle/equality.html | 2 +- test/geometry/Circle/points.html | 2 +- test/geometry/Circle/transformations.html | 2 +- test/geometry/Circle/transitions.html | 2 +- test/geometry/Circle/translations.html | 2 +- test/geometry/Direction/getRaw.html | 2 +- test/geometry/Distance/comparison.html | 2 +- test/geometry/Distance/getRaw.html | 2 +- test/geometry/Distance/projection.html | 2 +- test/geometry/Orientation/getRaw.html | 2 +- test/geometry/Path/getRaw.html | 2 +- test/geometry/Point/addVector.html | 2 +- test/geometry/Point/getDistanceTo.html | 2 +- test/geometry/Point/getRaw.html | 2 +- test/geometry/Point/transformBy.html | 2 +- test/geometry/Point/transitRawOuter.html | 2 +- test/geometry/Ray/creation.html | 2 +- test/geometry/Scale/changeBasis.html | 2 +- test/geometry/Size/getRaw.html | 2 +- test/geometry/Size/scaleBy.html | 2 +- test/geometry/Sphere/boundaries.html | 2 +- test/geometry/Sphere/collisions.html | 2 +- test/geometry/Sphere/construction.html | 2 +- test/geometry/Sphere/dimensions.html | 2 +- test/geometry/Sphere/equality.html | 2 +- test/geometry/Sphere/measures.html | 2 +- test/geometry/Sphere/points.html | 2 +- test/geometry/Sphere/transformations.html | 2 +- test/geometry/Sphere/transitions.html | 2 +- test/geometry/Sphere/translations.html | 2 +- test/geometry/Transform/getRaw.html | 2 +- test/geometry/Vector/fromPolar.html | 2 +- test/geometry/Vector/fromSpherical.html | 2 +- test/geometry/Vector/getRaw.html | 2 +- test/version/index.mjs | 2 +- test/version/version.html | 2 +- 105 files changed, 106 insertions(+), 106 deletions(-) diff --git a/package.json b/package.json index 19bb2090..b3c13b77 100644 --- a/package.json +++ b/package.json @@ -69,8 +69,8 @@ "lint": "standard 'lib/**/*.js' 'test/**/*.js' && echo 'OK'", "lint:fix": "standard --fix 'lib/**/*.js' 'test/**/*.js'", "lint:lib": "standard 'lib/**/*.js'", - "test": "npm run lint", - "test:headless": "npm run lint && npm run build && node test/headless/run.mjs", + "test": "npm run lint && npm run build && npm run test:headless", + "test:headless": "node test/run.mjs", "release": "npm run lint && npm run gv && npm run build:production && npm run build:docs && npm publish --tag alpha", "gv": "genversion lib/version.js" } diff --git a/test/components/Arc/getLength.html b/test/components/Arc/getLength.html index 8c63594f..f39abac4 100644 --- a/test/components/Arc/getLength.html +++ b/test/components/Arc/getLength.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/findCommonAncestor.html b/test/components/Component/findCommonAncestor.html index ccd3077f..5b92618f 100644 --- a/test/components/Component/findCommonAncestor.html +++ b/test/components/Component/findCommonAncestor.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/geometryCreation.html b/test/components/Component/geometryCreation.html index 01e182b3..6ecd4f3b 100644 --- a/test/components/Component/geometryCreation.html +++ b/test/components/Component/geometryCreation.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/prependChild.html b/test/components/Component/prependChild.html index f4105ca8..c3ea01c9 100644 --- a/test/components/Component/prependChild.html +++ b/test/components/Component/prependChild.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/removeChild.html b/test/components/Component/removeChild.html index a59adcb0..c329e038 100644 --- a/test/components/Component/removeChild.html +++ b/test/components/Component/removeChild.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/replaceChild.html b/test/components/Component/replaceChild.html index 2ead30ea..0c8cadae 100644 --- a/test/components/Component/replaceChild.html +++ b/test/components/Component/replaceChild.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/replaceParent.html b/test/components/Component/replaceParent.html index ea969855..fa0fd195 100644 --- a/test/components/Component/replaceParent.html +++ b/test/components/Component/replaceParent.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/setId.html b/test/components/Component/setId.html index 0ccd7db2..e708a5fd 100644 --- a/test/components/Component/setId.html +++ b/test/components/Component/setId.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Component/setParent.html b/test/components/Component/setParent.html index 03229f28..82f083d0 100644 --- a/test/components/Component/setParent.html +++ b/test/components/Component/setParent.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/FrameComponent/resizeTo.html b/test/components/FrameComponent/resizeTo.html index 093517e0..d583ebe9 100644 --- a/test/components/FrameComponent/resizeTo.html +++ b/test/components/FrameComponent/resizeTo.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/FrameComponent/transformToFill.html b/test/components/FrameComponent/transformToFill.html index 8ab52698..70f8dd75 100644 --- a/test/components/FrameComponent/transformToFill.html +++ b/test/components/FrameComponent/transformToFill.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/FrameComponent/transformToFit.html b/test/components/FrameComponent/transformToFit.html index 5db1d4a4..193ccbd3 100644 --- a/test/components/FrameComponent/transformToFit.html +++ b/test/components/FrameComponent/transformToFit.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/at.html b/test/components/Item/at.html index 00f45a86..18071fa6 100644 --- a/test/components/Item/at.html +++ b/test/components/Item/at.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/boundaries.html b/test/components/Item/boundaries.html index e547f627..f3054d6b 100644 --- a/test/components/Item/boundaries.html +++ b/test/components/Item/boundaries.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/createVector.html b/test/components/Item/createVector.html index 66797fe0..3a81aa43 100644 --- a/test/components/Item/createVector.html +++ b/test/components/Item/createVector.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/getDistanceTo.html b/test/components/Item/getDistanceTo.html index 2de66bdb..283b435e 100644 --- a/test/components/Item/getDistanceTo.html +++ b/test/components/Item/getDistanceTo.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/getVectorTo.html b/test/components/Item/getVectorTo.html index 9801dbe7..a627887d 100644 --- a/test/components/Item/getVectorTo.html +++ b/test/components/Item/getVectorTo.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/matchBasis.html b/test/components/Item/matchBasis.html index 95010451..12caa039 100644 --- a/test/components/Item/matchBasis.html +++ b/test/components/Item/matchBasis.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/rotateBy.html b/test/components/Item/rotateBy.html index 1ae1368f..654be834 100644 --- a/test/components/Item/rotateBy.html +++ b/test/components/Item/rotateBy.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/setBasis.html b/test/components/Item/setBasis.html index 7fb2a3f3..f0d99c0e 100644 --- a/test/components/Item/setBasis.html +++ b/test/components/Item/setBasis.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/setOrientation.html b/test/components/Item/setOrientation.html index 2df6d3f0..11349b94 100644 --- a/test/components/Item/setOrientation.html +++ b/test/components/Item/setOrientation.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/setScale.html b/test/components/Item/setScale.html index 5ad19600..12c80905 100644 --- a/test/components/Item/setScale.html +++ b/test/components/Item/setScale.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Item/transformBy.html b/test/components/Item/transformBy.html index 375ef88a..b35b15d0 100644 --- a/test/components/Item/transformBy.html +++ b/test/components/Item/transformBy.html @@ -20,7 +20,7 @@ height: 400px; } - + diff --git a/test/components/Space/at.html b/test/components/Space/at.html index e39a1dcc..ba03fd1c 100644 --- a/test/components/Space/at.html +++ b/test/components/Space/at.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Space/getBoundingBox.html b/test/components/Space/getBoundingBox.html index 3cfaed52..a7f2780f 100644 --- a/test/components/Space/getBoundingBox.html +++ b/test/components/Space/getBoundingBox.html @@ -20,7 +20,7 @@ height: 500px; } - + diff --git a/test/components/Viewport/getAspectRatio.html b/test/components/Viewport/getAspectRatio.html index 14917ba9..5c1ca1c6 100644 --- a/test/components/Viewport/getAspectRatio.html +++ b/test/components/Viewport/getAspectRatio.html @@ -20,7 +20,7 @@ height: 100%; } - + diff --git a/test/components/Viewport/measureGroup.html b/test/components/Viewport/measureGroup.html index 9d6fd236..e215209a 100644 --- a/test/components/Viewport/measureGroup.html +++ b/test/components/Viewport/measureGroup.html @@ -20,7 +20,7 @@ height: 100%; } - + diff --git a/test/geometry/Area/projectTo.html b/test/geometry/Area/projectTo.html index 89a5115b..b264d93b 100644 --- a/test/geometry/Area/projectTo.html +++ b/test/geometry/Area/projectTo.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Area/transitRaw.html b/test/geometry/Area/transitRaw.html index bc5f6472..353c10db 100644 --- a/test/geometry/Area/transitRaw.html +++ b/test/geometry/Area/transitRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/at.html b/test/geometry/Basis/at.html index 13873448..38d39370 100644 --- a/test/geometry/Basis/at.html +++ b/test/geometry/Basis/at.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/changeBasis.html b/test/geometry/Basis/changeBasis.html index 887cb783..56654a2c 100644 --- a/test/geometry/Basis/changeBasis.html +++ b/test/geometry/Basis/changeBasis.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/createDirection.html b/test/geometry/Basis/createDirection.html index 91e9a22d..02996781 100644 --- a/test/geometry/Basis/createDirection.html +++ b/test/geometry/Basis/createDirection.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/createVector.html b/test/geometry/Basis/createVector.html index 7b593d76..66af9107 100644 --- a/test/geometry/Basis/createVector.html +++ b/test/geometry/Basis/createVector.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/getMatchedOuter.html b/test/geometry/Basis/getMatchedOuter.html index 6ceed311..7b78097d 100644 --- a/test/geometry/Basis/getMatchedOuter.html +++ b/test/geometry/Basis/getMatchedOuter.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/getTransformTo.html b/test/geometry/Basis/getTransformTo.html index 1e05612b..3971a77d 100644 --- a/test/geometry/Basis/getTransformTo.html +++ b/test/geometry/Basis/getTransformTo.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/offsets.html b/test/geometry/Basis/offsets.html index 2a80e96d..d3e15f1b 100644 --- a/test/geometry/Basis/offsets.html +++ b/test/geometry/Basis/offsets.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/rotateBy.html b/test/geometry/Basis/rotateBy.html index 11c7f219..83d3e0cc 100644 --- a/test/geometry/Basis/rotateBy.html +++ b/test/geometry/Basis/rotateBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/rotateByDegrees.html b/test/geometry/Basis/rotateByDegrees.html index 3e317ca8..d0a22cf8 100644 --- a/test/geometry/Basis/rotateByDegrees.html +++ b/test/geometry/Basis/rotateByDegrees.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/scaleBy.html b/test/geometry/Basis/scaleBy.html index 43a6340e..99d51a52 100644 --- a/test/geometry/Basis/scaleBy.html +++ b/test/geometry/Basis/scaleBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/transformBy.html b/test/geometry/Basis/transformBy.html index 5cdd07f7..e4fcfba9 100644 --- a/test/geometry/Basis/transformBy.html +++ b/test/geometry/Basis/transformBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/transitRaw.html b/test/geometry/Basis/transitRaw.html index 81dbce8b..80b91468 100644 --- a/test/geometry/Basis/transitRaw.html +++ b/test/geometry/Basis/transitRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/transitRawOuter.html b/test/geometry/Basis/transitRawOuter.html index 513e6997..6070a440 100644 --- a/test/geometry/Basis/transitRawOuter.html +++ b/test/geometry/Basis/transitRawOuter.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Basis/translateBy.html b/test/geometry/Basis/translateBy.html index 64350e1d..effc96f7 100644 --- a/test/geometry/Basis/translateBy.html +++ b/test/geometry/Basis/translateBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/almostEqual.html b/test/geometry/Box/almostEqual.html index 9defc9fb..658ed8e7 100644 --- a/test/geometry/Box/almostEqual.html +++ b/test/geometry/Box/almostEqual.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/at.html b/test/geometry/Box/at.html index a1df0f90..3b86247b 100644 --- a/test/geometry/Box/at.html +++ b/test/geometry/Box/at.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/atNorm.html b/test/geometry/Box/atNorm.html index 53a56df0..22240833 100644 --- a/test/geometry/Box/atNorm.html +++ b/test/geometry/Box/atNorm.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/changeBasis.html b/test/geometry/Box/changeBasis.html index 404f433e..622c3759 100644 --- a/test/geometry/Box/changeBasis.html +++ b/test/geometry/Box/changeBasis.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/detectCollision.html b/test/geometry/Box/detectCollision.html index 9c31b743..49174620 100644 --- a/test/geometry/Box/detectCollision.html +++ b/test/geometry/Box/detectCollision.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/equal.html b/test/geometry/Box/equal.html index f410d7c8..e74527a0 100644 --- a/test/geometry/Box/equal.html +++ b/test/geometry/Box/equal.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/fromBoxes.html b/test/geometry/Box/fromBoxes.html index ff721901..33e96e59 100644 --- a/test/geometry/Box/fromBoxes.html +++ b/test/geometry/Box/fromBoxes.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/fromPoints.html b/test/geometry/Box/fromPoints.html index 944a2018..5acde09e 100644 --- a/test/geometry/Box/fromPoints.html +++ b/test/geometry/Box/fromPoints.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/getArea.html b/test/geometry/Box/getArea.html index f5e63213..7f909c64 100644 --- a/test/geometry/Box/getArea.html +++ b/test/geometry/Box/getArea.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/getBoundingBox.html b/test/geometry/Box/getBoundingBox.html index b5aaa708..17bd2ddc 100644 --- a/test/geometry/Box/getBoundingBox.html +++ b/test/geometry/Box/getBoundingBox.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/getBoundingCircle.html b/test/geometry/Box/getBoundingCircle.html index 3665b359..3a8f86e1 100644 --- a/test/geometry/Box/getBoundingCircle.html +++ b/test/geometry/Box/getBoundingCircle.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/getBoundingSphere.html b/test/geometry/Box/getBoundingSphere.html index 37d31675..326265ec 100644 --- a/test/geometry/Box/getBoundingSphere.html +++ b/test/geometry/Box/getBoundingSphere.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/getInnerSquare.html b/test/geometry/Box/getInnerSquare.html index 40193837..cbc753f1 100644 --- a/test/geometry/Box/getInnerSquare.html +++ b/test/geometry/Box/getInnerSquare.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/getVolume.html b/test/geometry/Box/getVolume.html index fd0814e5..d7e78735 100644 --- a/test/geometry/Box/getVolume.html +++ b/test/geometry/Box/getVolume.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/normAt.html b/test/geometry/Box/normAt.html index 05e2ffe7..1e629bdf 100644 --- a/test/geometry/Box/normAt.html +++ b/test/geometry/Box/normAt.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/projectTo.html b/test/geometry/Box/projectTo.html index 0c5fe529..4dfbf12f 100644 --- a/test/geometry/Box/projectTo.html +++ b/test/geometry/Box/projectTo.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/resizeTo.html b/test/geometry/Box/resizeTo.html index b47ec508..63c75d09 100644 --- a/test/geometry/Box/resizeTo.html +++ b/test/geometry/Box/resizeTo.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/rotateBy.html b/test/geometry/Box/rotateBy.html index 10599592..a116afdf 100644 --- a/test/geometry/Box/rotateBy.html +++ b/test/geometry/Box/rotateBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/scaleBy.html b/test/geometry/Box/scaleBy.html index abc9860a..693d49ec 100644 --- a/test/geometry/Box/scaleBy.html +++ b/test/geometry/Box/scaleBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/transitRaw.html b/test/geometry/Box/transitRaw.html index d28cf5a6..80736266 100644 --- a/test/geometry/Box/transitRaw.html +++ b/test/geometry/Box/transitRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Box/translateBy.html b/test/geometry/Box/translateBy.html index 75e4b40e..7052bebb 100644 --- a/test/geometry/Box/translateBy.html +++ b/test/geometry/Box/translateBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/boundaries.html b/test/geometry/Circle/boundaries.html index 14404c75..a5e46b39 100644 --- a/test/geometry/Circle/boundaries.html +++ b/test/geometry/Circle/boundaries.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/collisions.html b/test/geometry/Circle/collisions.html index d05adbdb..e92809ec 100644 --- a/test/geometry/Circle/collisions.html +++ b/test/geometry/Circle/collisions.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/construction.html b/test/geometry/Circle/construction.html index fc200794..c3c66b94 100644 --- a/test/geometry/Circle/construction.html +++ b/test/geometry/Circle/construction.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/dimensions.html b/test/geometry/Circle/dimensions.html index a918c6ab..d3b0807e 100644 --- a/test/geometry/Circle/dimensions.html +++ b/test/geometry/Circle/dimensions.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/equality.html b/test/geometry/Circle/equality.html index aa5c7fba..84778975 100644 --- a/test/geometry/Circle/equality.html +++ b/test/geometry/Circle/equality.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/points.html b/test/geometry/Circle/points.html index 81d36861..30bea655 100644 --- a/test/geometry/Circle/points.html +++ b/test/geometry/Circle/points.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/transformations.html b/test/geometry/Circle/transformations.html index 5bd5729b..45aea9a0 100644 --- a/test/geometry/Circle/transformations.html +++ b/test/geometry/Circle/transformations.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/transitions.html b/test/geometry/Circle/transitions.html index 88663944..dfe9a879 100644 --- a/test/geometry/Circle/transitions.html +++ b/test/geometry/Circle/transitions.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Circle/translations.html b/test/geometry/Circle/translations.html index f3934402..c247d0c7 100644 --- a/test/geometry/Circle/translations.html +++ b/test/geometry/Circle/translations.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Direction/getRaw.html b/test/geometry/Direction/getRaw.html index ca85ef48..a0e3b4a6 100644 --- a/test/geometry/Direction/getRaw.html +++ b/test/geometry/Direction/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Distance/comparison.html b/test/geometry/Distance/comparison.html index b2f003fa..1f01427a 100644 --- a/test/geometry/Distance/comparison.html +++ b/test/geometry/Distance/comparison.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Distance/getRaw.html b/test/geometry/Distance/getRaw.html index e4e235af..12708241 100644 --- a/test/geometry/Distance/getRaw.html +++ b/test/geometry/Distance/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Distance/projection.html b/test/geometry/Distance/projection.html index 05770b52..202959db 100644 --- a/test/geometry/Distance/projection.html +++ b/test/geometry/Distance/projection.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Orientation/getRaw.html b/test/geometry/Orientation/getRaw.html index e3d2c030..281099c2 100644 --- a/test/geometry/Orientation/getRaw.html +++ b/test/geometry/Orientation/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Path/getRaw.html b/test/geometry/Path/getRaw.html index 1100b24b..f96b3efc 100644 --- a/test/geometry/Path/getRaw.html +++ b/test/geometry/Path/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Point/addVector.html b/test/geometry/Point/addVector.html index f49051fa..4172e35b 100644 --- a/test/geometry/Point/addVector.html +++ b/test/geometry/Point/addVector.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Point/getDistanceTo.html b/test/geometry/Point/getDistanceTo.html index 461a29f0..41b649d5 100644 --- a/test/geometry/Point/getDistanceTo.html +++ b/test/geometry/Point/getDistanceTo.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Point/getRaw.html b/test/geometry/Point/getRaw.html index b351cf6b..de29cdc4 100644 --- a/test/geometry/Point/getRaw.html +++ b/test/geometry/Point/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Point/transformBy.html b/test/geometry/Point/transformBy.html index 3d28bc02..bd9a7b58 100644 --- a/test/geometry/Point/transformBy.html +++ b/test/geometry/Point/transformBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Point/transitRawOuter.html b/test/geometry/Point/transitRawOuter.html index e8c6ebc4..30a84b55 100644 --- a/test/geometry/Point/transitRawOuter.html +++ b/test/geometry/Point/transitRawOuter.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Ray/creation.html b/test/geometry/Ray/creation.html index 10ef9cd0..bb5efa2b 100644 --- a/test/geometry/Ray/creation.html +++ b/test/geometry/Ray/creation.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Scale/changeBasis.html b/test/geometry/Scale/changeBasis.html index 3ac52b5f..4f819a36 100644 --- a/test/geometry/Scale/changeBasis.html +++ b/test/geometry/Scale/changeBasis.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Size/getRaw.html b/test/geometry/Size/getRaw.html index a88a14ad..60bf8717 100644 --- a/test/geometry/Size/getRaw.html +++ b/test/geometry/Size/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Size/scaleBy.html b/test/geometry/Size/scaleBy.html index 99179c8f..e83a5aff 100644 --- a/test/geometry/Size/scaleBy.html +++ b/test/geometry/Size/scaleBy.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/boundaries.html b/test/geometry/Sphere/boundaries.html index de6c5ab3..328e8f99 100644 --- a/test/geometry/Sphere/boundaries.html +++ b/test/geometry/Sphere/boundaries.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/collisions.html b/test/geometry/Sphere/collisions.html index 335749f0..b5486120 100644 --- a/test/geometry/Sphere/collisions.html +++ b/test/geometry/Sphere/collisions.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/construction.html b/test/geometry/Sphere/construction.html index 997eb86a..c1293ecd 100644 --- a/test/geometry/Sphere/construction.html +++ b/test/geometry/Sphere/construction.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/dimensions.html b/test/geometry/Sphere/dimensions.html index a38de9d2..86c4769c 100644 --- a/test/geometry/Sphere/dimensions.html +++ b/test/geometry/Sphere/dimensions.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/equality.html b/test/geometry/Sphere/equality.html index dd5dc84f..9ec5d1f1 100644 --- a/test/geometry/Sphere/equality.html +++ b/test/geometry/Sphere/equality.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/measures.html b/test/geometry/Sphere/measures.html index 0c8bacb9..b96a4ed1 100644 --- a/test/geometry/Sphere/measures.html +++ b/test/geometry/Sphere/measures.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/points.html b/test/geometry/Sphere/points.html index 9b56c0aa..eb1b35f6 100644 --- a/test/geometry/Sphere/points.html +++ b/test/geometry/Sphere/points.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/transformations.html b/test/geometry/Sphere/transformations.html index c327dbba..f155f55e 100644 --- a/test/geometry/Sphere/transformations.html +++ b/test/geometry/Sphere/transformations.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/transitions.html b/test/geometry/Sphere/transitions.html index 5210f3ec..21e02797 100644 --- a/test/geometry/Sphere/transitions.html +++ b/test/geometry/Sphere/transitions.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Sphere/translations.html b/test/geometry/Sphere/translations.html index 9b82a1af..8aa1ac03 100644 --- a/test/geometry/Sphere/translations.html +++ b/test/geometry/Sphere/translations.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Transform/getRaw.html b/test/geometry/Transform/getRaw.html index 27a98dd0..4619d131 100644 --- a/test/geometry/Transform/getRaw.html +++ b/test/geometry/Transform/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Vector/fromPolar.html b/test/geometry/Vector/fromPolar.html index c77ff882..0183f994 100644 --- a/test/geometry/Vector/fromPolar.html +++ b/test/geometry/Vector/fromPolar.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Vector/fromSpherical.html b/test/geometry/Vector/fromSpherical.html index de17e648..5f966084 100644 --- a/test/geometry/Vector/fromSpherical.html +++ b/test/geometry/Vector/fromSpherical.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/geometry/Vector/getRaw.html b/test/geometry/Vector/getRaw.html index 45bfa055..eb21116f 100644 --- a/test/geometry/Vector/getRaw.html +++ b/test/geometry/Vector/getRaw.html @@ -20,7 +20,7 @@ height: 600px; } - + diff --git a/test/version/index.mjs b/test/version/index.mjs index 756c68be..73105299 100644 --- a/test/version/index.mjs +++ b/test/version/index.mjs @@ -3,7 +3,7 @@ import { readFile } from 'fs/promises' import semver from 'semver' const pjson = JSON.parse( - await readFile(new URL('../../../package.json', import.meta.url)) + await readFile(new URL('../../package.json', import.meta.url)) ) export default function (test, browser) { diff --git a/test/version/version.html b/test/version/version.html index 8148ae5e..308e3896 100644 --- a/test/version/version.html +++ b/test/version/version.html @@ -3,7 +3,7 @@ version – Tapspace Test - +
From ff42646a6c0c79558a450bf341751b9bda5d634e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 22:40:22 +0200 Subject: [PATCH 089/118] improve html meta tag style --- test/components/Arc/getLength.html | 20 ++----------------- .../Component/findCommonAncestor.html | 2 +- .../Component/geometryCreation.html | 2 +- test/components/Component/prependChild.html | 2 +- test/components/Component/removeChild.html | 2 +- test/components/Component/replaceChild.html | 2 +- test/components/Component/replaceParent.html | 2 +- test/components/Component/setId.html | 2 +- test/components/Component/setParent.html | 2 +- test/components/FrameComponent/resizeTo.html | 2 +- .../FrameComponent/transformToFill.html | 2 +- .../FrameComponent/transformToFit.html | 2 +- test/components/Item/at.html | 2 +- test/components/Item/boundaries.html | 2 +- test/components/Item/createVector.html | 2 +- test/components/Item/getDistanceTo.html | 2 +- test/components/Item/getVectorTo.html | 2 +- test/components/Item/matchBasis.html | 2 +- test/components/Item/rotateBy.html | 2 +- test/components/Item/setBasis.html | 2 +- test/components/Item/setOrientation.html | 2 +- test/components/Item/setScale.html | 2 +- test/components/Item/transformBy.html | 2 +- test/components/Space/at.html | 2 +- test/components/Space/getBoundingBox.html | 2 +- test/components/Viewport/getAspectRatio.html | 2 +- test/components/Viewport/measureGroup.html | 2 +- test/geometry/Area/projectTo.html | 2 +- test/geometry/Area/transitRaw.html | 2 +- test/geometry/Basis/at.html | 2 +- test/geometry/Basis/changeBasis.html | 2 +- test/geometry/Basis/createDirection.html | 2 +- test/geometry/Basis/createVector.html | 2 +- test/geometry/Basis/getMatchedOuter.html | 2 +- test/geometry/Basis/getTransformTo.html | 2 +- test/geometry/Basis/offsets.html | 2 +- test/geometry/Basis/rotateBy.html | 2 +- test/geometry/Basis/rotateByDegrees.html | 2 +- test/geometry/Basis/scaleBy.html | 2 +- test/geometry/Basis/transformBy.html | 2 +- test/geometry/Basis/transitRaw.html | 2 +- test/geometry/Basis/transitRawOuter.html | 2 +- test/geometry/Basis/translateBy.html | 2 +- test/geometry/Box/almostEqual.html | 2 +- test/geometry/Box/at.html | 2 +- test/geometry/Box/atNorm.html | 2 +- test/geometry/Box/changeBasis.html | 2 +- test/geometry/Box/detectCollision.html | 2 +- test/geometry/Box/equal.html | 2 +- test/geometry/Box/fromBoxes.html | 2 +- test/geometry/Box/fromPoints.html | 2 +- test/geometry/Box/getArea.html | 2 +- test/geometry/Box/getBoundingBox.html | 2 +- test/geometry/Box/getBoundingCircle.html | 2 +- test/geometry/Box/getBoundingSphere.html | 2 +- test/geometry/Box/getInnerSquare.html | 2 +- test/geometry/Box/getVolume.html | 2 +- test/geometry/Box/normAt.html | 2 +- test/geometry/Box/projectTo.html | 2 +- test/geometry/Box/resizeTo.html | 2 +- test/geometry/Box/rotateBy.html | 2 +- test/geometry/Box/scaleBy.html | 2 +- test/geometry/Box/transitRaw.html | 2 +- test/geometry/Box/translateBy.html | 2 +- test/geometry/Circle/boundaries.html | 2 +- test/geometry/Circle/collisions.html | 2 +- test/geometry/Circle/construction.html | 2 +- test/geometry/Circle/dimensions.html | 2 +- test/geometry/Circle/equality.html | 2 +- test/geometry/Circle/points.html | 2 +- test/geometry/Circle/transformations.html | 2 +- test/geometry/Circle/transitions.html | 2 +- test/geometry/Circle/translations.html | 2 +- test/geometry/Direction/getRaw.html | 2 +- test/geometry/Distance/comparison.html | 2 +- test/geometry/Distance/getRaw.html | 2 +- test/geometry/Distance/projection.html | 2 +- test/geometry/Orientation/getRaw.html | 2 +- test/geometry/Path/getRaw.html | 2 +- test/geometry/Point/addVector.html | 2 +- test/geometry/Point/getDistanceTo.html | 2 +- test/geometry/Point/getRaw.html | 2 +- test/geometry/Point/transformBy.html | 2 +- test/geometry/Point/transitRawOuter.html | 2 +- test/geometry/Ray/creation.html | 2 +- test/geometry/Scale/changeBasis.html | 2 +- test/geometry/Size/getRaw.html | 2 +- test/geometry/Size/scaleBy.html | 2 +- test/geometry/Sphere/boundaries.html | 2 +- test/geometry/Sphere/collisions.html | 2 +- test/geometry/Sphere/construction.html | 2 +- test/geometry/Sphere/dimensions.html | 2 +- test/geometry/Sphere/equality.html | 2 +- test/geometry/Sphere/measures.html | 2 +- test/geometry/Sphere/points.html | 2 +- test/geometry/Sphere/transformations.html | 2 +- test/geometry/Sphere/transitions.html | 2 +- test/geometry/Sphere/translations.html | 2 +- test/geometry/Transform/getRaw.html | 2 +- test/geometry/Vector/fromPolar.html | 2 +- test/geometry/Vector/fromSpherical.html | 2 +- test/geometry/Vector/getRaw.html | 2 +- test/version/version.html | 2 +- 103 files changed, 104 insertions(+), 120 deletions(-) diff --git a/test/components/Arc/getLength.html b/test/components/Arc/getLength.html index f39abac4..8335b673 100644 --- a/test/components/Arc/getLength.html +++ b/test/components/Arc/getLength.html @@ -1,25 +1,9 @@ - + Arc:getLength – Tapspace Test - + diff --git a/test/components/Component/findCommonAncestor.html b/test/components/Component/findCommonAncestor.html index 5b92618f..495a85f5 100644 --- a/test/components/Component/findCommonAncestor.html +++ b/test/components/Component/findCommonAncestor.html @@ -1,7 +1,7 @@ - + Component:findCommonAncestor - Tapspace Test + diff --git a/test/geometry/Area/transitRaw.html b/test/geometry/Area/transitRaw.html index 1f36ffc3..2ad63a75 100644 --- a/test/geometry/Area/transitRaw.html +++ b/test/geometry/Area/transitRaw.html @@ -3,23 +3,7 @@ Area:transitRaw - Tapspace Test - + diff --git a/test/geometry/Basis/at.html b/test/geometry/Basis/at.html index 95278be9..45ba7af0 100644 --- a/test/geometry/Basis/at.html +++ b/test/geometry/Basis/at.html @@ -3,23 +3,7 @@ Basis:at - Tapspace Test - + diff --git a/test/geometry/Basis/changeBasis.html b/test/geometry/Basis/changeBasis.html index e02090df..5c1dd17a 100644 --- a/test/geometry/Basis/changeBasis.html +++ b/test/geometry/Basis/changeBasis.html @@ -3,23 +3,7 @@ Basis:changeBasis - Tapspace Test - + diff --git a/test/geometry/Basis/createDirection.html b/test/geometry/Basis/createDirection.html index 0abb7ba6..e069681b 100644 --- a/test/geometry/Basis/createDirection.html +++ b/test/geometry/Basis/createDirection.html @@ -3,23 +3,7 @@ Basis:createDirection - Tapspace Test - + diff --git a/test/geometry/Basis/createVector.html b/test/geometry/Basis/createVector.html index ede6e64b..7edbdd46 100644 --- a/test/geometry/Basis/createVector.html +++ b/test/geometry/Basis/createVector.html @@ -3,23 +3,7 @@ Basis:createVector - Tapspace Test - + diff --git a/test/geometry/Basis/getMatchedOuter.html b/test/geometry/Basis/getMatchedOuter.html index d398605d..cfafded5 100644 --- a/test/geometry/Basis/getMatchedOuter.html +++ b/test/geometry/Basis/getMatchedOuter.html @@ -3,23 +3,7 @@ Basis:getMatchedOuter - Tapspace Test - + diff --git a/test/geometry/Basis/getTransformTo.html b/test/geometry/Basis/getTransformTo.html index 5a6a11cc..a30c5df9 100644 --- a/test/geometry/Basis/getTransformTo.html +++ b/test/geometry/Basis/getTransformTo.html @@ -3,23 +3,7 @@ Basis:getTransformTo - Tapspace Test - + diff --git a/test/geometry/Basis/offsets.html b/test/geometry/Basis/offsets.html index 4847293a..a9b41be3 100644 --- a/test/geometry/Basis/offsets.html +++ b/test/geometry/Basis/offsets.html @@ -3,23 +3,7 @@ Basis offsets - Tapspace Test - + diff --git a/test/geometry/Basis/rotateBy.html b/test/geometry/Basis/rotateBy.html index 26487c2b..3b1ada06 100644 --- a/test/geometry/Basis/rotateBy.html +++ b/test/geometry/Basis/rotateBy.html @@ -3,23 +3,7 @@ Basis:rotateBy - Tapspace Test - + diff --git a/test/geometry/Basis/rotateByDegrees.html b/test/geometry/Basis/rotateByDegrees.html index e127608e..5c25316a 100644 --- a/test/geometry/Basis/rotateByDegrees.html +++ b/test/geometry/Basis/rotateByDegrees.html @@ -3,23 +3,7 @@ Basis:rotateByDegrees - Tapspace Test - + diff --git a/test/geometry/Basis/scaleBy.html b/test/geometry/Basis/scaleBy.html index d65f03d4..91bef4f1 100644 --- a/test/geometry/Basis/scaleBy.html +++ b/test/geometry/Basis/scaleBy.html @@ -3,23 +3,7 @@ Basis:scaleBy - Tapspace Test - + diff --git a/test/geometry/Basis/transformBy.html b/test/geometry/Basis/transformBy.html index 071ddd71..4f3747ed 100644 --- a/test/geometry/Basis/transformBy.html +++ b/test/geometry/Basis/transformBy.html @@ -3,23 +3,7 @@ Basis:transformBy - Tapspace Test - + diff --git a/test/geometry/Basis/transitRaw.html b/test/geometry/Basis/transitRaw.html index 9dc41390..20787036 100644 --- a/test/geometry/Basis/transitRaw.html +++ b/test/geometry/Basis/transitRaw.html @@ -3,23 +3,7 @@ Basis:transitRaw - Tapspace Test - + diff --git a/test/geometry/Basis/transitRawOuter.html b/test/geometry/Basis/transitRawOuter.html index 46e8e2ec..e9c10635 100644 --- a/test/geometry/Basis/transitRawOuter.html +++ b/test/geometry/Basis/transitRawOuter.html @@ -3,23 +3,7 @@ Basis:transitRawOuter - Tapspace Test - + diff --git a/test/geometry/Basis/translateBy.html b/test/geometry/Basis/translateBy.html index c51bbbc9..eb46d579 100644 --- a/test/geometry/Basis/translateBy.html +++ b/test/geometry/Basis/translateBy.html @@ -3,23 +3,7 @@ Basis:translateBy - Tapspace Test - + diff --git a/test/geometry/Box/almostEqual.html b/test/geometry/Box/almostEqual.html index 542167c6..6592d809 100644 --- a/test/geometry/Box/almostEqual.html +++ b/test/geometry/Box/almostEqual.html @@ -3,23 +3,7 @@ Box:almostEqual - Tapspace Test - + diff --git a/test/geometry/Box/at.html b/test/geometry/Box/at.html index a42de206..ae1330ce 100644 --- a/test/geometry/Box/at.html +++ b/test/geometry/Box/at.html @@ -3,23 +3,7 @@ Box:at - Tapspace Test - + diff --git a/test/geometry/Box/atNorm.html b/test/geometry/Box/atNorm.html index 81d5b6b3..5d002337 100644 --- a/test/geometry/Box/atNorm.html +++ b/test/geometry/Box/atNorm.html @@ -3,23 +3,7 @@ Box:atNorm - Tapspace Test - + diff --git a/test/geometry/Box/changeBasis.html b/test/geometry/Box/changeBasis.html index 57367978..ca9073c9 100644 --- a/test/geometry/Box/changeBasis.html +++ b/test/geometry/Box/changeBasis.html @@ -3,23 +3,7 @@ Box:changeBasis - Tapspace Test - + diff --git a/test/geometry/Box/detectCollision.html b/test/geometry/Box/detectCollision.html index 1402912e..c5ba00f6 100644 --- a/test/geometry/Box/detectCollision.html +++ b/test/geometry/Box/detectCollision.html @@ -3,23 +3,7 @@ Box:detectCollision - Tapspace Test - + diff --git a/test/geometry/Box/equal.html b/test/geometry/Box/equal.html index 441f4f8b..b3e9e286 100644 --- a/test/geometry/Box/equal.html +++ b/test/geometry/Box/equal.html @@ -3,23 +3,7 @@ Box:equal - Tapspace Test - + diff --git a/test/geometry/Box/fromBoxes.html b/test/geometry/Box/fromBoxes.html index ee420607..8e828c67 100644 --- a/test/geometry/Box/fromBoxes.html +++ b/test/geometry/Box/fromBoxes.html @@ -3,23 +3,7 @@ Box:fromBoxes - Tapspace Test - + diff --git a/test/geometry/Box/fromPoints.html b/test/geometry/Box/fromPoints.html index 86ca5844..92cef78b 100644 --- a/test/geometry/Box/fromPoints.html +++ b/test/geometry/Box/fromPoints.html @@ -3,23 +3,7 @@ Box:fromPoints - Tapspace Test - + diff --git a/test/geometry/Box/getArea.html b/test/geometry/Box/getArea.html index 564184d3..f920ff13 100644 --- a/test/geometry/Box/getArea.html +++ b/test/geometry/Box/getArea.html @@ -3,23 +3,7 @@ Box:getArea - Tapspace Test - + diff --git a/test/geometry/Box/getBoundingBox.html b/test/geometry/Box/getBoundingBox.html index ae0c1d83..17b32fc7 100644 --- a/test/geometry/Box/getBoundingBox.html +++ b/test/geometry/Box/getBoundingBox.html @@ -3,23 +3,7 @@ Box:getBoundingBox - Tapspace Test - + diff --git a/test/geometry/Box/getBoundingCircle.html b/test/geometry/Box/getBoundingCircle.html index ce8d3ac3..18b186fa 100644 --- a/test/geometry/Box/getBoundingCircle.html +++ b/test/geometry/Box/getBoundingCircle.html @@ -3,23 +3,7 @@ Box:getBoundingCircle - Tapspace Test - + diff --git a/test/geometry/Box/getBoundingSphere.html b/test/geometry/Box/getBoundingSphere.html index 611a2b65..df6fd799 100644 --- a/test/geometry/Box/getBoundingSphere.html +++ b/test/geometry/Box/getBoundingSphere.html @@ -3,23 +3,7 @@ Box:getBoundingSphere - Tapspace Test - + diff --git a/test/geometry/Box/getInnerSquare.html b/test/geometry/Box/getInnerSquare.html index 66ba3f1c..abd24627 100644 --- a/test/geometry/Box/getInnerSquare.html +++ b/test/geometry/Box/getInnerSquare.html @@ -3,23 +3,7 @@ Box:getInnerSquare - Tapspace Test - + diff --git a/test/geometry/Box/getVolume.html b/test/geometry/Box/getVolume.html index d720760f..551733ee 100644 --- a/test/geometry/Box/getVolume.html +++ b/test/geometry/Box/getVolume.html @@ -3,23 +3,7 @@ Box:getVolume - Tapspace Test - + diff --git a/test/geometry/Box/normAt.html b/test/geometry/Box/normAt.html index be983cf2..8ac46bbd 100644 --- a/test/geometry/Box/normAt.html +++ b/test/geometry/Box/normAt.html @@ -3,23 +3,7 @@ Box:normAt - Tapspace Test - + diff --git a/test/geometry/Box/projectTo.html b/test/geometry/Box/projectTo.html index 3e088beb..e3655e32 100644 --- a/test/geometry/Box/projectTo.html +++ b/test/geometry/Box/projectTo.html @@ -3,23 +3,7 @@ Box:projectTo - Tapspace Test - + diff --git a/test/geometry/Box/resizeTo.html b/test/geometry/Box/resizeTo.html index 585ad50c..5438792e 100644 --- a/test/geometry/Box/resizeTo.html +++ b/test/geometry/Box/resizeTo.html @@ -3,23 +3,7 @@ Box:resizeTo - Tapspace Test - + diff --git a/test/geometry/Box/rotateBy.html b/test/geometry/Box/rotateBy.html index a8aaaebf..abbfa433 100644 --- a/test/geometry/Box/rotateBy.html +++ b/test/geometry/Box/rotateBy.html @@ -3,23 +3,7 @@ Box:rotateBy - Tapspace Test - + diff --git a/test/geometry/Box/scaleBy.html b/test/geometry/Box/scaleBy.html index f63eb210..bb97fcd8 100644 --- a/test/geometry/Box/scaleBy.html +++ b/test/geometry/Box/scaleBy.html @@ -3,23 +3,7 @@ Box:scaleBy - Tapspace Test - + diff --git a/test/geometry/Box/transitRaw.html b/test/geometry/Box/transitRaw.html index b949a67c..224ff3bd 100644 --- a/test/geometry/Box/transitRaw.html +++ b/test/geometry/Box/transitRaw.html @@ -3,23 +3,7 @@ Box:transitRaw - Tapspace Test - + diff --git a/test/geometry/Box/translateBy.html b/test/geometry/Box/translateBy.html index 77959b1c..fcbe66b8 100644 --- a/test/geometry/Box/translateBy.html +++ b/test/geometry/Box/translateBy.html @@ -3,23 +3,7 @@ Box:translateBy - Tapspace Test - + diff --git a/test/geometry/Circle/boundaries.html b/test/geometry/Circle/boundaries.html index cbb1ea14..68fcce58 100644 --- a/test/geometry/Circle/boundaries.html +++ b/test/geometry/Circle/boundaries.html @@ -3,23 +3,7 @@ Circle boundaries - Tapspace Test - + diff --git a/test/geometry/Circle/collisions.html b/test/geometry/Circle/collisions.html index e5f9738f..a22f2485 100644 --- a/test/geometry/Circle/collisions.html +++ b/test/geometry/Circle/collisions.html @@ -3,23 +3,7 @@ Circle collisions - Tapspace Test - + diff --git a/test/geometry/Circle/construction.html b/test/geometry/Circle/construction.html index db5c7102..83019105 100644 --- a/test/geometry/Circle/construction.html +++ b/test/geometry/Circle/construction.html @@ -3,23 +3,7 @@ Circle construction - Tapspace Test - + diff --git a/test/geometry/Circle/dimensions.html b/test/geometry/Circle/dimensions.html index b86119ad..64e88989 100644 --- a/test/geometry/Circle/dimensions.html +++ b/test/geometry/Circle/dimensions.html @@ -3,23 +3,7 @@ Circle dimensions - Tapspace Test - + diff --git a/test/geometry/Circle/equality.html b/test/geometry/Circle/equality.html index 8ef93004..06e7ff5b 100644 --- a/test/geometry/Circle/equality.html +++ b/test/geometry/Circle/equality.html @@ -3,23 +3,7 @@ Circle equality - Tapspace Test - + diff --git a/test/geometry/Circle/points.html b/test/geometry/Circle/points.html index 40283d5f..ecf34c7c 100644 --- a/test/geometry/Circle/points.html +++ b/test/geometry/Circle/points.html @@ -3,23 +3,7 @@ Circle points - Tapspace Test - + diff --git a/test/geometry/Circle/transformations.html b/test/geometry/Circle/transformations.html index 7a0d7895..78d36ef7 100644 --- a/test/geometry/Circle/transformations.html +++ b/test/geometry/Circle/transformations.html @@ -3,23 +3,7 @@ Circle transformations - Tapspace Test - + diff --git a/test/geometry/Circle/transitions.html b/test/geometry/Circle/transitions.html index bc2a0ee2..a3cf4e26 100644 --- a/test/geometry/Circle/transitions.html +++ b/test/geometry/Circle/transitions.html @@ -3,23 +3,7 @@ Circle transitions - Tapspace Test - + diff --git a/test/geometry/Circle/translations.html b/test/geometry/Circle/translations.html index e362bf55..99ea1894 100644 --- a/test/geometry/Circle/translations.html +++ b/test/geometry/Circle/translations.html @@ -3,23 +3,7 @@ Circle translations - Tapspace Test - + diff --git a/test/geometry/Direction/getRaw.html b/test/geometry/Direction/getRaw.html index 0710e443..e2c75850 100644 --- a/test/geometry/Direction/getRaw.html +++ b/test/geometry/Direction/getRaw.html @@ -3,23 +3,7 @@ Direction :getRaw - Tapspace Test - + diff --git a/test/geometry/Distance/comparison.html b/test/geometry/Distance/comparison.html index ed0f77a5..625f96f7 100644 --- a/test/geometry/Distance/comparison.html +++ b/test/geometry/Distance/comparison.html @@ -3,23 +3,7 @@ Distance comparison - Tapspace Test - + diff --git a/test/geometry/Distance/getRaw.html b/test/geometry/Distance/getRaw.html index 0eaa7484..4ad41508 100644 --- a/test/geometry/Distance/getRaw.html +++ b/test/geometry/Distance/getRaw.html @@ -3,23 +3,7 @@ Distance :getRaw - Tapspace Test - + diff --git a/test/geometry/Distance/projection.html b/test/geometry/Distance/projection.html index 7f2f912f..d9b6257b 100644 --- a/test/geometry/Distance/projection.html +++ b/test/geometry/Distance/projection.html @@ -3,23 +3,7 @@ Distance projection - Tapspace Test - + diff --git a/test/geometry/Orientation/getRaw.html b/test/geometry/Orientation/getRaw.html index 4deefa31..71971da7 100644 --- a/test/geometry/Orientation/getRaw.html +++ b/test/geometry/Orientation/getRaw.html @@ -3,23 +3,7 @@ Orientation :getRaw - Tapspace Test - + diff --git a/test/geometry/Path/getRaw.html b/test/geometry/Path/getRaw.html index 0e7c34f7..ecd6fa9b 100644 --- a/test/geometry/Path/getRaw.html +++ b/test/geometry/Path/getRaw.html @@ -3,23 +3,7 @@ Path :getRaw - Tapspace Test - + diff --git a/test/geometry/Point/addVector.html b/test/geometry/Point/addVector.html index 1414e520..3361b574 100644 --- a/test/geometry/Point/addVector.html +++ b/test/geometry/Point/addVector.html @@ -3,23 +3,7 @@ Point:addVector - Tapspace Test - + diff --git a/test/geometry/Point/getDistanceTo.html b/test/geometry/Point/getDistanceTo.html index 6e435739..7e440979 100644 --- a/test/geometry/Point/getDistanceTo.html +++ b/test/geometry/Point/getDistanceTo.html @@ -3,23 +3,7 @@ Point:getDistanceTo - Tapspace Test - + diff --git a/test/geometry/Point/getRaw.html b/test/geometry/Point/getRaw.html index 5a794eb4..6bde0296 100644 --- a/test/geometry/Point/getRaw.html +++ b/test/geometry/Point/getRaw.html @@ -3,23 +3,7 @@ Point:getRaw - Tapspace Test - + diff --git a/test/geometry/Point/transformBy.html b/test/geometry/Point/transformBy.html index 80558a20..7e3bbc9b 100644 --- a/test/geometry/Point/transformBy.html +++ b/test/geometry/Point/transformBy.html @@ -3,23 +3,7 @@ Point:transformBy - Tapspace Test - + diff --git a/test/geometry/Point/transitRawOuter.html b/test/geometry/Point/transitRawOuter.html index 21ec1e73..430a980e 100644 --- a/test/geometry/Point/transitRawOuter.html +++ b/test/geometry/Point/transitRawOuter.html @@ -3,23 +3,7 @@ Point:transitRawOuter - Tapspace Test - + diff --git a/test/geometry/Ray/creation.html b/test/geometry/Ray/creation.html index 78d1192d..8ec517e4 100644 --- a/test/geometry/Ray/creation.html +++ b/test/geometry/Ray/creation.html @@ -3,23 +3,7 @@ Ray creation - Tapspace Test - + diff --git a/test/geometry/Scale/changeBasis.html b/test/geometry/Scale/changeBasis.html index 0cf5da62..25a98008 100644 --- a/test/geometry/Scale/changeBasis.html +++ b/test/geometry/Scale/changeBasis.html @@ -3,23 +3,7 @@ Scale:changeBasis - Tapspace Test - + diff --git a/test/geometry/Size/getRaw.html b/test/geometry/Size/getRaw.html index 05e9077f..44d350f3 100644 --- a/test/geometry/Size/getRaw.html +++ b/test/geometry/Size/getRaw.html @@ -3,23 +3,7 @@ Size:getRaw - Tapspace Test - + diff --git a/test/geometry/Size/scaleBy.html b/test/geometry/Size/scaleBy.html index c75a0a2c..740ad65a 100644 --- a/test/geometry/Size/scaleBy.html +++ b/test/geometry/Size/scaleBy.html @@ -3,23 +3,7 @@ Size:scaleBy - Tapspace Test - + diff --git a/test/geometry/Sphere/boundaries.html b/test/geometry/Sphere/boundaries.html index d7b1bb28..1cf6c981 100644 --- a/test/geometry/Sphere/boundaries.html +++ b/test/geometry/Sphere/boundaries.html @@ -3,23 +3,7 @@ Sphere boundaries - Tapspace Test - + diff --git a/test/geometry/Sphere/collisions.html b/test/geometry/Sphere/collisions.html index 815f7f91..feada4a8 100644 --- a/test/geometry/Sphere/collisions.html +++ b/test/geometry/Sphere/collisions.html @@ -3,23 +3,7 @@ Sphere collisions - Tapspace Test - + diff --git a/test/geometry/Sphere/construction.html b/test/geometry/Sphere/construction.html index 937f31c9..95cbba74 100644 --- a/test/geometry/Sphere/construction.html +++ b/test/geometry/Sphere/construction.html @@ -3,23 +3,7 @@ Sphere construction - Tapspace Test - + diff --git a/test/geometry/Sphere/dimensions.html b/test/geometry/Sphere/dimensions.html index 7d4416c6..98e830d1 100644 --- a/test/geometry/Sphere/dimensions.html +++ b/test/geometry/Sphere/dimensions.html @@ -3,23 +3,7 @@ Sphere dimensions - Tapspace Test - + diff --git a/test/geometry/Sphere/equality.html b/test/geometry/Sphere/equality.html index db230444..022a279f 100644 --- a/test/geometry/Sphere/equality.html +++ b/test/geometry/Sphere/equality.html @@ -3,23 +3,7 @@ Sphere equality - Tapspace Test - + diff --git a/test/geometry/Sphere/measures.html b/test/geometry/Sphere/measures.html index d3bf913d..3cf9c16f 100644 --- a/test/geometry/Sphere/measures.html +++ b/test/geometry/Sphere/measures.html @@ -3,23 +3,7 @@ Sphere measures - Tapspace Test - + diff --git a/test/geometry/Sphere/points.html b/test/geometry/Sphere/points.html index 2dc7b2de..b1300b88 100644 --- a/test/geometry/Sphere/points.html +++ b/test/geometry/Sphere/points.html @@ -3,23 +3,7 @@ Sphere points - Tapspace Test - + diff --git a/test/geometry/Sphere/transformations.html b/test/geometry/Sphere/transformations.html index 2ac01d6e..3ff9b5d1 100644 --- a/test/geometry/Sphere/transformations.html +++ b/test/geometry/Sphere/transformations.html @@ -3,23 +3,7 @@ Sphere transformations - Tapspace Test - + diff --git a/test/geometry/Sphere/transitions.html b/test/geometry/Sphere/transitions.html index eb8cb3e3..a89cbf09 100644 --- a/test/geometry/Sphere/transitions.html +++ b/test/geometry/Sphere/transitions.html @@ -3,23 +3,7 @@ Sphere transitions - Tapspace Test - + diff --git a/test/geometry/Sphere/translations.html b/test/geometry/Sphere/translations.html index e8d9befa..1bcf35a6 100644 --- a/test/geometry/Sphere/translations.html +++ b/test/geometry/Sphere/translations.html @@ -3,23 +3,7 @@ Sphere translations - Tapspace Test - + diff --git a/test/geometry/Transform/getRaw.html b/test/geometry/Transform/getRaw.html index 8a057d7b..da6f7fe6 100644 --- a/test/geometry/Transform/getRaw.html +++ b/test/geometry/Transform/getRaw.html @@ -3,23 +3,7 @@ Transform:getRaw - Tapspace Test - + diff --git a/test/geometry/Vector/fromPolar.html b/test/geometry/Vector/fromPolar.html index 1907f31d..bf0bbd01 100644 --- a/test/geometry/Vector/fromPolar.html +++ b/test/geometry/Vector/fromPolar.html @@ -3,23 +3,7 @@ Vector:fromPolar - Tapspace Test - + diff --git a/test/geometry/Vector/fromSpherical.html b/test/geometry/Vector/fromSpherical.html index b4faef57..bb139188 100644 --- a/test/geometry/Vector/fromSpherical.html +++ b/test/geometry/Vector/fromSpherical.html @@ -3,23 +3,7 @@ Vector:fromSpherical - Tapspace Test - + diff --git a/test/geometry/Vector/getRaw.html b/test/geometry/Vector/getRaw.html index acd9b286..5dee3ef7 100644 --- a/test/geometry/Vector/getRaw.html +++ b/test/geometry/Vector/getRaw.html @@ -3,23 +3,7 @@ Vector:getRaw - Tapspace Test - + diff --git a/test/geometry/default.css b/test/geometry/default.css new file mode 100644 index 00000000..e004d95e --- /dev/null +++ b/test/geometry/default.css @@ -0,0 +1,17 @@ +html, body { + margin: 0; + padding: 0; + width: 100%; + height: 100%; +} + +#container { + background: gray; + width: 100%; + height: 100%; +} + +#testspace { + width: 800px; + height: 600px; +} From 053961890f4b248d013e752977f5214367f15d7d Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 23:04:24 +0200 Subject: [PATCH 091/118] reuse default stylesheet in Arc, Component, Space --- .../Component/findCommonAncestor.html | 18 +----------------- .../components/Component/geometryCreation.html | 18 +----------------- test/components/Component/prependChild.html | 18 +----------------- test/components/Component/removeChild.html | 18 +----------------- test/components/Component/replaceChild.html | 18 +----------------- test/components/Component/replaceParent.html | 18 +----------------- test/components/Component/setId.html | 18 +----------------- test/components/Component/setParent.html | 18 +----------------- test/components/Space/at.html | 18 +----------------- test/components/Space/getBoundingBox.html | 18 +----------------- test/components/default.css | 17 +++++++++++++++++ 11 files changed, 27 insertions(+), 170 deletions(-) create mode 100644 test/components/default.css diff --git a/test/components/Component/findCommonAncestor.html b/test/components/Component/findCommonAncestor.html index 495a85f5..498f7264 100644 --- a/test/components/Component/findCommonAncestor.html +++ b/test/components/Component/findCommonAncestor.html @@ -3,23 +3,7 @@ Component:findCommonAncestor - Tapspace Test - + diff --git a/test/components/Component/geometryCreation.html b/test/components/Component/geometryCreation.html index 113681c4..fea39151 100644 --- a/test/components/Component/geometryCreation.html +++ b/test/components/Component/geometryCreation.html @@ -3,23 +3,7 @@ Component geometry creation - Tapspace Test - + diff --git a/test/components/Component/prependChild.html b/test/components/Component/prependChild.html index 095e288c..cb368d5b 100644 --- a/test/components/Component/prependChild.html +++ b/test/components/Component/prependChild.html @@ -3,23 +3,7 @@ Component:prependChild - Tapspace Test - + diff --git a/test/components/Component/removeChild.html b/test/components/Component/removeChild.html index 71b37087..f9bff47d 100644 --- a/test/components/Component/removeChild.html +++ b/test/components/Component/removeChild.html @@ -3,23 +3,7 @@ Component:removeChild - Tapspace Test - + diff --git a/test/components/Component/replaceChild.html b/test/components/Component/replaceChild.html index 28093b1c..e4fa822f 100644 --- a/test/components/Component/replaceChild.html +++ b/test/components/Component/replaceChild.html @@ -3,23 +3,7 @@ Component:replaceChild - Tapspace Test - + diff --git a/test/components/Component/replaceParent.html b/test/components/Component/replaceParent.html index 71bf4570..11967e44 100644 --- a/test/components/Component/replaceParent.html +++ b/test/components/Component/replaceParent.html @@ -3,23 +3,7 @@ Component:replaceParent - Tapspace Test - + diff --git a/test/components/Component/setId.html b/test/components/Component/setId.html index a186f47e..b7d67754 100644 --- a/test/components/Component/setId.html +++ b/test/components/Component/setId.html @@ -3,23 +3,7 @@ Component:setId - Tapspace Test - + diff --git a/test/components/Component/setParent.html b/test/components/Component/setParent.html index 0e0a8609..8abb85a5 100644 --- a/test/components/Component/setParent.html +++ b/test/components/Component/setParent.html @@ -3,23 +3,7 @@ Component:setParent - Tapspace Test - + diff --git a/test/components/Space/at.html b/test/components/Space/at.html index 64720e35..76b94430 100644 --- a/test/components/Space/at.html +++ b/test/components/Space/at.html @@ -3,23 +3,7 @@ Space:at – Tapspace Test - + diff --git a/test/components/Space/getBoundingBox.html b/test/components/Space/getBoundingBox.html index 80245034..8a9dcc08 100644 --- a/test/components/Space/getBoundingBox.html +++ b/test/components/Space/getBoundingBox.html @@ -3,23 +3,7 @@ Space:getBoundingBox – Tapspace Test - + diff --git a/test/components/default.css b/test/components/default.css new file mode 100644 index 00000000..8adfa0b7 --- /dev/null +++ b/test/components/default.css @@ -0,0 +1,17 @@ +html, body { + margin: 0; + padding: 0; + width: 100%; + height: 100%; +} + +#container { + background: gray; + width: 100%; + height: 100%; +} + +#testspace { + width: 800px; + height: 500px; +} From 7c97b9bda13d2034f55e8780862a284fbd05ad38 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 23:11:18 +0200 Subject: [PATCH 092/118] reuse default stylesheet in Frame, Item --- test/components/FrameComponent/resizeTo.html | 18 +----------------- .../FrameComponent/transformToFill.html | 18 +----------------- .../FrameComponent/transformToFit.html | 18 +----------------- test/components/Item/at.html | 18 +----------------- test/components/Item/boundaries.html | 18 +----------------- test/components/Item/createVector.html | 18 +----------------- test/components/Item/getDistanceTo.html | 18 +----------------- test/components/Item/getVectorTo.html | 18 +----------------- test/components/Item/matchBasis.html | 18 +----------------- test/components/Item/rotateBy.html | 18 +----------------- test/components/Item/setBasis.html | 18 +----------------- test/components/Item/setOrientation.html | 18 +----------------- test/components/Item/setScale.html | 18 +----------------- test/components/Item/transformBy.html | 18 +----------------- 14 files changed, 14 insertions(+), 238 deletions(-) diff --git a/test/components/FrameComponent/resizeTo.html b/test/components/FrameComponent/resizeTo.html index 44ac6ee1..95179256 100644 --- a/test/components/FrameComponent/resizeTo.html +++ b/test/components/FrameComponent/resizeTo.html @@ -3,23 +3,7 @@ FrameComponent:resizeTo - Tapspace Test - + diff --git a/test/components/FrameComponent/transformToFill.html b/test/components/FrameComponent/transformToFill.html index db6ab78c..3667ea1d 100644 --- a/test/components/FrameComponent/transformToFill.html +++ b/test/components/FrameComponent/transformToFill.html @@ -3,23 +3,7 @@ FrameComponent:transformToFill - Tapspace Test - + diff --git a/test/components/FrameComponent/transformToFit.html b/test/components/FrameComponent/transformToFit.html index 0c904217..230c205f 100644 --- a/test/components/FrameComponent/transformToFit.html +++ b/test/components/FrameComponent/transformToFit.html @@ -3,23 +3,7 @@ FrameComponent:transformToFit - Tapspace Test - + diff --git a/test/components/Item/at.html b/test/components/Item/at.html index 6e16909c..006bdad0 100644 --- a/test/components/Item/at.html +++ b/test/components/Item/at.html @@ -3,23 +3,7 @@ Item:at - Tapspace Test - + diff --git a/test/components/Item/boundaries.html b/test/components/Item/boundaries.html index 1b50933b..c9091df7 100644 --- a/test/components/Item/boundaries.html +++ b/test/components/Item/boundaries.html @@ -3,23 +3,7 @@ Item boundaries - Tapspace Test - + diff --git a/test/components/Item/createVector.html b/test/components/Item/createVector.html index 048b2818..cd094805 100644 --- a/test/components/Item/createVector.html +++ b/test/components/Item/createVector.html @@ -3,23 +3,7 @@ Item:createVector - Tapspace Test - + diff --git a/test/components/Item/getDistanceTo.html b/test/components/Item/getDistanceTo.html index 9da37ce3..4512182d 100644 --- a/test/components/Item/getDistanceTo.html +++ b/test/components/Item/getDistanceTo.html @@ -3,23 +3,7 @@ Item:getDistanceTo - Tapspace Test - + diff --git a/test/components/Item/getVectorTo.html b/test/components/Item/getVectorTo.html index 78a188cf..f05ab0e3 100644 --- a/test/components/Item/getVectorTo.html +++ b/test/components/Item/getVectorTo.html @@ -3,23 +3,7 @@ Item:getVectorTo - Tapspace Test - + diff --git a/test/components/Item/matchBasis.html b/test/components/Item/matchBasis.html index 226f51ae..2152e0da 100644 --- a/test/components/Item/matchBasis.html +++ b/test/components/Item/matchBasis.html @@ -3,23 +3,7 @@ Item:matchBasis - Tapspace Test - + diff --git a/test/components/Item/rotateBy.html b/test/components/Item/rotateBy.html index a3c0955e..aed9b812 100644 --- a/test/components/Item/rotateBy.html +++ b/test/components/Item/rotateBy.html @@ -3,23 +3,7 @@ Item:rotateBy - Tapspace Test - + diff --git a/test/components/Item/setBasis.html b/test/components/Item/setBasis.html index ff112d71..0aacc7b2 100644 --- a/test/components/Item/setBasis.html +++ b/test/components/Item/setBasis.html @@ -3,23 +3,7 @@ Item:setBasis - Tapspace Test - + diff --git a/test/components/Item/setOrientation.html b/test/components/Item/setOrientation.html index d1e8b310..133c910c 100644 --- a/test/components/Item/setOrientation.html +++ b/test/components/Item/setOrientation.html @@ -3,23 +3,7 @@ Item:setOrientation - Tapspace Test - + diff --git a/test/components/Item/setScale.html b/test/components/Item/setScale.html index b89ab844..8728bf13 100644 --- a/test/components/Item/setScale.html +++ b/test/components/Item/setScale.html @@ -3,23 +3,7 @@ Item:setScale - Tapspace Test - + diff --git a/test/components/Item/transformBy.html b/test/components/Item/transformBy.html index c9c70f27..9c16c4f8 100644 --- a/test/components/Item/transformBy.html +++ b/test/components/Item/transformBy.html @@ -3,23 +3,7 @@ Item:transformBy - Tapspace Test - + From 81b63ecba4df74f9d33019957a4a8cd3b68e6da9 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 23:31:15 +0200 Subject: [PATCH 093/118] log test suite runtime --- test/run.mjs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/run.mjs b/test/run.mjs index 7bef6978..e700150d 100644 --- a/test/run.mjs +++ b/test/run.mjs @@ -27,10 +27,12 @@ const browser = await puppeteer.launch() // const browser = await puppeteer.launch({ headless: false }) // Run tests +console.time('# runtime') testSuite(test, browser) // Exit after all tests completed, success or not. // It is important to keep the browser open until that. test.onFinish(async () => { await browser.close() + console.timeEnd('# runtime') }) From dc1e2de9878f3844c3d2cf51e4a07d92733de321 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Thu, 16 Jan 2025 23:31:41 +0200 Subject: [PATCH 094/118] use smaller viewport in headless tests --- test/components/Viewport/getAspectRatio.html | 24 ++++---------------- test/components/Viewport/measureGroup.html | 18 +-------------- test/components/default.css | 4 ++-- test/geometry/default.css | 4 ++-- test/utils.mjs | 2 +- 5 files changed, 11 insertions(+), 41 deletions(-) diff --git a/test/components/Viewport/getAspectRatio.html b/test/components/Viewport/getAspectRatio.html index 8461691e..f0ba8788 100644 --- a/test/components/Viewport/getAspectRatio.html +++ b/test/components/Viewport/getAspectRatio.html @@ -3,23 +3,7 @@ Viewport:getAspectRatio – Tapspace Test - + @@ -28,13 +12,15 @@
diff --git a/test/components/Viewport/measureGroup.html b/test/components/Viewport/measureGroup.html index 8d851baf..400e58f4 100644 --- a/test/components/Viewport/measureGroup.html +++ b/test/components/Viewport/measureGroup.html @@ -3,23 +3,7 @@ Viewport:measureGroup – Tapspace Test - + diff --git a/test/components/default.css b/test/components/default.css index 8adfa0b7..91b74935 100644 --- a/test/components/default.css +++ b/test/components/default.css @@ -12,6 +12,6 @@ html, body { } #testspace { - width: 800px; - height: 500px; + width: 640px; + height: 480px; } diff --git a/test/geometry/default.css b/test/geometry/default.css index e004d95e..91b74935 100644 --- a/test/geometry/default.css +++ b/test/geometry/default.css @@ -12,6 +12,6 @@ html, body { } #testspace { - width: 800px; - height: 600px; + width: 640px; + height: 480px; } diff --git a/test/utils.mjs b/test/utils.mjs index d07a858a..ce513836 100644 --- a/test/utils.mjs +++ b/test/utils.mjs @@ -22,7 +22,7 @@ export const makeTestAllOk = (test, browser) => { // Setup const pageUrl = getFileUrl(dirname, filename) const page = await browser.newPage() - await page.setViewport({ width: 1000, height: 500 }) + await page.setViewport({ width: 800, height: 500 }) await page.goto(pageUrl, { waitUntil: 'domcontentloaded' }) // Wait max 5 sec for an async test to finish. From 6f941a03c596d4253e787a50407b349fc0f93f58 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 00:13:50 +0200 Subject: [PATCH 095/118] remove deprecated dev dependencies --- package.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/package.json b/package.json index b3c13b77..1eec2cab 100644 --- a/package.json +++ b/package.json @@ -40,23 +40,18 @@ "devDependencies": { "async": "^3.2.6", "css-loader": "^7.1.2", - "ejs-loader": "^0.5.0", "finalhandler": "^1.3.1", "genversion": "^3.2.0", - "path-browserify": "^1.0.1", - "process": "^0.11.10", "puppeteer": "^23.10.2", "qrcode-terminal": "^0.12.0", "semver": "^7.6.3", "serve-index": "^1.9.1", "serve-static": "^1.16.2", "standard": "^17.1.2", - "stream-browserify": "^3.0.0", "style-loader": "^4.0.0", "tape": "^5.9.0", "webpack": "^5.97.1", "webpack-cli": "^5.1.4", - "webpack-livereload-plugin": "^3.0.2", "yamdog": "^2.1.0" }, "scripts": { From ab443f2a294ae3daa569e9c72b16ee512894c6e0 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 00:14:07 +0200 Subject: [PATCH 096/118] update test suite documentation --- docs/dev/index.md | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/docs/dev/index.md b/docs/dev/index.md index 79bb7c0c..32fcb5cb 100644 --- a/docs/dev/index.md +++ b/docs/dev/index.md @@ -67,7 +67,7 @@ To repeat the build every time you make a change, use `npm run build:watch` inst ## Building -Tapspace is a package and thus needs to be packed with a build tool. Tapspace uses [webpack](https://webpack.js.org/) for this. We have separate builds for testing and production purposes. Each build has a script in package.json. The builds output files into `dist/` directory, standalone bundle at `dist/tapspace.min.js` and source maps at `dist/tapspace.min.js.map`. +Tapspace.js is a package and thus needs to be packed with a build tool. Tapspace uses [webpack](https://webpack.js.org/) for this. We have separate builds for testing and production purposes. Each build has a script in package.json. The builds output files into `dist/` directory, standalone bundle at `dist/tapspace.min.js` and source maps at `dist/tapspace.min.js.map`. Minified bundle for production: @@ -90,7 +90,7 @@ A build is necessary before running tests. ## Testing -Tapspace is a user interface library and therefore its test suite must be run in a web browser. Static code checking, linting, can be done without. Tests are built on [tape](https://github.com/substack/tape). +Tapspace.js is a user interface library. Therefore its test suite runs in a headless web browser. Use command line to run the test suite. The test suite hosts unit tests for each Tapspace component and geometry. You can open a particular unit in a web browser for deeper inspection. To check the code syntax and style against [standardJS](https://standardjs.com/): @@ -102,18 +102,9 @@ To fix common lint issues automatically: To run the test suite: - $ npm run test:browser + $ npm test -A browser tab opens. The test report is available through browser developer console. - -To automatically rebuild the test suite upon file change: - - $ npm run test:browser:watch - -The runner `test/index.html` uses `webpack-livereload-plugin` so expect automatic page refresh at each webpack rebuild. - -**Headless testing** would be great but suitable tools lack maintenance. Therefore -tests must be observed via the browser. Additionally, debugging is usually much easier via the browser. +Unit tests are built on [tape](https://github.com/substack/tape) framework and run in a headless chromium via [puppeteer](https://github.com/puppeteer/puppeteer). Each test unit has the tests written in one or multiple HTML pages. Each page loads the current tapspace build bundle in `/dist`, loads a tape-like test tool `testlib.js`, and executes a small test script. The test pages are executed in mass by puppeteer and results output to terminal in tape format. Pages can be opened manully in a normal web browser for deeper debug. ## Release From 3f32a1c4937d200473f46dd86e5bf66725cfcc00 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 01:47:50 +0200 Subject: [PATCH 097/118] attempt integrate headless suite to github actions --- .github/workflows/tapspace-ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/tapspace-ci.yml b/.github/workflows/tapspace-ci.yml index c72c35fa..5323ff31 100644 --- a/.github/workflows/tapspace-ci.yml +++ b/.github/workflows/tapspace-ci.yml @@ -19,3 +19,19 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm install - run: npm run lint + + tapspace-headless: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [22] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test From 1ecb8d7bceb9052ad92adba3c2c554cbdc1009e5 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 02:01:22 +0200 Subject: [PATCH 098/118] attempt to use puppeteer with no-sandbox to support github actions --- test/run.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/run.mjs b/test/run.mjs index e700150d..01219936 100644 --- a/test/run.mjs +++ b/test/run.mjs @@ -22,9 +22,10 @@ import test from 'tape' import testSuite from './suites.mjs' // Setup -const browser = await puppeteer.launch() -// Switch to the commented line to show the browser. -// const browser = await puppeteer.launch({ headless: false }) +const browser = await puppeteer.launch({ + headless: true, + args: ['--no-sandbox'] +}) // Run tests console.time('# runtime') From 03264d018ae124193efceba4b5364e812eb511aa Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 02:03:22 +0200 Subject: [PATCH 099/118] add node v18 target to headless test suite --- .github/workflows/tapspace-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tapspace-ci.yml b/.github/workflows/tapspace-ci.yml index 5323ff31..3baccafa 100644 --- a/.github/workflows/tapspace-ci.yml +++ b/.github/workflows/tapspace-ci.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: - node-version: [22] + node-version: [18, 22] steps: - uses: actions/checkout@v4 From dd3c3f977bf16adbe0d4d4aa2255cc99006ff26d Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 02:16:49 +0200 Subject: [PATCH 100/118] replace node v18 with v20 in headless test suite to support dirname --- .github/workflows/tapspace-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tapspace-ci.yml b/.github/workflows/tapspace-ci.yml index 3baccafa..dbacb986 100644 --- a/.github/workflows/tapspace-ci.yml +++ b/.github/workflows/tapspace-ci.yml @@ -25,7 +25,7 @@ jobs: strategy: matrix: - node-version: [18, 22] + node-version: [20, 22] steps: - uses: actions/checkout@v4 From e8e34c23da8f6a788966b4a5bf5049c82a3ccba9 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 02:23:26 +0200 Subject: [PATCH 101/118] remove redundant lint test job from workflow --- .github/workflows/tapspace-ci.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/tapspace-ci.yml b/.github/workflows/tapspace-ci.yml index dbacb986..7ccdebed 100644 --- a/.github/workflows/tapspace-ci.yml +++ b/.github/workflows/tapspace-ci.yml @@ -4,22 +4,6 @@ run-name: tapspace test run by ${{ github.actor }} on: [push] jobs: - tapspace-lint-test: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18, 20, 22] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm run lint - tapspace-headless: runs-on: ubuntu-latest From f4478a096c5681576139f63a938564e5dbb2396e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 02:24:24 +0200 Subject: [PATCH 102/118] remove Travis CI integration --- .npmignore | 1 - .travis.yml | 15 --------------- 2 files changed, 16 deletions(-) delete mode 100644 .travis.yml diff --git a/.npmignore b/.npmignore index 095c8365..c8c32caa 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,3 @@ -.travis.yml /dist/.gitkeep /docs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eb7485cd..00000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: node_js -os: - - linux -dist: xenial -node_js: - - node -services: - - xvfb -script: xvfb-run --auto-servernum --server-num=1 --server-args="-screen 1 1024x768x24" make test -cache: - directories: - - node_modules -branches: - only: - - master From d663d2f036dc640ec7b893cb1f46f601fa2aa44d Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 02:24:55 +0200 Subject: [PATCH 103/118] npmignore .github and .editorconfig --- .npmignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index c8c32caa..c715a7ff 100644 --- a/.npmignore +++ b/.npmignore @@ -1,9 +1,12 @@ +/.github /dist/.gitkeep /docs /test /features -.DS_Store +.editorconfig .gitignore + +.DS_Store package-lock.json From dead6a39e05758626187df5a744a2349d4b8582e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 02:25:03 +0200 Subject: [PATCH 104/118] update license year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index d76cdc70..448491ce 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ MIT License -Copyright (c) 2023 Akseli Palén +Copyright (c) 2025 Akseli Palén Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From ee8d31ebc8a4cbd809b7c59fd3eab5d0f161a9aa Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 15:58:16 +0200 Subject: [PATCH 105/118] implement test.print to produce TAP for manual browser testing --- test/testlib.js | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/test/testlib.js b/test/testlib.js index a0fd4e94..19c6bd43 100644 --- a/test/testlib.js +++ b/test/testlib.js @@ -7,8 +7,8 @@ // - Install with a script tag on a unit-test HTML page. // - Access via window.test object. // - Use test.plan(n) to start the test section and test.end() to stop. -// - Assert with test.equal(), .almostEqual() and test.ok() -// - Access results via test.report() +// - Assert with test.equal(), test.almostEqual() and test.ok() +// - Access results via test.report() or test.print() // // Developer note: // - Keep everything in this single file to avoid need @@ -181,6 +181,37 @@ window.test = { }) }, + print: function () { + // Print results in TAP format. + // See https://testanything.org/tap-version-14-specification.html + // + const report = this.report() + const version = 'TAP version 14' + const plan = '1..' + report.length + const lines = report.map((point, i) => { + const num = i + 1 + if (point.result) { + return 'ok ' + num + ' - ' + point.message + } + const fail = 'not ok ' + num + ' - ' + point.message + const diagnostics = ' ---\n' + + ' operator: ' + point.operator + '\n' + + ' expected: ' + point.expected + '\n' + + ' actual: ' + point.actual + '\n' + + ' ...' + return fail + '\n' + diagnostics + }) + const body = lines.join('\n') + const numPassed = report.filter(r => r.result).length + const numFailed = report.length - numPassed + const stats = '\n' + + '# tests ' + report.length + '\n' + + '# pass ' + numPassed + '\n' + + '# fail ' + numFailed + '\n' + const tap = version + '\n' + plan + '\n' + body + '\n' + stats + console.log(tap) + }, + almostEqual: function (actual, expected, message) { let result = false From bc3a67ca28f7e526bfd22bc5aa4c7ebd98b2c743 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 15:58:58 +0200 Subject: [PATCH 106/118] add safeguard in test.report to prevent duplicate plan assertions --- test/testlib.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/test/testlib.js b/test/testlib.js index 19c6bd43..647bc191 100644 --- a/test/testlib.js +++ b/test/testlib.js @@ -133,6 +133,7 @@ window.test = { planned: -1, results: [], finished: false, + planChecked: false, assert: function (assertion) { this.results.push(assertion) @@ -156,17 +157,21 @@ window.test = { // Check that correct number of tests were performed. // If not, add a failed test result. - const actual = this.results.length - const expected = this.planned - if (expected >= 0) { - if (actual !== expected) { - this.assert({ - result: false, - operator: 'plan', - message: `Unexpected number of tests: ${actual}, should be ${expected}`, - actual, - expected - }) + // Do this only once to prevent duplicate assertions upon additional calls. + if (!this.planChecked) { + this.planChecked = true + const actual = this.results.length + const expected = this.planned + if (expected >= 0) { + if (actual !== expected) { + this.assert({ + result: false, + operator: 'plan', + message: `Unexpected number of tests: ${actual}, should be ${expected}`, + actual, + expected + }) + } } } From ac697e12d37322e650bdb1933fceab1fc2f494da Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 15:59:29 +0200 Subject: [PATCH 107/118] output minimal usage instructions for manual browser testing --- test/testlib.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/testlib.js b/test/testlib.js index 647bc191..1712781c 100644 --- a/test/testlib.js +++ b/test/testlib.js @@ -24,6 +24,11 @@ if (!window) { throw new Error('Browser environment is required.') } +// Usage instructions for manual testing via browser. +const instructions = 'Call test.print() to see TAP formatted report ' + + 'or test.report() for unformatted report.' +console.log(instructions) + // Tolerance for almost equality. const TOLERANCE = 1e-10 From 0a8de67d9b8961f5d8191513ac3d76a19b0dd401 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 16:15:14 +0200 Subject: [PATCH 108/118] implement Size :almostEqual :equal --- lib/geometry/Size/almostEqual.js | 25 +++++++++++++++++ lib/geometry/Size/equal.js | 23 +++++++++++++++ lib/geometry/Size/index.js | 2 ++ test/geometry/Size/equality.html | 48 ++++++++++++++++++++++++++++++++ test/geometry/Size/index.mjs | 1 + 5 files changed, 99 insertions(+) create mode 100644 lib/geometry/Size/almostEqual.js create mode 100644 lib/geometry/Size/equal.js create mode 100644 test/geometry/Size/equality.html diff --git a/lib/geometry/Size/almostEqual.js b/lib/geometry/Size/almostEqual.js new file mode 100644 index 00000000..24b7a2e4 --- /dev/null +++ b/lib/geometry/Size/almostEqual.js @@ -0,0 +1,25 @@ +const size3 = require('affineplane').size3 + +module.exports = function (s, tolerance) { + // @Size:almostEqual(s[, tolerance]) + // + // Test if this size is equal to the given size s within tolerance. + // Equality requires strictly equal basis and that the difference in size + // is within the tolerance. + // + // Parameters: + // s + // a Size + // tolerance + // optional number + // + // Return + // a boolean + // + + if (s && s.basis && this.basis === s.basis) { + return size3.almostEqual(this.size, s.size, tolerance) + } + + return false +} diff --git a/lib/geometry/Size/equal.js b/lib/geometry/Size/equal.js new file mode 100644 index 00000000..fa4427e6 --- /dev/null +++ b/lib/geometry/Size/equal.js @@ -0,0 +1,23 @@ +const size3 = require('affineplane').size3 + +module.exports = function (s) { + // @Size:equal(s) + // + // Test if this size is strictly equal to the given size s. + // Strict equality requires identical basis and size properties. + // Additional properties are allowed. + // + // Parameters: + // s + // a Size + // + // Return + // a boolean + // + + if (s && s.basis && this.basis === s.basis) { + return size3.equal(this.size, s.size) + } + + return false +} diff --git a/lib/geometry/Size/index.js b/lib/geometry/Size/index.js index f420cacd..21893b08 100644 --- a/lib/geometry/Size/index.js +++ b/lib/geometry/Size/index.js @@ -30,7 +30,9 @@ const proto = Size.prototype module.exports = Size proto.isSize = true +proto.almostEqual = require('./almostEqual') proto.changeBasis = require('./changeBasis') +proto.equal = require('./equal') proto.getArea = require('./getArea') proto.getRaw = require('./getRaw') proto.normAt = require('./normAt') diff --git a/test/geometry/Size/equality.html b/test/geometry/Size/equality.html new file mode 100644 index 00000000..3297c205 --- /dev/null +++ b/test/geometry/Size/equality.html @@ -0,0 +1,48 @@ + + + + + Size equality - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/geometry/Size/index.mjs b/test/geometry/Size/index.mjs index 7f51a896..0e1c9a90 100644 --- a/test/geometry/Size/index.mjs +++ b/test/geometry/Size/index.mjs @@ -1,6 +1,7 @@ export default function (test) { const namespace = 'Size' const methods = [ + 'equality', 'getRaw', 'scaleBy' ] From 24d9dc4be961d5afee0c03e4cdaa4256eb30b3aa Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 16:30:33 +0200 Subject: [PATCH 109/118] improve and test Orientation:equal --- lib/geometry/Orientation/equal.js | 4 +- test/geometry/Orientation/equality.html | 53 +++++++++++++++++++++++++ test/geometry/Orientation/index.mjs | 1 + 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 test/geometry/Orientation/equality.html diff --git a/lib/geometry/Orientation/equal.js b/lib/geometry/Orientation/equal.js index 425acb2f..c5dd8bab 100644 --- a/lib/geometry/Orientation/equal.js +++ b/lib/geometry/Orientation/equal.js @@ -1,4 +1,4 @@ -// TODO use orient2.equal +const orient2 = require('affineplane').orient2 module.exports = function (orient) { // @Orientation:equal(orient) @@ -15,7 +15,7 @@ module.exports = function (orient) { // if (orient && orient.basis && this.basis === orient.basis) { - return this.orient.a === orient.orient.a && this.orient.b === orient.orient.b + return orient2.equal(this.orient, orient.orient) } return false diff --git a/test/geometry/Orientation/equality.html b/test/geometry/Orientation/equality.html new file mode 100644 index 00000000..e00de368 --- /dev/null +++ b/test/geometry/Orientation/equality.html @@ -0,0 +1,53 @@ + + + + + Orientation equality - Tapspace Test + + + + + +
+
+
+ + + diff --git a/test/geometry/Orientation/index.mjs b/test/geometry/Orientation/index.mjs index 4dd877df..b472ce22 100644 --- a/test/geometry/Orientation/index.mjs +++ b/test/geometry/Orientation/index.mjs @@ -1,6 +1,7 @@ export default function (test) { const namespace = 'Orientation' const methods = [ + 'equality', 'getRaw' ] From c8081051be53939bb514f88cccd59a018d0555eb Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 16:51:39 +0200 Subject: [PATCH 110/118] implement Distance:equal --- lib/geometry/Distance/equal.js | 20 ++++++++++++++++++++ lib/geometry/Distance/index.js | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 lib/geometry/Distance/equal.js diff --git a/lib/geometry/Distance/equal.js b/lib/geometry/Distance/equal.js new file mode 100644 index 00000000..506b9972 --- /dev/null +++ b/lib/geometry/Distance/equal.js @@ -0,0 +1,20 @@ +module.exports = function (dist) { + // @Distance:equal(dist) + // + // Test if this distance is strictly equal to the given distance. + // Strict equality requires strictly equal basis and numerical distance. + // + // Parameters: + // dist + // a Distance + // + // Return + // a boolean + // + + if (dist && dist.basis && this.basis === dist.basis) { + return this.dist === dist.dist + } + + return false +} diff --git a/lib/geometry/Distance/index.js b/lib/geometry/Distance/index.js index 08bdb12c..ea13ca4b 100644 --- a/lib/geometry/Distance/index.js +++ b/lib/geometry/Distance/index.js @@ -24,7 +24,9 @@ const proto = Distance.prototype proto.isDistance = true // Methods +proto.almostEqual = require('./isAlmostEqual') // TODO consistent method naming proto.changeBasis = require('./changeBasis') +proto.equal = require('./equal') proto.getNumber = require('./getNumber') proto.getRaw = require('./getRaw') proto.isAlmostEqual = require('./isAlmostEqual') From 8a8259f7fda9c819912c0cc792f016c1fbd08cc9 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 16:52:15 +0200 Subject: [PATCH 111/118] implement Component:createDistance --- lib/components/Component/createDirection.js | 1 - lib/components/Component/createDistance.js | 21 ++++++++++ lib/components/Component/index.js | 1 + .../Component/geometryCreation.html | 38 +++++++++++-------- 4 files changed, 45 insertions(+), 16 deletions(-) create mode 100644 lib/components/Component/createDistance.js diff --git a/lib/components/Component/createDirection.js b/lib/components/Component/createDirection.js index aeead367..defee2d7 100644 --- a/lib/components/Component/createDirection.js +++ b/lib/components/Component/createDirection.js @@ -18,7 +18,6 @@ module.exports = function (theta, phi) { // a Direction // - // TODO rename to createDirection if (typeof theta !== 'number') { throw new Error('Invalid theta angle') } diff --git a/lib/components/Component/createDistance.js b/lib/components/Component/createDistance.js new file mode 100644 index 00000000..7e5791ea --- /dev/null +++ b/lib/components/Component/createDistance.js @@ -0,0 +1,21 @@ +const Distance = require('../../geometry/Distance') + +module.exports = function (dist) { + // @Component:createDistance(dist) + // + // Create a Distance relative to the component. + // + // Parameters + // dist + // a number, a distance in the coordinate space of the component. + // + // Return + // a Distance + // + + if (typeof dist !== 'number') { + throw new Error('Invalid distance. Must be a number.') + } + + return new Distance(this, dist) +} diff --git a/lib/components/Component/index.js b/lib/components/Component/index.js index 498c56f8..898fa11a 100644 --- a/lib/components/Component/index.js +++ b/lib/components/Component/index.js @@ -80,6 +80,7 @@ proto.bringToFront = require('./bringToFront') proto.createBasis = require('./createBasis') proto.createPoint = proto.at proto.createDirection = require('./createDirection') +proto.createDistance = require('./createDistance') proto.createOrientation = require('./createOrientation') proto.createVector = require('./createVector') // TODO proto.getFirstChild diff --git a/test/components/Component/geometryCreation.html b/test/components/Component/geometryCreation.html index fea39151..ed4bd8b9 100644 --- a/test/components/Component/geometryCreation.html +++ b/test/components/Component/geometryCreation.html @@ -12,35 +12,43 @@
From d41dc5fe1d759ab2fe9ebfb890df3793c804373e Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 20:18:53 +0200 Subject: [PATCH 112/118] fix #184: insert tapspace stylesheet without webpack --- lib/index.js | 4 +- lib/style.js | 159 +++++++++++++++++++++++++++++++++++++++++++++++ lib/tapspace.css | 132 --------------------------------------- 3 files changed, 161 insertions(+), 134 deletions(-) create mode 100644 lib/style.js delete mode 100644 lib/tapspace.css diff --git a/lib/index.js b/lib/index.js index 36201487..1d1650e7 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,8 +7,8 @@ // components, images, and other resources. // -// Import tapspace stylesheet -require('./tapspace.css') +// Insert tapspace stylesheet +require('./style') // Capturers exports.capturers = require('./capturers') diff --git a/lib/style.js b/lib/style.js new file mode 100644 index 00000000..35d6a632 --- /dev/null +++ b/lib/style.js @@ -0,0 +1,159 @@ +// This script inserts a CSS stylesheet to document head. +// The stylesheet contains required classes to make Tapspace.js +// components work like they should. +// +// TODO Instead of inserting a new style-element to document head, +// consider using CSSStyleSheet object and document.adoptedStyleSheets +// to insert the styles. The feature has been baseline since 2023. +// See issue #184 for details. +// +// General architectural guidelines for Tapspace.js classes: +// - Avoid giving CSS classes for abstract component classes. +// Why? This is to avoid deep, interlocking dependencies between classes +// which can make changes fragile and debugging difficult. +// Embrace modularity. This is against DRY but for a reason. +// - Document the reason of each CSS rule. It is critical to know +// the full purpose of each rule to maintain cross-browser compatibility +// and the delicate interplay of the rules upon +// codebase refactoring and further development. +// + +const style = document.createElement('style') +style.type = 'text/css' + +style.innerHTML = [ + // Styles for Viewport + '.affine-viewport {', + // Space elements are absolutely positioned and therefore + // the view must be either absolutely or relatively positioned. + 'position: relative;', + // Viewport is a camera that looks to the space, thus crop. + 'overflow: hidden;', + // Mobile browsers have touch actions that cancel our gestures. + 'touch-action: none;', + // Camera distance from the image plane in viewport pixels. + 'perspective: none;', + // Host app must give viewport height for it to be visible. + // However, that requirement could be annoying to learn if + // the viewport is not visible at all (default zero height). + // Therefore set a minimum height to avoid the annoyance. + 'min-height: 200px;', + // Ensure viewport contents do not take part to external 3D space. + 'transform-style: flat;', + '}', + + // Styles for Hyperspace + '.affine-hyperspace {', + // The space contains the layers and is a child of viewport. + // It must fill the viewport behind controls. + 'width: 100%;', + 'height: 100%;', + // Ensure default transform origin. + 'transform-origin: 0 0;', + // Fast flat by default. + 'transform-style: flat;', + '}', + + // Styles for Space + '.affine-layer, .affine-composite, .affine-space {', + // Space elements are absolutely positioned. + 'position: absolute;', + 'top: 0;', + 'left: 0;', + // Spaces themselves have zero size to allow pointer events reach + // elements below. To make elements on the space visible, + // they must be visible over the space borders. + 'width: 0;', + 'height: 0;', + 'overflow: visible;', + // Ensure default transform origin. + // Spaces with custom anchor may overwrite the origin. + 'transform-origin: 0 0;', + // Flat by default. + 'transform-style: flat;', + '}', + + // Styles for FrameComponent + '.affine-frame {', + 'display: block;', + // Ensure zero margin for correct positioning. + 'margin: 0;', + // Ensure that user-defined padding does not affect size. + 'box-sizing: border-box;', + // Space elements are positioned by using transform matrices. + // To make this work, the elements must be positioned absolutely + // at the top-left corner of the parent. + // Only absolutely positioned elements can be transformed. + 'position: absolute;', + 'top: 0;', + 'left: 0;', + 'bottom: auto;', + 'right: auto;', + // Ensure default transform origin. + // Frames with custom anchor may overwrite the origin. + 'transform-origin: 0 0;', + // Init transform. Maybe unnecessary. + 'transform: matrix(1, 0, 0, 1, 0, 0);', + // Show only the front face. This helps Gecko-based browsers + // to render 3D elements. + 'backface-visibility: hidden;', + '}', + + // Styles for Item + '.affine-item {', + // Items are always flat. + 'transform-style: flat;', + '}', + + // Styles for ViewportControls + '.affine-controls {', + // ViewportControls must be visible on top of layers but their + // container must not have size so that the container area does + // not steal input events from space. + 'position: absolute;', + 'top: 0;', + 'left: 0;', + 'width: 0;', + 'height: 0;', + 'overflow: visible;', + // Ensure default transform origin. + 'transform-origin: 0 0;', + // Controls are 2D only. + 'transform-style: flat;', + // Ensure orthogonal projection. + 'perspective: none;', + '}', + + // Styles for ViewportControl + '.affine-frame.affine-control {', + // Controls are 2D only. + 'transform-style: flat;', + '}', + + // Styles for Edge + '.affine-edge {', + // Include borders to the size. + 'box-sizing: border-box;', + '}', + + // Styles for Arc + '.affine-arc {', + 'overflow: hidden;', + '}', + + // Styles for nested input proxy elements. + '.affine-proxy-pointer {', + // Contents of a proxy act as passive part of the proxy element. + // The proxy itself acts as an interactive part of its ancestors. + 'touch-action: none;', + 'user-select: none;', + '}', + '.affine-proxy-wheel {', + // Contents of a proxy act as passive part of the proxy element. + // The proxy itself acts as an interactive part of its ancestors. + // Possible rules in future: scroll-behavior, scrollbar-gutter. + '}' +].join('\n') + +// Insert to document. +document.head.appendChild(style) diff --git a/lib/tapspace.css b/lib/tapspace.css deleted file mode 100644 index 86002fe9..00000000 --- a/lib/tapspace.css +++ /dev/null @@ -1,132 +0,0 @@ -/* -Architectural guidelines for tapspace classes: - -1. Avoid giving CSS classes for abstract component classes. - Why? Avoid deep, interlocking dependencies between classes which - can make changes fragile and debugging difficult. Embrace modularity. - This is against DRY but for a reason. -*/ - -.affine-viewport { - /* Space elements are absolutely positioned and therefore - the view must be either absolutely or relatively positioned. */ - position: relative; - /* Viewport is a camera that looks to the space, thus crop */ - overflow: hidden; - /* Mobile browsers have touch actions that cancel our gestures */ - touch-action: none; - /* Camera distance from the image plane in viewport pixels */ - perspective: none; - /* Host app must give viewport height for it to be visible. - However, that requirement could be annoying to learn if - the viewport is not visible at all (default zero height). - Therefore set a minimum height to avoid the annoyance. */ - min-height: 200px; - /* Ensure viewport contents do not take part to external 3D space */ - transform-style: flat; -} - -.affine-hyperspace { - /* The space contains the layers and is a child of viewport. - It must fill the viewport behind controls. */ - width: 100%; - height: 100%; - /* Ensure default transform origin. */ - transform-origin: 0 0; - /* Fast flat by default */ - transform-style: flat; -} - -.affine-layer, -.affine-composite, -.affine-space { - /* Space elements are absolutely positioned */ - position: absolute; - top: 0; - left: 0; - /* Spaces themselves have zero size to allow pointer events reach - elements below. To make elements on the space visible, - they must be visible over the space borders. */ - width: 0; - height: 0; - overflow: visible; - /* Ensure default transform origin. - Spaces with custom anchor may overwrite the origin. */ - transform-origin: 0 0; - /* Flat by default. */ - transform-style: flat; -} - -.affine-frame { - display: block; - /* Ensure zero margin for correct positioning */ - margin: 0; - /* Ensure that user-defined padding does not affect size. */ - box-sizing: border-box; - /* Space elements are positioned by using transform matrices. - To make this work, the elements must be positioned absolutely - at the top-left corner of the parent. - Only absolutely positioned elements can be transformed. */ - position: absolute; - top: 0; - left: 0; - bottom: auto; - right: auto; - /* Ensure default transform origin. - Frames with custom anchor may overwrite the origin. */ - transform-origin: 0 0; - /* Init transform. Maybe unnecessary. */ - transform: matrix(1, 0, 0, 1, 0, 0); - /* Show only the front face. This helps Gecko-based browsers - to render 3D elements. */ - /* backface-visibility: hidden; */ -} - -.affine-item { - /* Items are always flat */ - transform-style: flat; -} - -.affine-controls { - /* ViewportControls must be visible on top of layers but their - container must not have size so that the container area does - not steal input events from space. */ - position: absolute; - top: 0; - left: 0; - width: 0; - height: 0; - overflow: visible; - /* Ensure default transform origin. */ - transform-origin: 0 0; - /* Controls are 2D only. */ - transform-style: flat; - /* Ensure orthogonal projection. */ - perspective: none; -} - -.affine-frame.affine-control { - /* Controls are 2D only. */ - transform-style: flat; -} - -.affine-edge { - /* Include borders to the size */ - box-sizing: border-box; -} - -.affine-arc { - overflow: hidden; -} - -.affine-proxy-pointer { - /* Contents of a proxy act as passive part of the proxy element. - The proxy itself acts as an interactive part of its ancestors. */ - touch-action: none; - user-select: none; -} -.affine-proxy-wheel { - /* Contents of a proxy act as passive part of the proxy element. - The proxy itself acts as an interactive part of its ancestors. */ - /* Possible rules in future: scroll-behavior, scrollbar-gutter. */ -} From 8f341a750a3c25b4e0f9b64c9b97ac297b12ea23 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 20:19:51 +0200 Subject: [PATCH 113/118] uninstall dev dependencies: css-loader, style-loader --- package.json | 2 -- webpack.config.js | 18 +++--------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 1eec2cab..cfe98256 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ }, "devDependencies": { "async": "^3.2.6", - "css-loader": "^7.1.2", "finalhandler": "^1.3.1", "genversion": "^3.2.0", "puppeteer": "^23.10.2", @@ -48,7 +47,6 @@ "serve-index": "^1.9.1", "serve-static": "^1.16.2", "standard": "^17.1.2", - "style-loader": "^4.0.0", "tape": "^5.9.0", "webpack": "^5.97.1", "webpack-cli": "^5.1.4", diff --git a/webpack.config.js b/webpack.config.js index 00387bc5..068cfb73 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,5 @@ -var webpack = require('webpack') -var path = require('path') +const webpack = require('webpack') +const path = require('path') module.exports = { entry: './index', @@ -7,21 +7,9 @@ module.exports = { filename: 'tapspace.min.js', path: path.join(__dirname, '/dist'), sourceMapFilename: '[file].map', - library: 'tapspace', // module name in global scope + library: 'tapspace', // module name in global scope libraryTarget: 'umd' }, - module: { - rules: [ - { - test: /\.css$/, - use: [ - { loader: 'style-loader' }, - { loader: 'css-loader' } - ] - } - ] - }, - mode: 'development' } From 3029db02df31201565992b23fa243c68c77de5b0 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 20:20:16 +0200 Subject: [PATCH 114/118] uninstall unused dev dependency: async --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index cfe98256..beac5eab 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,6 @@ "nudged": "^2.1.1" }, "devDependencies": { - "async": "^3.2.6", "finalhandler": "^1.3.1", "genversion": "^3.2.0", "puppeteer": "^23.10.2", From 48d391bfb2d4fca71f81ed96ce0d7a8172fdf996 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 20:40:56 +0200 Subject: [PATCH 115/118] fix #185: contextmenu handler should pass key modifiers --- .../GestureCapturer/Sensor/oncontextmenu.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/capturers/GestureCapturer/Sensor/oncontextmenu.js b/lib/capturers/GestureCapturer/Sensor/oncontextmenu.js index ccef3e95..fa2f4801 100644 --- a/lib/capturers/GestureCapturer/Sensor/oncontextmenu.js +++ b/lib/capturers/GestureCapturer/Sensor/oncontextmenu.js @@ -3,18 +3,20 @@ module.exports = (sensor) => { // Context menu was brought up somewhere in the document. // Therefore we want to cancel the ongoing gesture. - if (!sensor.started) { - // No ongoing gesture, nothing to cancel. - return - } + // If no ongoing gesture, nothing to cancel. + if (!sensor.started) { return } // Collect last pointers for emit. const lastPointers = Object.assign({}, sensor.currPointers) // Cancel all the pointers sensor.currPointers = {} + + // Store modifier keys + sensor.registerModifiers(ev) + // Declare gesture as cancelled sensor.started = false // TODO should we explicitly cancel also the pointer capture? - sensor.oncancel(lastPointers) + sensor.oncancel(lastPointers, sensor.modifiers) } } From 7239eaaf9a293e382ac6e6eb6ba24f1a7e484063 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 21:33:15 +0200 Subject: [PATCH 116/118] update build badge for github actions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00505c1a..c159347a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ![tapspace.js](docs/tapspace-banner-2023.png?raw=true) [![NPM Version](https://img.shields.io/npm/v/tapspace/alpha?color=7FCD0F)](https://www.npmjs.com/package/tapspace) -[![Build Status](https://img.shields.io/travis/com/taataa/tapspace)](https://travis-ci.com/github/taataa/tapspace) +[![Build Status](https://img.shields.io/github/actions/workflow/status/taataa/tapspace/tapspace-ci.yml)](https://github.com/taataa/tapspace/actions/workflows/tapspace-ci.yml) We believe **zoomable user interfaces** to be the best way for humans to explore and manipulate two-dimensional content. Therefore we built **Tapspace.js**, a **JavaScript** library dedicated for building such **dynamic front-ends**. It provides an **infinite, scalable, and rotatable space** for you to represent **HTML content** and for your users to play with. Tapspace.js uses **pure CSS3 and DOM** instead of Canvas or WebGL and therefore is able to handle any HTML content you throw at it, including iframes and SVG, and also Canvas- and WebGL-rendered elements. And of course, we provide a clean, documented API for you to **build your best**. From 1806dbd302189d1ff142c5f399c2c6345cf61e77 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 21:37:11 +0200 Subject: [PATCH 117/118] render v2 API docs --- docs/api/v2/index.md | 413 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 411 insertions(+), 2 deletions(-) diff --git a/docs/api/v2/index.md b/docs/api/v2/index.md index b57dc8a8..96f2bfed 100644 --- a/docs/api/v2/index.md +++ b/docs/api/v2/index.md @@ -1161,6 +1161,7 @@ Nested components form an *affine subtree* in DOM. - [tapspace.components.Component:bringToFront](#tapspacecomponentscomponentbringtofront) - [tapspace.components.Component:createBasis](#tapspacecomponentscomponentcreatebasis) - [tapspace.components.Component:createDirection](#tapspacecomponentscomponentcreatedirection) +- [tapspace.components.Component:createDistance](#tapspacecomponentscomponentcreatedistance) - [tapspace.components.Component:createOrientation](#tapspacecomponentscomponentcreateorientation) - [tapspace.components.Component:createVector](#tapspacecomponentscomponentcreatevector) - [tapspace.components.Component:findCommonAncestor](#tapspacecomponentscomponentfindcommonancestor) @@ -1406,6 +1407,24 @@ relative to the component. Source: [createDirection.js](https://github.com/taataa/tapspace/blob/master/lib/components/Component/createDirection.js) + +## [tapspace](#tapspace).[components](#tapspacecomponents).[Component](#tapspacecomponentscomponent):[createDistance](#tapspacecomponentscomponentcreatedistance)(dist) + +Create a [Distance](#tapspacegeometrydistance) relative to the component. + +

Parameters:

+ +- *dist* + - a number, a distance in the coordinate space of the component. + + +

Returns:

+ +- a [Distance](#tapspacegeometrydistance) + + +Source: [createDistance.js](https://github.com/taataa/tapspace/blob/master/lib/components/Component/createDistance.js) + ## [tapspace](#tapspace).[components](#tapspacecomponents).[Component](#tapspacecomponentscomponent):[createOrientation](#tapspacecomponentscomponentcreateorientation)(angle) @@ -2754,7 +2773,7 @@ the space position of the top left corner, see [FrameComponent:setSize](#tapspac

Parameters:

- *newSize* - - a {w,h}, a {width,height}, or a [Size](#tapspacegeometrysize). If {w,h} or {width,height} format is used, the dimensions can be either number of pixels or CSS length strings. Note that if the component is not yet in DOM, relative length units might not work. + - a {w,h}, a {width,height}, or a [Size](#tapspacegeometrysize). The dimensions must be numbers. CSS length strings are not supported. - *pivot* - optional [Point](#tapspacegeometrypoint), default is the transform origin. @@ -2801,7 +2820,7 @@ To preserve the relative anchor position, see [FrameComponent:resizeTo](#tapspac

Parameters:

- *newSize* - - a {w,h}, a {width,height}, or a [Size](#tapspacegeometrysize). If {w,h} or {width,height} format is used, the dimensions can be either number of pixels or CSS length strings. Note that if the component is not yet in DOM, relative length units might not work. + - a {w,h}, a {width,height}, or a [Size](#tapspacegeometrysize). Note that the dimensions must be numbers. CSS length strings are not supported.

Parameters (alternative):

@@ -5829,11 +5848,13 @@ the scale, orientation, and position of a virtual basis.

Contents:

+- [tapspace.geometry.Basis:almostEqual](#tapspacegeometrybasisalmostequal) - [tapspace.geometry.Basis:at](#tapspacegeometrybasisat) - [tapspace.geometry.Basis:changeBasis](#tapspacegeometrybasischangebasis) - [tapspace.geometry.Basis:createDirection](#tapspacegeometrybasiscreatedirection) - [tapspace.geometry.Basis:createDistance](#tapspacegeometrybasiscreatedistance) - [tapspace.geometry.Basis:createVector](#tapspacegeometrybasiscreatevector) +- [tapspace.geometry.Basis:equal](#tapspacegeometrybasisequal) - [tapspace.geometry.Basis:getMatchedOuter](#tapspacegeometrybasisgetmatchedouter) - [tapspace.geometry.Basis:getOrientation](#tapspacegeometrybasisgetorientation) - [tapspace.geometry.Basis:getPoint](#tapspacegeometrybasisgetpoint) @@ -5856,6 +5877,28 @@ the scale, orientation, and position of a virtual basis. Source: [Basis/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Basis/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Basis](#tapspacegeometrybasis):[almostEqual](#tapspacegeometrybasisalmostequal)(b[, tolerance]) + +Test if this is equal to the given basis b within tolerance. +Almost equality requires identical basis' basis +and that coordinates are equal within tolerance. + +

Parameters:

+ +- *b* + - a [Basis](#tapspacegeometrybasis) +- *tolerance* + - optional number. Maximum tolerated distance between coordinates. + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Basis/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Basis](#tapspacegeometrybasis):[at](#tapspacegeometrybasisat)(x, y, z) @@ -5961,6 +6004,26 @@ Create a vector using coordinate system of this basis. Source: [createVector.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Basis/createVector.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Basis](#tapspacegeometrybasis):[equal](#tapspacegeometrybasisequal)(b) + +Test if the value b is a [Basis](#tapspacegeometrybasis) and strictly equal. +Strict equality requires the same basis' basis +and identical coordinates. + +

Parameters:

+ +- *b* + - a [Basis](#tapspacegeometrybasis) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Basis/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Basis](#tapspacegeometrybasis):[getMatchedOuter](#tapspacegeometrybasisgetmatchedouter)(targetBasis) @@ -6321,12 +6384,14 @@ in any basis, not only those that have same orientation.

Contents:

+- [tapspace.geometry.Box:almostEqual](#tapspacegeometryboxalmostequal) - [tapspace.geometry.Box:at](#tapspacegeometryboxat) - [tapspace.geometry.Box:atCenter](#tapspacegeometryboxatcenter) - [tapspace.geometry.Box:atMid](#tapspacegeometryboxatmid) - [tapspace.geometry.Box:atNorm](#tapspacegeometryboxatnorm) - [tapspace.geometry.Box:changeBasis](#tapspacegeometryboxchangebasis) - [tapspace.geometry.Box:detectCollision](#tapspacegeometryboxdetectcollision) +- [tapspace.geometry.Box:equal](#tapspacegeometryboxequal) - [tapspace.geometry.Box:fromBoxes](#tapspacegeometryboxfromboxes) - [tapspace.geometry.Box:fromPoints](#tapspacegeometryboxfrompoints) - [tapspace.geometry.Box:getArea](#tapspacegeometryboxgetarea) @@ -6353,6 +6418,28 @@ in any basis, not only those that have same orientation. Source: [Box/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Box/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Box](#tapspacegeometrybox):[almostEqual](#tapspacegeometryboxalmostequal)(b[, tolerance]) + +Test if this box is equal to the given box b within tolerance. +Almost equality requires identical basis +and that box size, position, and orientation are equal within tolerance. + +

Parameters:

+ +- *b* + - a [Box](#tapspacegeometrybox) +- *tolerance* + - optional number. Maximum tolerated distance between values. + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Box/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Box](#tapspacegeometrybox):[at](#tapspacegeometryboxat)(x, y[, z]) @@ -6458,6 +6545,26 @@ Note that not all geometries are supported, see below. Source: [detectCollision.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Box/detectCollision.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Box](#tapspacegeometrybox):[equal](#tapspacegeometryboxequal)(b) + +Test if this box is strictly equal with the given box b. +Strict equality requires that the boxes are on the same basis +and have strictly equal size, position, and orientation. + +

Parameters:

+ +- *b* + - a [Box](#tapspacegeometrybox) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Box/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Box](#tapspacegeometrybox):[fromBoxes](#tapspacegeometryboxfromboxes)(basis, boxes) @@ -6820,11 +6927,13 @@ A circle tensor. The circle is a flat round shape in 3D space.

Contents:

+- [tapspace.geometry.Circle:almostEqual](#tapspacegeometrycirclealmostequal) - [tapspace.geometry.Circle:atArc](#tapspacegeometrycircleatarc) - [tapspace.geometry.Circle:atCenter](#tapspacegeometrycircleatcenter) - [tapspace.geometry.Circle:atMid](#tapspacegeometrycircleatmid) - [tapspace.geometry.Circle:changeBasis](#tapspacegeometrycirclechangebasis) - [tapspace.geometry.Circle:detectCollision](#tapspacegeometrycircledetectcollision) +- [tapspace.geometry.Circle:equal](#tapspacegeometrycircleequal) - [tapspace.geometry.Circle:fromPoints](#tapspacegeometrycirclefrompoints) - [tapspace.geometry.Circle:getArea](#tapspacegeometrycirclegetarea) - [tapspace.geometry.Circle:getBoundingBox](#tapspacegeometrycirclegetboundingbox) @@ -6843,6 +6952,28 @@ A circle tensor. The circle is a flat round shape in 3D space. Source: [Circle/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Circle/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Circle](#tapspacegeometrycircle):[almostEqual](#tapspacegeometrycirclealmostequal)(c[, tolerance]) + +Test if this circle is equal to the given circle c within tolerance. +Almost equality requires identical basis +and that circle radius and position are equal within tolerance. + +

Parameters:

+ +- *c* + - a [Circle](#tapspacegeometrycircle) +- *tolerance* + - optional number. Maximum tolerated distance between values. + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Circle/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Circle](#tapspacegeometrycircle):[atArc](#tapspacegeometrycircleatarc)(dir) @@ -6919,6 +7050,26 @@ Note that not all geometries are supported, see below. Source: [detectCollision.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Circle/detectCollision.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Circle](#tapspacegeometrycircle):[equal](#tapspacegeometrycircleequal)(c) + +Test if this circle is strictly equal with the given circle c. +Strict equality requires that the circles are on the same basis +and have strictly equal radius and position. + +

Parameters:

+ +- *c* + - a [Circle](#tapspacegeometrycircle) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Circle/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Circle](#tapspacegeometrycircle):[fromPoints](#tapspacegeometrycirclefrompoints)(basis, points) @@ -7148,9 +7299,11 @@ space and therefore they need conversion when transited between planes.

Contents:

+- [tapspace.geometry.Direction:almostEqual](#tapspacegeometrydirectionalmostequal) - [tapspace.geometry.Direction:basis](#tapspacegeometrydirectionbasis) - [tapspace.geometry.Direction:changeBasis](#tapspacegeometrydirectionchangebasis) - [tapspace.geometry.Direction:dir](#tapspacegeometrydirectiondir) +- [tapspace.geometry.Direction:equal](#tapspacegeometrydirectionequal) - [tapspace.geometry.Direction:fromSpherical](#tapspacegeometrydirectionfromspherical) - [tapspace.geometry.Direction:fromVector](#tapspacegeometrydirectionfromvector) - [tapspace.geometry.Direction:getRaw](#tapspacegeometrydirectiongetraw) @@ -7160,6 +7313,28 @@ space and therefore they need conversion when transited between planes. Source: [Direction/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Direction/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Direction](#tapspacegeometrydirection):[almostEqual](#tapspacegeometrydirectionalmostequal)(dir[, tolerance]) + +Test if this direction is equal to a given direction within tolerance. +Equality requires strictly equal basis and that the distance between coordinates +is within the tolerance. + +

Parameters:

+ +- *dir* + - a [Direction](#tapspacegeometrydirection) +- *tolerance* + - optional number + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Direction/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Direction](#tapspacegeometrydirection):[basis](#tapspacegeometrydirectionbasis) @@ -7190,6 +7365,25 @@ Property for the unit vector, affineplane.dir3. Usage: `dir.dir`. Source: [Direction/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Direction/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Direction](#tapspacegeometrydirection):[equal](#tapspacegeometrydirectionequal)(dir) + +Test if this direction is strictly equal to a given direction. +Strict equality requires strictly equal basis and coordinates. + +

Parameters:

+ +- *dir* + - a [Direction](#tapspacegeometrydirection) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Direction/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Direction](#tapspacegeometrydirection):[fromSpherical](#tapspacegeometrydirectionfromspherical)(basis, theta, phi) @@ -7304,6 +7498,7 @@ not affect the distance. Only the scale does. - [tapspace.geometry.Distance:changeBasis](#tapspacegeometrydistancechangebasis) +- [tapspace.geometry.Distance:equal](#tapspacegeometrydistanceequal) - [tapspace.geometry.Distance:getNumber](#tapspacegeometrydistancegetnumber) - [tapspace.geometry.Distance:getRaw](#tapspacegeometrydistancegetraw) - [tapspace.geometry.Distance:getVector](#tapspacegeometrydistancegetvector) @@ -7336,6 +7531,25 @@ Source: [Distance/index.js](https://github.com/taataa/tapspace/blob/master/lib/g Source: [changeBasis.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Distance/changeBasis.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Distance](#tapspacegeometrydistance):[equal](#tapspacegeometrydistanceequal)(dist) + +Test if this distance is strictly equal to the given distance. +Strict equality requires strictly equal basis and numerical distance. + +

Parameters:

+ +- *dist* + - a [Distance](#tapspacegeometrydistance) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Distance/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Distance](#tapspacegeometrydistance):[getNumber](#tapspacegeometrydistancegetnumber)() @@ -7572,8 +7786,10 @@ space and therefore they need conversion when transited between bases.

Contents:

+- [tapspace.geometry.Orientation:almostEqual](#tapspacegeometryorientationalmostequal) - [tapspace.geometry.Orientation:basis](#tapspacegeometryorientationbasis) - [tapspace.geometry.Orientation:changeBasis](#tapspacegeometryorientationchangebasis) +- [tapspace.geometry.Orientation:equal](#tapspacegeometryorientationequal) - [tapspace.geometry.Orientation:getRaw](#tapspacegeometryorientationgetraw) - [tapspace.geometry.Orientation:orient](#tapspacegeometryorientationorient) - [tapspace.geometry.Orientation:transitRaw](#tapspacegeometryorientationtransitraw) @@ -7586,6 +7802,28 @@ space and therefore they need conversion when transited between bases. Source: [Orientation/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Orientation/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Orientation](#tapspacegeometryorientation):[almostEqual](#tapspacegeometryorientationalmostequal)(orient[, tolerance]) + +Test if this orientation is equal to a given orientation within tolerance. +Equality requires strictly equal basis and that the difference in orientation +is within the tolerance. + +

Parameters:

+ +- *orient* + - an [Orientation](#tapspacegeometryorientation) +- *tolerance* + - optional number + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Orientation/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Orientation](#tapspacegeometryorientation):[basis](#tapspacegeometryorientationbasis) @@ -7609,6 +7847,25 @@ Source: [Orientation/index.js](https://github.com/taataa/tapspace/blob/master/li Source: [changeBasis.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Orientation/changeBasis.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Orientation](#tapspacegeometryorientation):[equal](#tapspacegeometryorientationequal)(orient) + +Test if this orientation is strictly equal to a given orientation. +Strict equality requires identical basis and orientation values. + +

Parameters:

+ +- *orient* + - an [Orientation](#tapspacegeometryorientation) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Orientation/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Orientation](#tapspacegeometryorientation):[getRaw](#tapspacegeometryorientationgetraw)() @@ -7819,7 +8076,9 @@ let p = new tapspace.geometry.Point(basis, { x: 1, y: 2, z: 3 }) - [tapspace.geometry.Point:addVector](#tapspacegeometrypointaddvector) +- [tapspace.geometry.Point:almostEqual](#tapspacegeometrypointalmostequal) - [tapspace.geometry.Point:changeBasis](#tapspacegeometrypointchangebasis) +- [tapspace.geometry.Point:equal](#tapspacegeometrypointequal) - [tapspace.geometry.Point:getDirectionTo](#tapspacegeometrypointgetdirectionto) - [tapspace.geometry.Point:getDistanceTo](#tapspacegeometrypointgetdistanceto) - [tapspace.geometry.Point:getRaw](#tapspacegeometrypointgetraw) @@ -7857,6 +8116,29 @@ Translate the point by a vector. Source: [addVector.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Point/addVector.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Point](#tapspacegeometrypoint):[almostEqual](#tapspacegeometrypointalmostequal)(p[, tolerance]) + +Test if the point is almost equal to p. +Almost equal requires strictly equal basis and +that coordinates are equal within tolerance. + +

Parameters:

+ +- *p* + - a [Point](#tapspacegeometrypoint) +- *tolerance* + - optional number. Maximum Manhattan distance between this and p. + - Default is affineplane.epsilon + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Point/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Point](#tapspacegeometrypoint):[changeBasis](#tapspacegeometrypointchangebasis)(newBasis) @@ -7873,6 +8155,25 @@ Source: [addVector.js](https://github.com/taataa/tapspace/blob/master/lib/geomet Source: [changeBasis.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Point/changeBasis.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Point](#tapspacegeometrypoint):[equal](#tapspacegeometrypointequal)(p) + +Test if the point is strictly equal to p. +Strict equality requires strictly equal basis and coordinates. + +

Parameters:

+ +- *p* + - a [Point](#tapspacegeometrypoint) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Point/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Point](#tapspacegeometrypoint):[getDirectionTo](#tapspacegeometrypointgetdirectionto)(p) @@ -8373,7 +8674,9 @@ between bases.

Contents:

+- [tapspace.geometry.Size:almostEqual](#tapspacegeometrysizealmostequal) - [tapspace.geometry.Size:changeBasis](#tapspacegeometrysizechangebasis) +- [tapspace.geometry.Size:equal](#tapspacegeometrysizeequal) - [tapspace.geometry.Size:getArea](#tapspacegeometrysizegetarea) - [tapspace.geometry.Size:getRaw](#tapspacegeometrysizegetraw) - [tapspace.geometry.Size:normAt](#tapspacegeometrysizenormat) @@ -8383,6 +8686,28 @@ between bases. Source: [Size/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Size/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Size](#tapspacegeometrysize):[almostEqual](#tapspacegeometrysizealmostequal)(s[, tolerance]) + +Test if this size is equal to the given size s within tolerance. +Equality requires strictly equal basis and that the difference in size +is within the tolerance. + +

Parameters:

+ +- *s* + - a [Size](#tapspacegeometrysize) +- *tolerance* + - optional number + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Size/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Size](#tapspacegeometrysize):[changeBasis](#tapspacegeometrysizechangebasis)(newBasis) @@ -8402,6 +8727,26 @@ when the bases have same orientation. Rotation cannot be applied to size. Source: [changeBasis.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Size/changeBasis.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Size](#tapspacegeometrysize):[equal](#tapspacegeometrysizeequal)(s) + +Test if this size is strictly equal to the given size s. +Strict equality requires identical basis and size properties. +Additional properties are allowed. + +

Parameters:

+ +- *s* + - a [Size](#tapspacegeometrysize) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Size/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Size](#tapspacegeometrysize):[getArea](#tapspacegeometrysizegetarea)() @@ -8501,10 +8846,12 @@ the at() method for example.

Contents:

+- [tapspace.geometry.Sphere:almostEqual](#tapspacegeometryspherealmostequal) - [tapspace.geometry.Sphere:atCenter](#tapspacegeometrysphereatcenter) - [tapspace.geometry.Sphere:atMid](#tapspacegeometrysphereatmid) - [tapspace.geometry.Sphere:changeBasis](#tapspacegeometryspherechangebasis) - [tapspace.geometry.Sphere:detectCollision](#tapspacegeometryspheredetectcollision) +- [tapspace.geometry.Sphere:equal](#tapspacegeometrysphereequal) - [tapspace.geometry.Sphere:fromPoints](#tapspacegeometryspherefrompoints) - [tapspace.geometry.Sphere:getBoundingBox](#tapspacegeometryspheregetboundingbox) - [tapspace.geometry.Sphere:getDepth](#tapspacegeometryspheregetdepth) @@ -8523,6 +8870,28 @@ the at() method for example. Source: [Sphere/index.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Sphere/index.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Sphere](#tapspacegeometrysphere):[almostEqual](#tapspacegeometryspherealmostequal)(s[, tolerance]) + +Test if this sphere is equal to the given sphere s within tolerance. +Almost equality requires identical basis +and that radius and position of the spheres are equal within tolerance. + +

Parameters:

+ +- *s* + - a [Sphere](#tapspacegeometrysphere) +- *tolerance* + - optional number. Maximum tolerated distance between values. + + +

Returns:

+ +- a boolean + + +Source: [almostEqual.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Sphere/almostEqual.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Sphere](#tapspacegeometrysphere):[atCenter](#tapspacegeometrysphereatcenter)() @@ -8580,6 +8949,26 @@ Note that not all geometries are supported, see below. Source: [detectCollision.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Sphere/detectCollision.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Sphere](#tapspacegeometrysphere):[equal](#tapspacegeometrysphereequal)(s) + +Test if this sphere is strictly equal with the given sphere s. +Strict equality requires that the spheres are on the same basis +and have strictly equal radius and position. + +

Parameters:

+ +- *s* + - a [Sphere](#tapspacegeometrysphere) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Sphere/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Sphere](#tapspacegeometrysphere):[fromPoints](#tapspacegeometryspherefrompoints)(basis, points) @@ -8965,6 +9354,7 @@ The vector has length and direction but no position. - [tapspace.geometry.Vector:cross](#tapspacegeometryvectorcross) - [tapspace.geometry.Vector:difference](#tapspacegeometryvectordifference) - [tapspace.geometry.Vector:dot](#tapspacegeometryvectordot) +- [tapspace.geometry.Vector:equal](#tapspacegeometryvectorequal) - [tapspace.geometry.Vector:getDirection](#tapspacegeometryvectorgetdirection) - [tapspace.geometry.Vector:getDistance](#tapspacegeometryvectorgetdistance) - [tapspace.geometry.Vector:getRaw](#tapspacegeometryvectorgetraw) @@ -9110,6 +9500,25 @@ Get dot product with another vector. Source: [dot.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Vector/dot.js) + +## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Vector](#tapspacegeometryvector):[equal](#tapspacegeometryvectorequal)(v) + +Test if the vector is strictly equal to v. +Strict equality requires strictly equal basis and numerical components. + +

Parameters:

+ +- *v* + - a [Vector](#tapspacegeometryvector) + + +

Returns:

+ +- a boolean + + +Source: [equal.js](https://github.com/taataa/tapspace/blob/master/lib/geometry/Vector/equal.js) + ## [tapspace](#tapspace).[geometry](#tapspacegeometry).[Vector](#tapspacegeometryvector):[getDirection](#tapspacegeometryvectorgetdirection)() From 3b498987092ed7d12b2881c1a201a256c3c76173 Mon Sep 17 00:00:00 2001 From: Akseli Palen Date: Fri, 17 Jan 2025 21:38:18 +0200 Subject: [PATCH 118/118] bump v2.0.0-alpha.24 --- docs/api/v2/index.md | 2 +- lib/version.js | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api/v2/index.md b/docs/api/v2/index.md index 96f2bfed..26a66973 100644 --- a/docs/api/v2/index.md +++ b/docs/api/v2/index.md @@ -1,5 +1,5 @@ -# Tapspace API Documentation v2.0.0-alpha.23 +# Tapspace API Documentation v2.0.0-alpha.24 Choose version: [v1](https://taataa.github.io/tapspace/api/) – [v2](#) diff --git a/lib/version.js b/lib/version.js index dfcf138d..de10a586 100644 --- a/lib/version.js +++ b/lib/version.js @@ -1,2 +1,2 @@ // Generated by genversion. -module.exports = '2.0.0-alpha.23' +module.exports = '2.0.0-alpha.24' diff --git a/package.json b/package.json index beac5eab..cd005f70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tapspace", - "version": "2.0.0-alpha.23", + "version": "2.0.0-alpha.24", "description": "A zoomable user interface lib for web apps", "keywords": [ "zoomable",