-
Notifications
You must be signed in to change notification settings - Fork 652
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
Showing
20 changed files
with
208 additions
and
7 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
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
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 modified
BIN
+615 Bytes
(110%)
...nents/candlestick/__image_snapshots__/pan-test-tsx-candlestick-swipe-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 modified
BIN
+491 Bytes
(100%)
...nents/candlestick/__image_snapshots__/pan-test-tsx-candlestick-swipe-2-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 modified
BIN
-203 Bytes
(98%)
...nents/candlestick/__image_snapshots__/pan-test-tsx-candlestick-swipe-3-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 modified
BIN
+187 Bytes
(110%)
...image_snapshots__/empty-data-test-tsx-empty-data-data-array-is-empty-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
+9.45 KB
...ts/interaction/__image_snapshots__/dodge-pan-test-tsx-dodge-pan-init-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
+9.78 KB
...nts/interaction/__image_snapshots__/dodge-pan-test-tsx-dodge-pan-pan-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 modified
BIN
+1.85 KB
(110%)
...teraction/__image_snapshots__/pan-test-tsx-平移和缩放-平移和缩放-cate类型-pan-事件-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 modified
BIN
+1.06 KB
(110%)
...interaction/__image_snapshots__/pan-test-tsx-平移和缩放-平移和缩放-cate类型-初始状态-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 modified
BIN
+105 Bytes
(100%)
...s/interaction/__image_snapshots__/pan-test-tsx-平移和缩放-平移和缩放-cate类型-放大-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 modified
BIN
-260 Bytes
(98%)
...raction/__image_snapshots__/pan-test-tsx-平移和缩放-平移和缩放-dodge-类型-pan-事件-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 modified
BIN
-172 Bytes
(99%)
...nteraction/__image_snapshots__/pan-test-tsx-平移和缩放-平移和缩放-dodge-类型-初始化-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 modified
BIN
+150 Bytes
(100%)
...onents/interaction/__image_snapshots__/roam-test-tsx-全局漫游模式-swip-初始化-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 modified
BIN
+87 Bytes
(100%)
...raction/__image_snapshots__/roam-test-tsx-全局漫游模式-斜移和缩放-linear-类型-初始化-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 modified
BIN
+150 Bytes
(100%)
...ion/__image_snapshots__/roam-test-tsx-全局漫游模式-斜移和缩放-sensitive-灵明度-初始化-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.
188 changes: 188 additions & 0 deletions
188
packages/f2/test/components/interaction/dodge-pan.test.tsx
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,188 @@ | ||
import { jsx } from '../../../src'; | ||
import { Canvas, Chart, Axis, ScrollBar, Legend, Interval, Tooltip } from '../../../src'; | ||
import { createContext, delay, gestureSimulator } from '../../util'; | ||
const context = createContext(); | ||
|
||
const data = [ | ||
{ | ||
name: '今日数据', | ||
time: '0:00', | ||
value: 18900, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '0:00', | ||
value: 2890, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '01:00', | ||
value: 18900, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '01:00', | ||
value: 2890, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '02:00', | ||
value: 18900, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '02:00', | ||
value: 2890, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '03:00', | ||
value: 18900, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '03:00', | ||
value: 2890, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '04:00', | ||
value: 18900, | ||
}, | ||
|
||
{ | ||
name: '昨日数据', | ||
time: '04:00', | ||
value: 28910, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '05:00', | ||
value: 28910, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '05:00', | ||
value: 18900, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '06:00', | ||
value: 1900, | ||
}, | ||
|
||
{ | ||
name: '昨日数据', | ||
time: '06:00', | ||
value: 280, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '07:00', | ||
value: 280, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '07:00', | ||
value: 1900, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '08:00', | ||
value: 10900, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '08:00', | ||
value: 22890, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '09:00', | ||
value: 10900, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '09:00', | ||
value: 22890, | ||
}, | ||
{ | ||
name: '今日数据', | ||
time: '10:00', | ||
value: 10900, | ||
}, | ||
{ | ||
name: '昨日数据', | ||
time: '10:00', | ||
value: 22890, | ||
}, | ||
]; | ||
|
||
describe('dodge pan', () => { | ||
it('init', async () => { | ||
const { props } = ( | ||
<Canvas pixelRatio={1} context={context}> | ||
<Chart | ||
data={data} | ||
coord={{ | ||
type: 'rect', | ||
transposed: false, | ||
}} | ||
> | ||
<Axis | ||
field="time" | ||
style={{ | ||
grid: { lineWidth: 0 }, | ||
}} | ||
/> | ||
<Axis | ||
field="value" | ||
style={{ | ||
grid: { lineWidth: 0 }, | ||
}} | ||
/> | ||
<Legend | ||
position="bottom" | ||
style={{ | ||
justifyContent: 'center', | ||
flexDirection: 'row', | ||
}} | ||
/> | ||
<Interval | ||
x="time" | ||
y="value" | ||
adjust={{ | ||
type: 'dodge', | ||
// marginRatio: 0, // 设置分组间柱子的间距 | ||
}} | ||
color={['name', ['#FFE60F', '#726600']]} | ||
/> | ||
<Tooltip | ||
background={{ | ||
width: '220px', | ||
}} | ||
showCrosshairs | ||
crosshairsType="x" | ||
/> | ||
<ScrollBar pan pinch={false} mode="x" range={[0.5, 1]} visible /> | ||
</Chart> | ||
</Canvas> | ||
); | ||
|
||
const canvas = new Canvas(props); | ||
await canvas.render(); | ||
await delay(1000); | ||
expect(context).toMatchImageSnapshot(); | ||
}); | ||
|
||
it('pan', async () => { | ||
await delay(20); | ||
await gestureSimulator(context.canvas, 'touchstart', { x: 10, y: 169 }); | ||
await delay(20); | ||
await gestureSimulator(context.canvas, 'touchmove', { x: 100, y: 169 }); | ||
await delay(20); | ||
await gestureSimulator(context.canvas, 'touchend', { x: 100, y: 169 }); | ||
await delay(300); | ||
expect(context).toMatchImageSnapshot(); | ||
}); | ||
}); |