1 | import * as Jimp from "jimp";
|
2 |
|
3 | const jimpInst: Jimp = new Jimp("test");
|
4 |
|
5 |
|
6 |
|
7 | jimpInst.read("Test");
|
8 | jimpInst.displace(jimpInst, 2);
|
9 | jimpInst.resize(40, 40);
|
10 | jimpInst.displace(jimpInst, 2);
|
11 | jimpInst.shadow((err, val, coords) => {});
|
12 | jimpInst.fishEye({ r: 12 });
|
13 | jimpInst.circle({ radius: 12, x: 12, y: 12 });
|
14 |
|
15 | jimpInst.PNG_FILTER_NONE;
|
16 |
|
17 |
|
18 | jimpInst.test;
|
19 |
|
20 |
|
21 | jimpInst.func();
|
22 |
|
23 |
|
24 | Jimp.read("Test");
|
25 |
|
26 |
|
27 | Jimp.PNG_FILTER_NONE;
|
28 |
|
29 |
|
30 | Jimp.test;
|
31 |
|
32 |
|
33 | Jimp.func();
|
34 |
|
35 | test("can clone properly", async () => {
|
36 | const baseImage = await Jimp.read("filename");
|
37 | const cloneBaseImage = baseImage.clone();
|
38 |
|
39 |
|
40 | cloneBaseImage._deflateLevel;
|
41 |
|
42 | test("can handle `this` returns on the core type properly", () => {
|
43 |
|
44 | cloneBaseImage.posterize(3)._quality;
|
45 | });
|
46 |
|
47 | test("can handle `this` returns properly", () => {
|
48 | cloneBaseImage
|
49 | .resize(1, 1)
|
50 | .crop(0, 0, 0, 0)
|
51 | .mask(cloneBaseImage, 2, 2)
|
52 | .print("a" as any, 2, 2, "a" as any)
|
53 | .resize(1, 1)
|
54 | .quality(1)
|
55 | .deflateLevel(2)._filterType;
|
56 | });
|
57 |
|
58 | test("can handle imageCallbacks `this` properly", () => {
|
59 | cloneBaseImage.rgba(false, (_, jimpCBIn) => {
|
60 |
|
61 | jimpCBIn.read("Test");
|
62 | jimpCBIn.displace(jimpInst, 2);
|
63 | jimpCBIn.resize(40, 40);
|
64 |
|
65 | jimpCBIn._filterType;
|
66 |
|
67 |
|
68 | jimpCBIn.test;
|
69 |
|
70 |
|
71 | jimpCBIn.func();
|
72 | });
|
73 | });
|
74 | });
|
75 |
|
76 | test("Can handle callback with constructor", () => {
|
77 | const myBmpBuffer: Buffer = {} as any;
|
78 |
|
79 | Jimp.read(myBmpBuffer, (err, cbJimpInst) => {
|
80 |
|
81 | cbJimpInst.read("Test");
|
82 | cbJimpInst.displace(jimpInst, 2);
|
83 | cbJimpInst.resize(40, 40);
|
84 |
|
85 | cbJimpInst._filterType;
|
86 |
|
87 |
|
88 | cbJimpInst.test;
|
89 |
|
90 |
|
91 | cbJimpInst.func();
|
92 | });
|
93 | });
|