-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
xuying.xu
committed
Apr 10, 2024
1 parent
f307f6d
commit 3292082
Showing
7 changed files
with
230 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+2.82 KB
...e/test/shape/__image_snapshots__/polyline-test-tsx-polyline-polyline-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.61 KB
...ape/__image_snapshots__/polyline-test-tsx-polyline-step-end-polyline-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.07 KB
.../__image_snapshots__/polyline-test-tsx-polyline-step-middle-polyline-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.56 KB
...e/__image_snapshots__/polyline-test-tsx-polyline-step-start-polyline-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
import { jsx, Canvas, Component, createRef } from '../../src'; | ||
import { createContext, delay } from '../util'; | ||
const context = createContext(); | ||
import { Renderer } from '@antv/g-mobile-canvas'; | ||
|
||
|
||
describe('polyline', () => { | ||
it('polyline', async () => { | ||
const renderer = new Renderer(); | ||
const context = createContext('polyline'); | ||
|
||
const { props } = ( | ||
<Canvas renderer={renderer} context={context}> | ||
<polyline | ||
style={{ | ||
points: [ | ||
[0, 10], | ||
[20, 80], | ||
[40, 40], | ||
[60, 10], | ||
[80, 60] | ||
], | ||
stroke: 'blue' | ||
}} | ||
animation={{ | ||
update: { | ||
easing: 'linear', | ||
duration: 100, | ||
property: ['points'], | ||
}, | ||
}} | ||
/> | ||
</Canvas> | ||
); | ||
const canvas = new Canvas(props); | ||
await canvas.render(); | ||
await delay(500); | ||
expect(context).toMatchImageSnapshot(); | ||
}) | ||
it('step start polyline', async () => { | ||
const renderer = new Renderer(); | ||
const context = createContext('step start polyline'); | ||
|
||
const { props } = ( | ||
<Canvas renderer={renderer} context={context}> | ||
<polyline | ||
style={{ | ||
points: [ | ||
[0, 10], | ||
[20, 80], | ||
[40, 40], | ||
[60, 10], | ||
[80, 60] | ||
], | ||
stroke: 'blue' | ||
}} | ||
animation={{ | ||
update: { | ||
easing: 'linear', | ||
duration: 100, | ||
property: ['points'], | ||
}, | ||
}} | ||
/> | ||
<polyline | ||
style={{ | ||
points: [ | ||
[0, 10], | ||
[20, 80], | ||
[40, 40], | ||
[60, 10], | ||
[80, 60] | ||
], | ||
stroke: 'red', | ||
step: 'start', | ||
}} | ||
animation={{ | ||
update: { | ||
easing: 'linear', | ||
duration: 200, | ||
property: ['points'], | ||
}, | ||
}} | ||
/> | ||
</Canvas> | ||
); | ||
const canvas = new Canvas(props); | ||
await canvas.render(); | ||
await delay(500); | ||
expect(context).toMatchImageSnapshot(); | ||
}) | ||
it('step middle polyline', async () => { | ||
const renderer = new Renderer(); | ||
const context = createContext('step middle polyline'); | ||
|
||
const { props } = ( | ||
<Canvas renderer={renderer} context={context}> | ||
<polyline | ||
style={{ | ||
points: [ | ||
[0, 10], | ||
[20, 80], | ||
[40, 40], | ||
[60, 10], | ||
[80, 60] | ||
], | ||
stroke: 'blue' | ||
}} | ||
animation={{ | ||
update: { | ||
easing: 'linear', | ||
duration: 100, | ||
property: ['points'], | ||
}, | ||
}} | ||
/> | ||
<polyline | ||
style={{ | ||
points: [ | ||
[0, 10], | ||
[20, 80], | ||
[40, 40], | ||
[60, 10], | ||
[80, 60] | ||
], | ||
stroke: 'red', | ||
step: 'middle', | ||
}} | ||
animation={{ | ||
update: { | ||
easing: 'linear', | ||
duration: 200, | ||
property: ['points'], | ||
}, | ||
}} | ||
/> | ||
</Canvas> | ||
); | ||
const canvas = new Canvas(props); | ||
await canvas.render(); | ||
await delay(500); | ||
expect(context).toMatchImageSnapshot(); | ||
}) | ||
it('step end polyline', async () => { | ||
const renderer = new Renderer(); | ||
const context = createContext('step end polyline'); | ||
|
||
const { props } = ( | ||
<Canvas renderer={renderer} context={context}> | ||
<polyline | ||
style={{ | ||
points: [ | ||
[0, 10], | ||
[20, 80], | ||
[40, 40], | ||
[60, 10], | ||
[80, 60] | ||
], | ||
stroke: 'blue' | ||
}} | ||
animation={{ | ||
update: { | ||
easing: 'linear', | ||
duration: 100, | ||
property: ['points'], | ||
}, | ||
}} | ||
/> | ||
<polyline | ||
style={{ | ||
points: [ | ||
[0, 10], | ||
[20, 80], | ||
[40, 40], | ||
[60, 10], | ||
[80, 60] | ||
], | ||
stroke: 'red', | ||
step: 'end' | ||
}} | ||
animation={{ | ||
update: { | ||
easing: 'linear', | ||
duration: 200, | ||
property: ['points'], | ||
}, | ||
}} | ||
/> | ||
</Canvas> | ||
); | ||
const canvas = new Canvas(props); | ||
await canvas.render(); | ||
await delay(500); | ||
expect(context).toMatchImageSnapshot(); | ||
}) | ||
}); |