Implement HtmlCanvas; move some tests to commonTest

This commit is contained in:
2019-04-09 06:39:38 -05:00
parent 7ba7edb7d4
commit 5c402b5400
17 changed files with 288 additions and 64 deletions

View File

@@ -10,12 +10,10 @@ core:
$(test_bundle): test/index.js core
mkdir -p build/bundles
npx webpack $< --silent --mode production --output $@
npx webpack $< --silent --mode development --target web --output $@
test: $(test_bundle) $(node_modules)
mkdir -p build/reports
npx mocha $@ --reporter xunit > build/reports/tests.xml
npx mocha $@
open test/index.html
clean:
rm -rf build

5
web/package-lock.json generated
View File

@@ -2231,6 +2231,11 @@
"readable-stream": "^2.3.6"
}
},
"fontawesome": {
"version": "5.6.3",
"resolved": "https://registry.npmjs.org/fontawesome/-/fontawesome-5.6.3.tgz",
"integrity": "sha512-FCc+CawwsJWWprVEg9X14yI7zI+l9YVAyhzgu70qwGeDn0tLLDH/dVfqgij72g4BBGgLGfK2qnvFGAmYUkhaWg=="
},
"for-in": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",

BIN
web/test/FontAwesome.ttf Normal file

Binary file not shown.

21
web/test/canvas.html Normal file
View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>Canvas Test</title>
<style>
@font-face {
font-family: "FontAwesome";
src: url(FontAwesome.ttf) format("truetype");
}
</style>
</head>
<body>
<script src="../build/bundles/test.js"></script>
<canvas id="canvas" width=500 height=400></canvas>
<script>
const canvas = document.getElementById('canvas');
const test = new document.coreTest.org.isoron.platform.gui.HtmlCanvasTest(canvas);
test.testDrawing();
</script>
</body>
</html>

15
web/test/index.html Normal file
View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Mocha Tests</title>
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
</head>
<body>
<div id="mocha"></div>
<script src="../node_modules/mocha/mocha.js"></script>
<script src="../node_modules/chai/chai.js"></script>
<script>mocha.setup('bdd')</script>
<script src="../build/bundles/test.js"></script>
<script>mocha.run();</script>
</body>
</html>

View File

@@ -1,2 +1,3 @@
var assert = require('assert');
var coreTest = require('core_test');
document.coreTest = coreTest