blob: 2db0ac763ddd7b9f4038faf97b2f1b339c37bc46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
import ice from "ice";
const Ice = ice.Ice;
import {Demo} from "./Demo/Point";
import "./Demo/Canvas";
import "./Demo/Circle";
import "./Demo/Square";
function test(value)
{
if(!value)
{
throw new Error("test failed exception");
}
}
console.log("testing import/export modules");
const point = new Demo.gx.Point(10, 10);
test(point.x === 10);
test(point.y === 10);
const circle = new Demo.gx.Circle(new Demo.gx.Point(10, 10), 100);
test(circle.center.x == 10);
test(circle.center.y == 10);
test(circle.radius == 100);
const square = new Demo.gx.Square(
new Demo.gx.Point(0, 0),
new Demo.gx.Point(10, 0),
new Demo.gx.Point(10, 10),
new Demo.gx.Point(0, 10));
test(square.p1.x === 0);
test(square.p1.y === 0);
test(square.p2.x === 10);
test(square.p2.y === 0);
test(square.p3.x === 10);
test(square.p3.y === 10);
test(square.p4.x === 0);
test(square.p4.y === 10);
const communicator = Ice.initialize();
const session = Demo.gx.SessionPrx.uncheckedCast(communicator.stringToProxy("demo:default -h 127.0.0.1"));
test(session !== undefined);
const canvas = Demo.gx.CanvasPrx.uncheckedCast(communicator.stringToProxy("demo:default -h 127.0.0.1"));
test(canvas !== undefined);
communicator.destroy().then(() => console.log("ok"));
|