Remove tests, they are going to skinview-utils

This commit is contained in:
yushijinhun 2020-01-16 20:25:20 +08:00
parent 0721ac3e76
commit f4565bc99b
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
13 changed files with 18 additions and 5739 deletions

View File

@ -1,58 +0,0 @@
/* eslint-env node */
process.env.CHROME_BIN = require("puppeteer").executablePath();
module.exports = function (config) {
config.set({
basePath: "",
frameworks: ["mocha"],
files: [
"test/test.ts"
],
exclude: [],
preprocessors: {
"test/test.ts": ["webpack"]
},
webpack: {
mode: "development",
module: {
rules: [
{
test: /\.png$/i,
loader: "url-loader"
},
{
test: /\.ts$/,
loader: "ts-loader",
options: {
transpileOnly: true
}
}
]
},
resolve: {
extensions: [".ts", ".js", ".json"]
}
},
webpackMiddleware: {
stats: "errors-only"
},
mime: {
"text/x-typescript": ["ts"]
},
reporters: ["progress"],
port: 9876,
colors: true,
logLevel: config.LOG_WARN,
autoWatch: false,
browsers: ["ChromeHeadlessNoSandbox"],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: "ChromeHeadless",
flags: ["--no-sandbox"]
}
},
singleRun: true,
concurrency: Infinity
});
};

5601
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
"main": "dist/skinview3d.js",
"scripts": {
"build": "rollup -c",
"test": "karma start && npm run lint",
"test": "npm run lint",
"prepublishOnly": "rimraf dist && npm run build",
"lint": "tslint --formatters-dir ./node_modules/tslint-formatter-beauty -t beauty -p .",
"dev": "npm-run-all --parallel watch serve",
@ -33,32 +33,20 @@
"dist"
],
"dependencies": {
"three": "^0.112.1"
"three": "^0.112.1",
"@yushijinhun/skinview-utils": "^0.1.0"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^6.0.0",
"@types/chai": "^4.1.4",
"@types/mocha": "^5.2.5",
"@yushijinhun/skinview-utils": "^0.1.0",
"chai": "^4.2.0",
"karma": "^3.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-mocha": "^1.3.0",
"karma-webpack": "^3.0.0",
"local-web-server": "^2.6.0",
"mocha": "^5.2.0",
"npm-run-all": "^4.1.3",
"puppeteer": "^1.7.0",
"rimraf": "^2.6.2",
"rollup": "^1.27.14",
"rollup-plugin-license": "^0.13.0",
"rollup-plugin-terser": "^5.1.3",
"rollup-plugin-typescript2": "^0.25.3",
"ts-loader": "^5.2.2",
"tslint": "^5.11.0",
"tslint-formatter-beauty": "^3.0.0-beta.2",
"typescript": "^3.7.4",
"url-loader": "^1.1.1",
"webpack": "^4.41.4"
"typescript": "^3.7.4"
}
}

View File

@ -30,7 +30,3 @@ export {
RunningAnimation,
RotatingAnimation
} from "./animation";
export {
isSlimSkin
} from "@yushijinhun/skinview-utils";

View File

@ -1,4 +0,0 @@
extends: ../.eslintrc.js
env:
mocha: true
browser: true

4
test/shims.d.ts vendored
View File

@ -1,4 +0,0 @@
declare module "*.png" {
let content: any;
export default content;
}

View File

@ -1,52 +0,0 @@
/// <reference path="shims.d.ts"/>
import { expect } from "chai";
import { isSlimSkin, loadSkinToCanvas } from "../src/utils";
import skin1_8Default from "./textures/skin-1.8-default-no_hd.png";
import skin1_8Slim from "./textures/skin-1.8-slim-no_hd.png";
import skinOldDefault from "./textures/skin-old-default-no_hd.png";
import skinLegacyHatDefault from "./textures/skin-legacyhat-default-no_hd.png";
describe("detect model of texture", () => {
it("1.8 default", async () => {
const image = document.createElement("img");
image.src = skin1_8Default;
await Promise.resolve();
expect(isSlimSkin(image)).to.equal(false);
});
it("1.8 slim", async () => {
const image = document.createElement("img");
image.src = skin1_8Slim;
await Promise.resolve();
expect(isSlimSkin(image)).to.equal(true);
});
it("old default", async () => {
const image = document.createElement("img");
image.src = skinOldDefault;
await Promise.resolve();
expect(isSlimSkin(image)).to.equal(false);
});
});
describe("process skin texture", () => {
it("clear the hat area of legacy skin", async () => {
const image = document.createElement("img");
image.src = skinLegacyHatDefault;
await Promise.resolve();
const canvas = document.createElement("canvas");
loadSkinToCanvas(canvas, image);
const data = canvas.getContext("2d")!.getImageData(0, 0, 64, 32).data;
const checkArea = (x0, y0, w, h) => {
for (let x = x0; x < x0 + w; x++) {
for (let y = y0; y < y0 + h; y++) {
expect(data[(y * 64 + x) * 4 + 3]).to.equal(0);
}
}
};
checkArea(40, 0, 8 * 2, 8); // top + bottom
checkArea(32, 8, 8 * 4, 8) // right + front + left + back
});
});

View File

@ -1,5 +0,0 @@
|File|Original author|Description|
|----|---------------|-----------|
|`skin-1.8-default-no_hd.png`|ElizaMozi|[Source](http://www.mcbbs.net/thread-705557-1-1.html)(Chinese); [Approval of use](http://www.mcbbs.net/forum.php?mod=viewthread&tid=705557&page=50#pid12693907)(Chinese)|
|`skin-1.8-slim-no_hd.png` |ElizaMozi|Same as above.|
|`skin-old-default-no_hd.png`|Hacksore ||

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 689 B

View File

@ -1,9 +1,5 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:latest"
],
"jsRules": {},
"extends": "tslint:latest",
"rules": {
"curly": false,
"ordered-imports": false,
@ -27,6 +23,5 @@
"max-classes-per-file": false,
"interface-name": false,
"member-ordering": false
},
"rulesDirectory": []
}
}