From ed5c15b6af7dbe603b5544a946312522e0b0c325 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Mon, 12 Apr 2021 15:42:10 +0100 Subject: [PATCH 1/7] Minor documentation updates --- README.md | 6 ++++++ docs/development.md | 4 ++++ docs/docker.md | 2 ++ docs/install.md | 11 +++++------ docs/sane.md | 2 ++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index eda2f91f..b39e26a1 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ more scanners (using SANE) on a network without the need for drivers or complicated installation. ### Features + * Cropping * Source selection (Flatbed / ADF) * Resolution @@ -39,6 +40,7 @@ It supports any Copyright 2016-2021 [Sam Strachan](https://github.com/sbs20) ## Requirements + * SANE Scanner * Linux host (or VM with necessary pass-through e.g. USB) * Software sane-utils, ImageMagick, Tesseract (optional) and nodejs @@ -51,6 +53,7 @@ Copyright 2016-2021 [Sam Strachan](https://github.com/sbs20) * [Configuring the scanner and SANE](docs/sane.md) ## Configuration and device override + If you want to override some specific configuration setting then you can do so within `./config/config.local.js`. Take a copy of `./config/config.default.js` and override the sections you want. Using docker you will need to map the volume @@ -100,6 +103,7 @@ module.exports = { ``` ## Why? + This is yet another scanimage-web-front-end. Why? It originally started as an adaptation of phpsane - just to make everything a bit newer, give it a refresh and make it work on minimal installations without imagemagick - that version is @@ -108,6 +112,7 @@ maintained. Since then, I just wanted to write it in node and enhance it a bit, and it's been a labour of love ever since. ## Acknowledgements + * This project owes its genesis to [phpsane](http://sourceforge.net/projects/phpsane/) * [Everyone](https://github.com/sbs20/scanservjs/graphs/contributors) who has @@ -115,4 +120,5 @@ and it's been a labour of love ever since. years. Thank you! ## More about SANE + * http://www.sane-project.org/ \ No newline at end of file diff --git a/docs/development.md b/docs/development.md index 23302d8f..e4e05dd3 100644 --- a/docs/development.md +++ b/docs/development.md @@ -11,6 +11,7 @@ ``` ## Run for development + ``` cd webui && npm run serve ``` @@ -31,10 +32,12 @@ cd server && gulp release ``` ## Updating node dependencies + * `npm audit fix` or `npm update`. This won't remove old packages; to do so, delete node_modules and reinstall ## References + * [Run server with webpack](https://dennisreimann.de/articles/vue-cli-serve-express.html) * [i18n](https://www.codeandweb.com/babeledit/tutorials/how-to-translate-your-vue-app-with-vue-i18n) @@ -82,6 +85,7 @@ docker image prune ``` ## Mount map configuration files + ``` docker run -d \ -p 8080:8080 \ diff --git a/docs/docker.md b/docs/docker.md index c5592839..a9b1c2ce 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -127,6 +127,7 @@ docker run -d \ ``` ### Use airscan and a locally detected scanner + This should support most use cases ```sh @@ -136,6 +137,7 @@ docker run -d -p 8080:8080 \ ``` ### A bit of everything + Add two net hosts to sane, use airscan to connect to two remote scanners, don't use `scanimage -L`, force a list of devices, override the OCR language and run in privileged mode diff --git a/docs/install.md b/docs/install.md index eca815c8..c5b01f67 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,9 +1,6 @@ -# installation +# Standard installation -The easiest way to run is with Docker. But it's still possible to setup -manually. - -## Manual Steps +## One line install * If you don't already have your scanner working, then you need to get [SANE installed and working](./sane.md) and check permissions etc. Your @@ -17,7 +14,7 @@ manually. * If you're using another distro, then for the time being you either need to manually run the steps in the install script or use docker. -## Download and install +## Manual download and install If you don't fancy running a script directly from `curl` then you can manually download the package and then run the installer inside. @@ -52,6 +49,7 @@ debug where the problem is: `sudo journalctl -e -u scanservjs` should be enough to get you started. ## Old Debian + For more on problems installing an up to date nodejs on Debian which includes `npm`. See [here](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions) @@ -72,5 +70,6 @@ See for more details. ## Arch + If you're using Arch, you probably don't need help but this worked a few years ago `sudo pacman -S nodejs npm sane-utils imagemagick curl` \ No newline at end of file diff --git a/docs/sane.md b/docs/sane.md index 27a93eda..2d395c28 100644 --- a/docs/sane.md +++ b/docs/sane.md @@ -129,6 +129,7 @@ then feel free to raise and issues or PR. * `scanimage -L` ### Get permissions working + Pretend to be httpduser ``` sudo -i -u httpdusr @@ -172,6 +173,7 @@ chgrp scanner /proc/usb/003/003 ``` ## Raspberry Pi + USB-only scanners draw a lot of current relative to the Pi's available power. This can manifest itself in unusual scans - technically valid images but with odd colours and block transforms. Consider using a powered USB hub (e.g. for a From c65b41a0901834f6d3beb21ae47c3943bcb5be30 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Mon, 12 Apr 2021 21:25:49 +0100 Subject: [PATCH 2/7] Installer update --- server/bin/installer.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/bin/installer.sh b/server/bin/installer.sh index 1af128bb..c47e477b 100644 --- a/server/bin/installer.sh +++ b/server/bin/installer.sh @@ -30,8 +30,10 @@ install() { if [ -d "$location" ]; then # keep config and data mkdir -p $tmp - cp -a -v $location/config $tmp - cp -a -v $location/data $tmp + + echo "Backing up existing files" + cp -a $location/config $tmp + cp -a $location/data $tmp # stop the service if [ "$(systemctl is-active scanservjs 2>&1 | tr -s \\n)" = "active" ]; then @@ -70,6 +72,7 @@ install() { # Restore files if [ -d "$tmp" ]; then + echo "Restoring files" cp -a -v $tmp/config $location/ cp -a -v $tmp/data $location/ fi From 0db41a58b87b7ac65cc5b3a0b03c662a307da65c Mon Sep 17 00:00:00 2001 From: sbs20 Date: Tue, 13 Apr 2021 14:41:05 +0100 Subject: [PATCH 3/7] Scan geometry rounding #118 --- server/src/device.js | 2 +- webui/src/components/Scan.vue | 91 +++++++++++++++++++++-------------- 2 files changed, 55 insertions(+), 38 deletions(-) diff --git a/server/src/device.js b/server/src/device.js index a3765def..8eab19ee 100644 --- a/server/src/device.js +++ b/server/src/device.js @@ -6,7 +6,7 @@ const Config = require('./config'); * @returns {number} */ function round(n) { - return Math.floor(n); + return Math.round(n * 10) / 10; } class Feature { diff --git a/webui/src/components/Scan.vue b/webui/src/components/Scan.vue index 4b424864..89f4a452 100644 --- a/webui/src/components/Scan.vue +++ b/webui/src/components/Scan.vue @@ -116,14 +116,6 @@ import Storage from '../classes/storage'; const storage = Storage.instance(); -/** - * @param {number} n - * @returns {number} - */ -function round(n) { - return Math.round(n); -} - export default { name: 'Scan', components: { @@ -274,19 +266,53 @@ export default { }); }, + pixelsPerMm() { + const scanner = { + width: this.device.features['-x'].limits[1], + height: this.device.features['-y'].limits[1] + }; + + // The preview image may not have perfectly scaled dimensions + // because pixel counts are integers. So we report a horizontal + // and vertical resolution + const image = this.$refs.cropper.imageSize; + return { + x: image.width / scanner.width, + y: image.height / scanner.height + }; + }, + + scaleCoordinates(coordinates, xScale, yScale) { + const round = (n) => Math.round(n * 10) / 10; + return { + width: round(coordinates.width * xScale), + height: round(coordinates.height * yScale), + left: round(coordinates.left * xScale), + top: round(coordinates.top * yScale) + }; + }, + cropperDefaultPosition() { - const adjust = (n) => round(n * this.pixelsPerMm()); + const adjusted = this.scaleCoordinates( + this.request.params, + this.pixelsPerMm().x, + this.pixelsPerMm().y); + return { - left: adjust(this.request.params.left), - top: adjust(this.request.params.top) + left: adjusted.left, + top: adjusted.top }; }, cropperDefaultSize() { - const adjust = (n) => round(n * this.pixelsPerMm()); + const adjusted = this.scaleCoordinates( + this.request.params, + this.pixelsPerMm().x, + this.pixelsPerMm().y); + return { - width: adjust(this.request.params.width), - height: adjust(this.request.params.height) + width: adjusted.width, + height: adjusted.height }; }, @@ -299,34 +325,25 @@ export default { }, onCoordinatesChange() { - const adjust = (n) => round(n * this.pixelsPerMm()); - const params = this.request.params; - const adjusted = { - width: adjust(params.width), - height: adjust(params.height), - left: adjust(params.left), - top: adjust(params.top) - }; + const adjusted = this.scaleCoordinates( + this.request.params, + this.pixelsPerMm().x, + this.pixelsPerMm().y); + this.$refs.cropper.setCoordinates(adjusted); }, onCrop({coordinates}) { - const adjust = (n) => round(n / this.pixelsPerMm()); - const params = this.request.params; - params.width = adjust(coordinates.width); - params.height = adjust(coordinates.height); - params.left = adjust(coordinates.left); - params.top = adjust(coordinates.top); - }, + const adjusted = this.scaleCoordinates( + coordinates, + 1 / this.pixelsPerMm().x, + 1 / this.pixelsPerMm().y); - pixelsPerMm() { - const scanner = { - width: this.device.features['-x'].limits[1], - height: this.device.features['-y'].limits[1] - }; - - const image = this.$refs.cropper.imageSize; - return image.height / scanner.height; + const params = this.request.params; + params.width = adjusted.width; + params.height = adjusted.height; + params.left = adjusted.left; + params.top = adjusted.top; }, readContext(force) { From 362b30db4ff81594c696dbae159935603a975f8b Mon Sep 17 00:00:00 2001 From: sbs20 Date: Tue, 13 Apr 2021 14:41:54 +0100 Subject: [PATCH 4/7] Version bump --- server/package-lock.json | 2 +- server/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/package-lock.json b/server/package-lock.json index ed19d4c1..5c50769e 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,6 +1,6 @@ { "name": "scanservjs-server", - "version": "2.9.0", + "version": "2.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/server/package.json b/server/package.json index 5a8df9ac..16bba0ab 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs-server", - "version": "2.9.0", + "version": "2.9.1", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation. scanserv does not do image conversion or manipulation (beyond the bare minimum necessary for the purposes of browser preview) or OCR.", "scripts": { "serve": "nodemon --exec 'vue-cli-service serve'", From eded96f84f5edb7626b44e9d33c93a0ae4c26c22 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Tue, 13 Apr 2021 15:20:30 +0100 Subject: [PATCH 5/7] Filter translations #189 --- server/src/config.js | 6 +++--- webui/src/components/Scan.vue | 2 +- webui/src/locales/cn.json | 9 ++++++--- webui/src/locales/cz.json | 9 ++++++--- webui/src/locales/de.json | 9 ++++++--- webui/src/locales/en.json | 9 ++++++--- webui/src/locales/es.json | 9 ++++++--- webui/src/locales/fr.json | 9 ++++++--- webui/src/locales/it.json | 9 ++++++--- webui/src/locales/test.json | 9 ++++++--- 10 files changed, 52 insertions(+), 28 deletions(-) diff --git a/server/src/config.js b/server/src/config.js index 68884878..c36be5f6 100644 --- a/server/src/config.js +++ b/server/src/config.js @@ -56,15 +56,15 @@ class Config { filters: [ { - description: 'filters:auto-level', + description: 'filter.auto-level', params: '-auto-level' }, { - description: 'filters:threshold', + description: 'filter.threshold', params: '-channel RGB -threshold 80%' }, { - description: 'filters:blur', + description: 'filter.blur', params: '-blur 1' } ], diff --git a/webui/src/components/Scan.vue b/webui/src/components/Scan.vue index 89f4a452..b7e555c5 100644 --- a/webui/src/components/Scan.vue +++ b/webui/src/components/Scan.vue @@ -162,7 +162,7 @@ export default { filters() { return this.context.filters.map(f => { return { - text: this.$t(`scan.${f}`), + text: this.$t(f), value: f }; }); diff --git a/webui/src/locales/cn.json b/webui/src/locales/cn.json index f17d1d0d..0d912844 100644 --- a/webui/src/locales/cn.json +++ b/webui/src/locales/cn.json @@ -29,6 +29,12 @@ "version": "版本" }, + "filter": { + "auto-level": "自动调整", + "threshold": "阈值", + "blur": "模糊" + }, + "pipeline": { "high-quality": "高画质", "medium-quality": "中画质", @@ -54,9 +60,6 @@ "batch:auto-collate-standard": "自动 (标准校对 1, 3... 4, 2)", "batch:auto-collate-reverse": "自动 (逆向校对 1, 3... 2, 4)", "filters": "滤镜", - "filters:auto-level": "自动调整", - "filters:threshold": "阈值", - "filters:blur": "模糊", "format": "格式", "btn-preview": "预览", "btn-clear": "清除", diff --git a/webui/src/locales/cz.json b/webui/src/locales/cz.json index bd1420b9..99071d04 100644 --- a/webui/src/locales/cz.json +++ b/webui/src/locales/cz.json @@ -29,6 +29,12 @@ "version": "Verze" }, + "filter": { + "auto-level": "Automatické zarovnání", + "threshold": "Prahová hodnota barev", + "blur": "Rozmazané" + }, + "pipeline": { "high-quality": "Vysoká kvalita", "medium-quality": "Střední kvalita", @@ -54,9 +60,6 @@ "batch:auto-collate-standard": "Automatický (Kompletovat 1, 3... 4, 2)", "batch:auto-collate-reverse": "Automatický (Obrátit 1, 3... 2, 4)", "filters": "Filtry", - "filters:auto-level": "Automatické zarovnání", - "filters:threshold": "Prahová hodnota barev", - "filters:blur": "Rozmazané", "format": "Formát", "btn-preview": "Načíst náhled", "btn-clear": "Vymazat", diff --git a/webui/src/locales/de.json b/webui/src/locales/de.json index 278c81c2..bb55abc1 100644 --- a/webui/src/locales/de.json +++ b/webui/src/locales/de.json @@ -29,6 +29,12 @@ "version": "Version" }, + "filter": { + "auto-level": "Automatische Farbjustierung", + "threshold": "Schwellwert", + "blur": "Weichzeichner" + }, + "pipeline": { "high-quality": "Hohe Qualität", "medium-quality": "Mittlere Qualität", @@ -54,9 +60,6 @@ "batch:auto-collate-standard": "Automatisch (Sortiert 1, 3... 4, 2)", "batch:auto-collate-reverse": "Automatisch (umgekehrte Reihenfolge 1, 3... 2, 4)", "filters": "Filter", - "filters:auto-level": "Automatische Farbjustierung", - "filters:threshold": "Schwellwert", - "filters:blur": "Weichzeichner", "format": "Format", "btn-preview": "Vorschau", "btn-clear": "Leeren", diff --git a/webui/src/locales/en.json b/webui/src/locales/en.json index 6be55b35..57fe587b 100644 --- a/webui/src/locales/en.json +++ b/webui/src/locales/en.json @@ -29,6 +29,12 @@ "version": "Version" }, + "filter": { + "auto-level": "Auto level", + "threshold": "Threshold", + "blur": "Blur" + }, + "pipeline": { "high-quality": "High quality", "medium-quality": "Medium quality", @@ -54,9 +60,6 @@ "batch:auto-collate-standard": "Auto (Collate 1, 3... 4, 2)", "batch:auto-collate-reverse": "Auto (Reverse 1, 3... 2, 4)", "filters": "Filters", - "filters:auto-level": "Auto level", - "filters:threshold": "Threshold", - "filters:blur": "Blur", "format": "Format", "btn-preview": "Preview", "btn-clear": "Clear", diff --git a/webui/src/locales/es.json b/webui/src/locales/es.json index 9a64d44e..90bb4609 100644 --- a/webui/src/locales/es.json +++ b/webui/src/locales/es.json @@ -29,6 +29,12 @@ "version": "Versión" }, + "filter": { + "auto-level": "Autonivelar", + "threshold": "Umbral", + "blur": "Difuminar" + }, + "pipeline": { "high-quality": "Calidad alta", "medium-quality": "Calidad media", @@ -54,9 +60,6 @@ "batch:auto-collate-standard": "Auto (ordenación 1, 3... 4, 2)", "batch:auto-collate-reverse": "Auto (inversa 1, 3... 2, 4)", "filters": "Filtros", - "filters:auto-level": "Autonivelar", - "filters:threshold": "Umbral", - "filters:blur": "Difuminar", "format": "Formato", "btn-preview": "Vista previa", "btn-clear": "Limpiar", diff --git a/webui/src/locales/fr.json b/webui/src/locales/fr.json index b13cfaef..2eeadc8e 100644 --- a/webui/src/locales/fr.json +++ b/webui/src/locales/fr.json @@ -29,6 +29,12 @@ "version": "Version" }, + "filter": { + "auto-level": "Automatique", + "threshold": "Seuil", + "blur": "Flou" + }, + "pipeline": { "high-quality": "Qualité élevée", "medium-quality": "Qualité moyenne", @@ -54,9 +60,6 @@ "batch:auto-collate-standard": "Assemblage auto (Standard 1, 3... 4, 2)", "batch:auto-collate-reverse": "Assemblage auto (Inversé 1, 3... 2, 4)", "filters": "Filtres", - "filters:auto-level": "Automatique", - "filters:threshold": "Seuil", - "filters:blur": "Flou", "format": "Format", "btn-preview": "Pré-visualiser", "btn-clear": "Effacer", diff --git a/webui/src/locales/it.json b/webui/src/locales/it.json index fdef18bf..3f82c278 100644 --- a/webui/src/locales/it.json +++ b/webui/src/locales/it.json @@ -29,6 +29,12 @@ "version": "Versione" }, + "filter": { + "auto-level": "Livello automatico", + "threshold": "Soglia", + "blur": "Sfocatura" + }, + "pipeline": { "high-quality": "Qualità alta", "medium-quality": "Qualità media", @@ -54,9 +60,6 @@ "batch:auto-collate-standard": "Automatico (Fascicola 1, 3... 4, 2)", "batch:auto-collate-reverse": "Automatico (Inverso 1, 3... 2, 4)", "filters": "Filtri", - "filters:auto-level": "Livello automatico", - "filters:threshold": "Soglia", - "filters:blur": "Sfocatura", "format": "Formato", "btn-preview": "Anteprima", "btn-clear": "Cancella", diff --git a/webui/src/locales/test.json b/webui/src/locales/test.json index 19a4eb89..4f0b4de2 100644 --- a/webui/src/locales/test.json +++ b/webui/src/locales/test.json @@ -30,6 +30,12 @@ "version": "##VERSION" }, + "filter": { + "auto-level": "##SCAN.FILTERS:AUTO-LEVEL", + "threshold": "##SCAN.FILTERS:THRESHOLD", + "blur": "##SCAN.FILTERS:BLUR" + }, + "pipeline": { "high-quality": "##HIGH-QUALITY", "medium-quality": "##MEDIUM-QUALITY", @@ -55,9 +61,6 @@ "batch:auto-collate-standard": "##COLLATE-STANDARD", "batch:auto-collate-reverse": "##COLLATE-REVERSE", "filters": "##SCAN.FILTERS", - "filters:auto-level": "##SCAN.FILTERS:AUTO-LEVEL", - "filters:threshold": "##SCAN.FILTERS:THRESHOLD", - "filters:blur": "##SCAN.FILTERS:BLUR", "format": "##SCAN.FORMAT", "btn-preview": "##PREVIEW", "btn-clear": "##CLEAR", From 7483e0280b6ebff3442159ba778b0e74c9b0a287 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Tue, 13 Apr 2021 20:57:23 +0100 Subject: [PATCH 6/7] Floor to 1dp #118 --- server/src/device.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/device.js b/server/src/device.js index 8eab19ee..10347734 100644 --- a/server/src/device.js +++ b/server/src/device.js @@ -6,7 +6,7 @@ const Config = require('./config'); * @returns {number} */ function round(n) { - return Math.round(n * 10) / 10; + return Math.floor(n * 10) / 10; } class Feature { From 0f2f91e83aaa59277987ca5a747e2c510e62f071 Mon Sep 17 00:00:00 2001 From: sbs20 Date: Tue, 13 Apr 2021 20:57:38 +0100 Subject: [PATCH 7/7] Unit tests #118 --- server/test/device.test.js | 42 ++++++++++++++++++------------------- server/test/request.test.js | 4 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/server/test/device.test.js b/server/test/device.test.js index 396f02f0..363fd7ba 100644 --- a/server/test/device.test.js +++ b/server/test/device.test.js @@ -25,7 +25,7 @@ describe('Device', () => { assert.strictEqual(device.features['-x'].default, 103); assert.strictEqual(device.features['-y'].limits[0], 0); assert.strictEqual(device.features['-y'].limits[1], 297); - assert.strictEqual(device.features['-y'].default, 76); + assert.strictEqual(device.features['-y'].default, 76.2); assert.strictEqual(device.features['--brightness'].limits[0], -100); assert.strictEqual(device.features['--brightness'].limits[1], 100); assert.strictEqual(device.features['--brightness'].interval, 1); @@ -47,17 +47,17 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [75, 300, 600, 1200]); assert.strictEqual(device.features['--resolution'].default, 75); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-l'].default, 0); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 297); + assert.strictEqual(device.features['-t'].limits[1], 297.1); assert.strictEqual(device.features['-t'].default, 0); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); - assert.strictEqual(device.features['-x'].default, 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); + assert.strictEqual(device.features['-x'].default, 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 297); - assert.strictEqual(device.features['-y'].default, 297); + assert.strictEqual(device.features['-y'].limits[1], 297.1); + assert.strictEqual(device.features['-y'].default, 297.1); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); @@ -73,13 +73,13 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [75, 300, 600, 1200]); assert.strictEqual(device.features['--resolution'].default, 75); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 297); + assert.strictEqual(device.features['-t'].limits[1], 297.1); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 297); + assert.strictEqual(device.features['-y'].limits[1], 297.1); assert.strictEqual(device.features['--brightness'].limits[0], -50); assert.strictEqual(device.features['--brightness'].limits[1], 50); assert.strictEqual(device.features['--brightness'].interval, 1); @@ -102,13 +102,13 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [75, 100, 150, 200, 300, 600, 1200]); assert.strictEqual(device.features['--resolution'].default, 150); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 297); + assert.strictEqual(device.features['-t'].limits[1], 297.1); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 297); + assert.strictEqual(device.features['-y'].limits[1], 297.1); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); @@ -127,11 +127,11 @@ describe('Device', () => { assert.strictEqual(device.features['-l'].limits[0], 0); assert.strictEqual(device.features['-l'].limits[1], 216); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 355); + assert.strictEqual(device.features['-t'].limits[1], 355.6); assert.strictEqual(device.features['-x'].limits[0], 0); assert.strictEqual(device.features['-x'].limits[1], 216); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 355); + assert.strictEqual(device.features['-y'].limits[1], 355.6); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); @@ -148,13 +148,13 @@ describe('Device', () => { assert.deepStrictEqual(device.features['--resolution'].options, [100, 150, 200, 300, 400, 600, 1200, 2400, 4800, 9600]); assert.strictEqual(device.features['--resolution'].default, 200); assert.strictEqual(device.features['-l'].limits[0], 0); - assert.strictEqual(device.features['-l'].limits[1], 215); + assert.strictEqual(device.features['-l'].limits[1], 215.9); assert.strictEqual(device.features['-t'].limits[0], 0); - assert.strictEqual(device.features['-t'].limits[1], 355); + assert.strictEqual(device.features['-t'].limits[1], 355.6); assert.strictEqual(device.features['-x'].limits[0], 0); - assert.strictEqual(device.features['-x'].limits[1], 215); + assert.strictEqual(device.features['-x'].limits[1], 215.9); assert.strictEqual(device.features['-y'].limits[0], 0); - assert.strictEqual(device.features['-y'].limits[1], 355); + assert.strictEqual(device.features['-y'].limits[1], 355.6); assert.strictEqual(device.features['--brightness'], undefined); assert.strictEqual(device.features['--contrast'], undefined); }); diff --git a/server/test/request.test.js b/server/test/request.test.js index d3f27265..1799ebcd 100644 --- a/server/test/request.test.js +++ b/server/test/request.test.js @@ -63,8 +63,8 @@ describe('Request', () => { assert.strictEqual(request.params.resolution, '150'); assert.strictEqual(request.params.left, 0); assert.strictEqual(request.params.top, 0); - assert.strictEqual(request.params.width, 215); - assert.strictEqual(request.params.height, 297); + assert.strictEqual(request.params.width, 215.9); + assert.strictEqual(request.params.height, 297.1); assert.strictEqual(request.params.brightness, undefined); assert.strictEqual(request.params.contrast, undefined); assert.strictEqual(request.params.dynamicLineart, undefined);