• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16// @ts-ignore
17import {HeapStruct} from "../../../dist/trace/bean/HeapStruct.js"
18
19describe('HeapStruct Test', () => {
20    const canvas = document.createElement('canvas');
21    canvas.width = 1;
22    canvas.height = 1;
23    const ctx = canvas.getContext('2d');
24
25    const dataSource = {
26        frame: {
27            x: 20,
28            y: 20,
29            width: 100,
30            height: 100
31        },
32        value: 50,
33        maxHeapSize: 50,
34        heapsize: 10
35    }
36
37    const reachData = {
38        frame: {
39            x: 20,
40            y: 20,
41            width: 100,
42            height: 100
43        },
44        value: 50,
45        startTime: 1
46    }
47
48    const nodeSource = {
49        startTime: 10,
50        dur: 10,
51        endTime: 20,
52        frame: {
53            width: 20
54        }
55    }
56
57    const heapStruct = new HeapStruct();
58
59    it('HeapStructTest01', function () {
60        expect(HeapStruct.draw(ctx, dataSource)).toBeUndefined()
61    });
62
63    it('HeapStructTest02', function () {
64        expect(HeapStruct.draw(ctx, reachData)).toBeUndefined()
65    });
66
67    it('HeapStructTest03', function () {
68        expect(HeapStruct.setFrame(nodeSource, 1, 10, 15, 30, nodeSource.frame)).toBeUndefined()
69    });
70
71    it('HeapStructTest04', function () {
72        expect(HeapStruct.setFrame(nodeSource, 1, 15, 20, 30, nodeSource.frame)).toBeUndefined()
73    });
74
75    it('HeapStructTest05', function () {
76        expect(HeapStruct.setFrame(nodeSource, 1, 10, 20, 30, nodeSource.frame)).toBeUndefined()
77    });
78})
79