This directory contains visual tests for rough-native React Native library.
Cross-platform React Native/Expo tests:
- Platforms: React Native, iOS, Android, Web (via Expo Web)
- Features: All RoughJS primitives using
rough.reactNativeSvg() - Interactive: Navigation between test categories
- Automated: Test runner with dependency management
- Usage: See
react-native/README.mdfor detailed instructions
| Feature | React Native | iOS | Android | Web (Expo) |
|---|---|---|---|---|
| Rectangle | ✅ | ✅ | ✅ | ✅ |
| Line | ✅ | ✅ | ✅ | ✅ |
| Ellipse | ✅ | ✅ | ✅ | ✅ |
| Polygon | ✅ | ✅ | ✅ | ✅ |
| Curve | ✅ | ✅ | ✅ | ✅ |
| Path | ✅ | ✅ | ✅ | ✅ |
| Fill Styles | ✅ | ✅ | ✅ | ✅ |
| Dashed Lines | ✅ | ✅ | ✅ | ✅ |
cd visual-tests/react-native
npm install
npm test # Starts web version on localhost:3001For other platforms:
npm run test:ios # iOS simulator
npm run test:android # Android emulator- Rectangle: Various fill styles, stroke options, dimensions
- Line: Different angles, weights, dash patterns
- Ellipse: Circles, ovals, different aspect ratios
- Polygon: Triangles, pentagons, stars, irregular shapes
- Curve: Bezier curves with control points
- Path: Complex SVG path commands and arcs
- Dashed: Comprehensive dash pattern testing
- Fill Styles: solid, hachure, cross-hatch, zigzag, dots
- Stroke Options: color, width, dash patterns
- Roughness: Control sketch-like appearance
- Hachure Settings: gap, angle, weight customization
- React Native Tests:
- Add new screen component in
react-native/screens/ - Update
react-native/App.jsto include new test - Follow existing patterns for consistency
- Add new screen component in
- Visual Verification: All tests require manual visual inspection
- Cross-Platform: Test React Native components on all platforms
- Consistency: Compare output across different rendering methods
- Regression: Ensure new changes don't break existing functionality
rough.reactNativeSvg(SvgComponent)initialization- React component-based architecture
- Cross-platform compatibility layer
- Expo for universal development
This is a React Native fork of the original RoughJS library:
- API Compatibility: Similar API to original RoughJS but adapted for React Native
- Platform Optimization: Automatic optimizations for each platform
- Development Experience: Unified development workflow with Expo
# Ensure RoughJS is built for React Native
npm run build:rncd visual-tests/react-native
rm -rf node_modules
npm install- iOS: Requires Xcode and iOS Simulator
- Android: Requires Android Studio and emulator setup
- Web: Check port availability (default: 3000/3001)
When contributing new visual tests:
- Test Coverage: Ensure tests cover new features comprehensively
- Platform Parity: Test on all supported platforms
- Documentation: Update README files with new test descriptions
- Consistency: Follow existing code patterns and naming conventions