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
16jest.mock('../../../src/trace/component/trace/base/TraceRow', () => {
17  return {};
18});
19
20import { HeapStruct } from '../../../src/trace/bean/HeapStruct';
21
22describe('HeapStruct Test', () => {
23  const canvas = document.createElement('canvas');
24  canvas.width = 5;
25  canvas.height = 3;
26  const ctx = canvas.getContext('2d');
27
28  const dataSource = {
29    frame: {
30      x: 15,
31      y: 53,
32      width: 33,
33      height: 33,
34    },
35    value: 9,
36    maxHeapSize: 3,
37    heapsize: 98,
38  };
39
40  const reachData = {
41    frame: {
42      x: 256,
43      y: 230,
44      width: 322,
45      height: 431,
46    },
47    value: 150,
48    startTime: 3461,
49  };
50
51  const nodeSource = {
52    startTime: 10,
53    dur: 10,
54    endTime: 20,
55    frame: {
56      width: 20,
57    },
58  };
59
60  const heapStruct = new HeapStruct();
61
62  it('HeapStructTest01', function () {
63    expect(HeapStruct.draw(ctx, dataSource)).toBeUndefined();
64  });
65
66  it('HeapStructTest02', function () {
67    expect(HeapStruct.draw(ctx, reachData)).toBeUndefined();
68  });
69});
70