Stub an integration test page

This commit is contained in:
Patrick Walton 2017-11-10 13:58:07 -08:00
parent 2f7205bd22
commit 932fc64524
5 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Integration Test &mdash; Pathfinder</title>
<meta charset="utf-8">
{{>partials/header.html}}
<script type="text/javascript" src="/js/pathfinder/integration-test.js"></script>
</head>
<body class="pf-unscrollable">
{{>partials/navbar.html isTool=true}}
<div id="pf-test-pane">
<form>
Font
</form>
</div>
<canvas id="pf-center-canvas" class="pf-draggable" width="300" height="400"></canvas>
<canvas id="pf-right-canvas" class="pf-draggable" width="300" height="400"></canvas>
</body>
</html>

View File

@ -19,6 +19,7 @@
ref="/" aria-haspopup="true" aria-expanded="false">Tools</a>
<div class="dropdown-menu" aria-labelledby="pf-tools-menu">
<a class="dropdown-item" href="/tools/benchmark">Benchmark</a>
<a class="dropdown-item" href="/tools/integration-test">Integration Test</a>
<a class="dropdown-item" href="/tools/mesh-debugger">Mesh Debugger</a>
</div>
</li>

View File

@ -0,0 +1,104 @@
// pathfinder/client/src/integration-test.ts
//
// Copyright © 2017 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
import * as glmatrix from 'gl-matrix';
import {AntialiasingStrategy, AntialiasingStrategyName, NoAAStrategy} from './aa-strategy';
import {SubpixelAAType} from './aa-strategy';
import {DemoAppController} from "./app-controller";
import {OrthographicCamera} from './camera';
import {UniformMap} from './gl-utils';
import {Renderer} from "./renderer";
import {ShaderMap} from "./shader-loader";
import SSAAStrategy from './ssaa-strategy';
import {DemoView} from "./view";
import {AdaptiveMonochromeXCAAStrategy} from './xcaa-strategy';
const ANTIALIASING_STRATEGIES: AntialiasingStrategyTable = {
none: NoAAStrategy,
ssaa: SSAAStrategy,
xcaa: AdaptiveMonochromeXCAAStrategy,
};
interface AntialiasingStrategyTable {
none: typeof NoAAStrategy;
ssaa: typeof SSAAStrategy;
xcaa: typeof AdaptiveMonochromeXCAAStrategy;
}
class IntegrationTestAppController extends DemoAppController<IntegrationTestView> {
protected builtinFileURI: string;
protected defaultFile: string;
protected createView(): IntegrationTestView {
throw new Error("Method not implemented.");
}
protected fileLoaded(data: ArrayBuffer, builtinName: string | null): void {
throw new Error("Method not implemented.");
}
}
class IntegrationTestView extends DemoView {
get camera(): OrthographicCamera {
return this.renderer.camera;
}
readonly renderer: IntegrationTestRenderer;
}
class IntegrationTestRenderer extends Renderer {
camera: OrthographicCamera;
destFramebuffer: WebGLFramebuffer | null;
destAllocatedSize: glmatrix.vec2;
destUsedSize: glmatrix.vec2;
protected objectCount: number;
protected usedSizeFactor: glmatrix.vec2;
protected worldTransform: glmatrix.mat4;
pathBoundingRects(objectIndex: number): Float32Array {
throw new Error("Method not implemented.");
}
setHintsUniform(uniforms: UniformMap): void {
throw new Error("Method not implemented.");
}
protected createAAStrategy(aaType: AntialiasingStrategyName,
aaLevel: number,
subpixelAA: SubpixelAAType):
AntialiasingStrategy {
return new (ANTIALIASING_STRATEGIES[aaType])(aaLevel, subpixelAA);
}
protected compositeIfNecessary(): void {
throw new Error("Method not implemented.");
}
protected pathColorsForObject(objectIndex: number): Uint8Array {
throw new Error("Method not implemented.");
}
protected pathTransformsForObject(objectIndex: number): Float32Array {
throw new Error("Method not implemented.");
}
protected directCurveProgramName(): keyof ShaderMap<void> {
return 'directCurve';
}
protected directInteriorProgramName(): keyof ShaderMap<void> {
return 'directInterior';
}
}
function main() {
const controller = new IntegrationTestAppController;
window.addEventListener('load', () => controller.start(), false);
}
main();

View File

@ -8,6 +8,7 @@ module.exports = {
'3d-demo': "./src/3d-demo.ts",
'svg-demo': "./src/svg-demo.ts",
'text-demo': "./src/text-demo.ts",
'integration-test': "./src/integration-test.ts",
'benchmark': "./src/benchmark.ts",
'mesh-debugger': "./src/mesh-debugger.ts",
},

View File

@ -67,6 +67,7 @@ static STATIC_TEXT_DEMO_PATH: &'static str = "../client/text-demo.html";
static STATIC_SVG_DEMO_PATH: &'static str = "../client/svg-demo.html";
static STATIC_3D_DEMO_PATH: &'static str = "../client/3d-demo.html";
static STATIC_TOOLS_BENCHMARK_PATH: &'static str = "../client/benchmark.html";
static STATIC_TOOLS_INTEGRATION_TEST_PATH: &'static str = "../client/integration-test.html";
static STATIC_TOOLS_MESH_DEBUGGER_PATH: &'static str = "../client/mesh-debugger.html";
static STATIC_DOC_API_PATH: &'static str = "../../font-renderer/target/doc";
static STATIC_CSS_BOOTSTRAP_PATH: &'static str = "../client/node_modules/bootstrap/dist/css";
@ -437,6 +438,10 @@ fn static_demo_3d() -> io::Result<NamedFile> {
fn static_tools_benchmark() -> io::Result<NamedFile> {
NamedFile::open(STATIC_TOOLS_BENCHMARK_PATH)
}
#[get("/tools/integration-test")]
fn static_tools_integration_test() -> io::Result<NamedFile> {
NamedFile::open(STATIC_TOOLS_INTEGRATION_TEST_PATH)
}
#[get("/tools/mesh-debugger")]
fn static_tools_mesh_debugger() -> io::Result<NamedFile> {
NamedFile::open(STATIC_TOOLS_MESH_DEBUGGER_PATH)
@ -553,6 +558,7 @@ fn main() {
static_demo_svg,
static_demo_3d,
static_tools_benchmark,
static_tools_integration_test,
static_tools_mesh_debugger,
static_doc_api_index,
static_doc_api,