已合并
test: Add 84 branches 25p3 react-native-fast-image onLayout test case #2010
tianyong创建于 5 天前
test: Add 84 branches 25p3 react-native-fast-image onLayout test case #2010
已合并
共 1 个文件变更+15-3
| @@ -1,10 +1,10 @@ | |||
| 1 | -import React from 'react'; | 1 | +import React, { useState } from 'react'; |
| 2 | -import { StyleSheet, View, ScrollView,Image } from 'react-native'; | 2 | +import { StyleSheet, View, ScrollView,Image,Text } from 'react-native'; |
| 3 | import FastImage from '@react-native-ohos/react-native-fast-image'; | 3 | import FastImage from '@react-native-ohos/react-native-fast-image'; |
| 4 | import {TestSuite, Tester, TestCase} from '@rnoh/testerino'; | 4 | import {TestSuite, Tester, TestCase} from '@rnoh/testerino'; |
| 5 | 5 | ||
| 6 | export function FastImageStyleDemo(): JSX.Element { | 6 | export function FastImageStyleDemo(): JSX.Element { |
| 7 | - | 7 | + const [layoutResult, setLayoutResult] = useState(''); |
| 8 | return( | 8 | return( |
| 9 | <View style={styles.container}> | 9 | <View style={styles.container}> |
| 10 | <Tester> | 10 | <Tester> |
| @@ -168,6 +168,18 @@ export function FastImageStyleDemo(): JSX.Element { | |||
| 168 | source={require('./image/fields.jpg')} | 168 | source={require('./image/fields.jpg')} |
| 169 | /> | 169 | /> |
| 170 | </TestCase> | 170 | </TestCase> |
| 171 | + <TestCase itShould='onLayout触发测试'> | ||
| 172 | + <View > | ||
| 173 | + <Text>{layoutResult}</Text> | ||
| 174 | + <FastImage | ||
| 175 | + style={{width:240,height:240}} | ||
| 176 | + source={require('./image/fields.jpg')} | ||
| 177 | + onLayout={(event)=>{ | ||
| 178 | + setLayoutResult(`onLayout Width: ${event.nativeEvent.layout.width}, Height: ${event.nativeEvent.layout.height}`); | ||
| 179 | + }} | ||
| 180 | + /> | ||
| 181 | + </View> | ||
| 182 | + </TestCase> | ||
| 171 | </TestSuite> | 183 | </TestSuite> |
| 172 | </ScrollView> | 184 | </ScrollView> |
| 173 | </Tester> | 185 | </Tester> |