class _AmslerGridScreenState extends State {
// Variables for transformations
double _scale = 1.0;
late TransformationController _transformationController;
TapDownDetails? _doubleTapDetails;
// Variables for adjustable settings
int _gridLines = 20;
double _lineThickness = 1.0;
Color _gridColor = Colors.black;
Color _backgroundColor = Colors.white;
bool _showCenterDot = true;
// For contrast adjustment
double _contrast = 1.0;
// for Dot Radius Changes
double _dotRadius = 4.0;
// Variables for distortion effect
double _distortionAmount = 50.0; // Range: 0.0 (minimum) to 100.0 (maximum), default is 50 (no distortion)
double _darken = 1.0; // Range: 0.1 (darkest) to 1.0 (original color)
void _handleDoubleTap() {
if (_doubleTapDetails != null) {
final position = _doubleTapDetails!.localPosition;
// Zoom in or out on double tap
setState(() {
if (_scale == 1.0) {
_scale = 2.0;
} else {
_scale = 1.0;
}
_onScaleChanged(_scale);
});
}
}
class BackgroundPaint extends CustomPainter {
final double marginWidth;
final double marginHeight;
final int gridLines;
final double lineThickness;
final Color gridColor;
final Color backgroundColor;
final bool showCenterDot;
final double contrast;
final double distortionAmount;
final double darken;
final double dotRadius;
// Adjust grid color for contrast and darken
Color adjustedGridColor = gridColor.withOpacity(contrast.clamp(0.1, 1.0) * darken);
final paint = Paint()
..color = adjustedGridColor
..strokeWidth = lineThickness;
// Calculates the size of each grid box based on the smaller dimension
final availableWidth = size.width - marginWidth * 2;
final availableHeight = size.height - marginHeight * 2;
final gridSize =
(availableWidth < availableHeight ? availableWidth : availableHeight) / gridLines;
final adjustedSize = Size(gridSize * gridLines, gridSize * gridLines);
// Center the grid
final dx = (size.width - adjustedSize.width) / 2;
final dy = (size.height - adjustedSize.height) / 2;
canvas.translate(dx, dy);
// Center of the grid for distortion calculations
final Offset center = Offset(adjustedSize.width / 2, adjustedSize.height / 2);
// Maximum radius from the center to the corner
final double maxRadius = center.distance;
// Function to apply 3D-like distortion to a point
Offset distortPoint(Offset point) {
final dx = point.dx - center.dx;
final dy = point.dy - center.dy;
final double r = sqrt(dx * dx + dy * dy);
// Compute effective distortion amount from -1 to 1
double effectiveDistortion = (distortionAmount - 50) / 50.0;
// Scale the distortion amount
double distortionStrength = effectiveDistortion * 1.5; // Adjust strength as needed
// Apply a smooth distortion function
// Create a 3D-like effect using a paraboloid function
double z = distortionStrength * (1 - (r / maxRadius) * (r / maxRadius));
// Perspective projection parameters
double d = 500.0; // Distance from the viewer to the grid (adjust as needed)
// Project the 3D point back to 2D
double scale = d / (d - z * 100); // Adjust z scaling as needed
double distortedX = center.dx + dx * scale;
double distortedY = center.dy + dy * scale;
return Offset(distortedX, distortedY);
}
// Draw the distorted vertical lines
for (int i = 0; i <= gridLines; i++) {
List<Offset> points = [];
for (int j = 0; j <= gridLines; j++) {
final point = Offset(i * gridSize, j * gridSize);
final distortedPoint = distortPoint(point);
points.add(distortedPoint);
}
canvas.drawPoints(PointMode.polygon, points, paint);
}
// Draw the distorted horizontal lines
for (int j = 0; j <= gridLines; j++) {
List<Offset> points = [];
for (int i = 0; i <= gridLines; i++) {
final point = Offset(i * gridSize, j * gridSize);
final distortedPoint = distortPoint(point);
points.add(distortedPoint);
}
canvas.drawPoints(PointMode.polygon, points, paint);
}
// Draw the center dot
if (showCenterDot) {
final centerDotPaint = Paint()
..color = adjustedGridColor
..style = PaintingStyle.fill;
// dotRadius = 4.0;
// Apply distortion to center point if distortion is present
final distortedCenter = distortionAmount != 50.0 ? distortPoint(center) : center;
canvas.drawCircle(distortedCenter, dotRadius, centerDotPaint);
}
class BlinkDetectionScreenState extends State {
late CameraController _controller;
late Future _initializeControllerFuture;
late FaceDetector _faceDetector;
int _blinkCount = 0;
double _lastEAR = 0;
final double _blinkThreshold = 0.2;
bool _isDetecting = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Blink Detection')),
body: FutureBuilder(
future: _initializeControllerFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Stack(
fit: StackFit.expand,
children: [
CameraPreview(_controller),
Positioned(
top: 20,
left: 20,
child: Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Colors.black54,
borderRadius: BorderRadius.circular(10),
),
child: Text(
'Blinks: $_blinkCount',
style: TextStyle(
fontSize: 20,
color: Colors.white,
),
),
),
),
],
);
} else {
return Center(child: CircularProgressIndicator());
}
},
),
floatingActionButton: FloatingActionButton(
onPressed: () async {
try {
await _initializeControllerFuture;
_controller.startImageStream(_processCameraImage);
} catch (e) {
print(e);
}
},
child: Icon(Icons.play_arrow),
),
);
}
}
i ahve sent u teh code, now wrtie teh test cases from teh tester prespective, in the below i also shared the sample of teh tester method, do it like this
S No Subject Test case ID Requirement ID Scenario Name Test Name Test Case Description Step Number Detailed Steps Expected Result Actual Result Test Status Test Date Tester's Name "TC Criticality
[High / Medium/ Low]"
Test ID QC Path Test case ID Requirement ID Test folder Name Test Name Description 1, 2, 3 etc. Design Steps Expected Result Actual Result Pass Fail TC Priority
1 TC_1 "INFUSE-FA Drawer-1
Testing" "Testing Drawer-1
with power -0.75
in Brand INFUSE with Indication FA" 1 Open Application Passed
2 Select Customer [Type in Customer Selected]
3 "Select Brand: INFUSE
Select Indication: FA
Select Drawer: -0.75 CYL 10, 80, 90" "Select Brand: INFUSE-FA
Select Indication: "
4 Select uppermost left(non empty)slot in Drawer
5 Select lowest right (non empty) Slot
6 Click on cart in upper right hand view
7 "Two lenses should show in cart and be highlighted with yellow color in drawer: with power lens as
+2.00
+1.50
" "Two lenses should show in cart and be highlighted with yellow color in drawer: with power lens as
+2.00
+1.50
"
8 Select Proceed and submit Cart Receive confirmation that cart is submitted.
9 Download FlatFile for customer from AWS bucket
10 Open FlatFile
11 SKU line 2 196527098191
12 SKU line 3 196527097590
14 Matching Y/N Matched with SKUs selected to SKUs inline with CSV files
Random-2 1 Open Application
2 Select Customer [Type in Customer Selected]
INFUSE-FA -0.75 INFUSE-FA Drawer-2 3 "Select Brand: INFUSE-FA
Select Indication:
Select Drawer: " "Select Brand: INFUSE-FA
Select Indication: "
4 Select Down try from Top left(non empty)slot in Drawer
5 Select lowest right (non empty) Slot
6 Click on cart in upper right hand view
7 "Two lenses should show in cart and be highlighted in drawer:
+2.00
+1.50
" "Two lenses should show in cart and be highlighted in drawer:
+2.00
+1.50
"
8 Select Proceed and submit Cart Receive confirmation that cart is submitted.
9 Download FlatFile for customer from AWS bucket
10 Open FlatFile
11 SKU line 2 196527098221
Below are the test cases for the Flutter application, structured in a similar format to your provided example:
Test Case: HomeScreen Navigation
| S No | Subject | Test Case ID | Requirement ID | Scenario Name | Test Name | Test Case Description | Step Number | Detailed Steps | Expected Result | Actual Result | Test Status | Test Date | Tester's Name | TC Criticality |
|------|-----------------------|--------------|----------------|------------------|-------------------------|---------------------------------------------------------------------|-------------|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|---------------|-------------|--------------|-----------------|
| 1 | HomeScreen Navigation | TC_1 | | Home Screen | Navigate to Amsler Grid | Verify navigation from HomeScreen to AmslerGridScreen. | 1 | Open the application and wait for the HomeScreen to load. | HomeScreen should be displayed with two options: "Amsler Grid Test" and "Blink Detection Test". | | | | Medium |
| | | | | | | | 2 | Click on the "Amsler Grid Test" button. | The application should navigate to AmslerGridScreen. | | | | |
| 2 | HomeScreen Navigation | TC_2 | | Home Screen | Navigate to Blink Detection | Verify navigation from HomeScreen to BlinkDetectionScreen. | 1 | Open the application and wait for the HomeScreen to load. | HomeScreen should be displayed with two options: "Amsler Grid Test" and "Blink Detection Test". | | | | High |
| | | | | | | | 2 | Click on the "Blink Detection Test" button. | The application should navigate to BlinkDetectionScreen and request camera permissions if needed. | | | | |
Test Case: AmslerGridScreen Functionality
| S No | Subject | Test Case ID | Requirement ID | Scenario Name | Test Name | Test Case Description | Step Number | Detailed Steps | Expected Result | Actual Result | Test Status | Test Date | Tester's Name | TC Criticality |
|------|-------------------------|--------------|----------------|----------------|---------------------------------------|-------------------------------------------------------------------------------------------------------------------------|-------------|----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|---------------|-------------|--------------|-----------------|
| 1 | AmslerGridScreen | TC_3 | | Amsler Grid | Amsler Grid Interaction | Verify the grid interaction and transformation capabilities in AmslerGridScreen. | 1 | Navigate to AmslerGridScreen. | AmslerGridScreen should be displayed with default grid settings visible. | | | | Medium |
| | | | | | | | 2 | Zoom in/out on the grid via pinch gesture. | The grid should zoom in/out smoothly, up to the specified min and max scales. | | | | |
| | | | | | | | 3 | Change grid settings like line thickness, number of lines, etc. | Grid should update settings immediately, displaying the changes visually. | | | | |
| | | | | | | | 4 | Enable/disable the center dot display. | Center dot visibility should toggle based on user interaction with the button on the AppBar. | | | | |
Test Case: BlinkDetectionScreen Functionality
| S No | Subject | Test Case ID | Requirement ID | Scenario Name | Test Name | Test Case Description | Step Number | Detailed Steps | Expected Result | Actual Result | Test Status | Test Date | Tester's Name | TC Criticality |
|------|-----------------------|--------------|----------------|----------------------|-----------------------------|----------------------------------------------------------------------------------------------------------------------|-------------|-----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|---------------|-------------|--------------|-----------------|
| 1 | BlinkDetectionScreen | TC_4 | | Blink Detection | Blink Detection Activation | Verify the start of blink detection and accurate counting of blinks. | 1 | Navigate to BlinkDetectionScreen. | BlinkDetectionScreen should be displayed with a camera feed visible. | | | | High |
| | | | | | | | 2 | Click the FloatingActionButton (FAB) to start detection. | The blink detection process should commence, counting blinks and displaying them on the screen. | | | | |
| | | | | | | | 3 | Blink eyes frequently to test detection. | The blink count should increase consistently as each blink is detected by the system. | | | | |
These test cases cover navigation between screens and the primary functionality of both the Amsler Grid Test and Blink Detection Test features. Adjust the test descriptions and procedures as necessary to fit your exact testing requirements and application specifics.
Below are more comprehensively detailed and structured test cases for your Flutter application, including separate tables for HomeScreen, AmslerGridScreen, and BlinkDetectionScreen interactions.
Test Case: HomeScreen Navigation
| S No | Subject | Test Case ID | Requirement ID | Scenario Name | Test Name | Test Case Description | Step Number | Detailed Steps | Expected Result | Actual Result | Test Status | Test Date | Tester's Name | TC Criticality |
|------|-----------------------|--------------|----------------|------------------|--------------------------|----------------------------------------------------------------------|-------------|----------------------------------------------------|-------------------------------------------------------------------------------------------------|---------------|-------------|--------------|-----------------|
| 1 | HomeScreen Navigation | TC_1 | | Home Screen | Navigate to Amsler Grid | Verify navigation from HomeScreen to AmslerGridScreen. | 1 | Open the application. | HomeScreen is displayed with options: "Amsler Grid Test" and "Blink Detection Test". | | | | Medium |
| | | | | | | | 2 | Click on "Amsler Grid Test". | Application navigates to AmslerGridScreen. | | | | |
| 2 | HomeScreen Navigation | TC_2 | | Home Screen | Navigate to Blink Detection | Verify navigation from HomeScreen to BlinkDetectionScreen. | 1 | Open the application. | HomeScreen is displayed with options: "Amsler Grid Test" and "Blink Detection Test". | | | | High |
| | | | | | | | 2 | Click on "Blink Detection Test". | Application navigates to BlinkDetectionScreen, initiating camera and permissions if needed. | | | | |
Test Case: AmslerGridScreen Functionality
| S No | Subject | Test Case ID | Requirement ID | Scenario Name | Test Name | Test Case Description | Step Number | Detailed Steps | Expected Result | Actual Result | Test Status | Test Date | Tester's Name | TC Criticality |
|------|-------------------------|--------------|----------------|----------------|---------------------------------------|-------------------------------------------------------------------------------------------------------|-------------|-------------------------------------------------------|-----------------------------------------------------------------------------------------------|---------------|-------------|--------------|-----------------|
| 1 | AmslerGridScreen | TC_3 | | Amsler Grid | Default Grid Display | Verify the default display of the Amsler grid. | 1 | Navigate to AmslerGridScreen. | AmslerGridScreen is displayed with default grid settings visible. | | | | Medium |
| 2 | AmslerGridScreen | TC_4 | | Amsler Grid | Zoom Functionality | Verify zooming capabilities using pinch gestures. | 1 | Pinch in/out on the grid. | Grid zooms in/out smoothly within the defined scale limits. | | | | Low |
| 3 | AmslerGridScreen | TC_5 | | Amsler Grid | Grid Settings Adjustment | Verify adjustments of grid settings (line thickness, number of lines, etc.). | 1 | Adjust line thickness slider. | Grid updates immediately to reflect new line thickness. | | | | Medium |
| | | | | | | | 2 | Adjust grid size slider. | Grid updates to show the specified number of lines. | | | | |
| 4 | AmslerGridScreen | TC_6 | | Amsler Grid | Center Dot Visibility Toggle | Verify the toggle functionality for the center dot visibility. | 1 | Toggle the center dot visibility button on AppBar. | Center dot toggles between visible and invisible states. | | | | Low |
| 5 | AmslerGridScreen | TC_7 | | Amsler Grid | Reset Grid to Default | Verify that reset functionality returns grid settings to default. | 1 | Change various grid settings. | Grid settings reflect changes. | | | | Medium |
| | | | | | | | 2 | Click the reset button on AppBar. | All grid settings revert to default values. | | | | |
Test Case: BlinkDetectionScreen Functionality
| S No | Subject | Test Case ID | Requirement ID | Scenario Name | Test Name | Test Case Description | Step Number | Detailed Steps | Expected Result | Actual Result | Test Status | Test Date | Tester's Name | TC Criticality |
|------|-----------------------|--------------|----------------|----------------------|-----------------------------|----------------------------------------------------------------|-------------|---------------------------------------------------------------|--------------------------------------------------------------------------------------|---------------|-------------|--------------|-----------------|
| 1 | BlinkDetectionScreen | TC_8 | | Blink Detection | Default Display | Verify the initial setup of the BlinkDetectionScreen. | 1 | Navigate to BlinkDetectionScreen. | BlinkDetectionScreen is displayed with camera preview ready. | | | | High |
| 2 | BlinkDetectionScreen | TC_9 | | Blink Detection | Start Blink Detection | Verify the starting functionality of blink detection. | 1 | Click the FloatingActionButton (FAB). | Blink detection process starts, camera feed is active, initiating blink count. | | | | High |
| 3 | BlinkDetectionScreen | TC_10 | | Blink Detection | Accurate Blink Counting | Verify the accuracy of blink detection and counting mechanism. | 1 | Blink eyes several times. | Blink count should increase accurately as the system detects each blink. | | | | Medium |
| 4 | BlinkDetectionScreen | TC_11 | | Blink Detection | Stop Blink Detection | Verify the stopping functionality of blink detection if applicable. | 1 | (If applicable) Stop the detection. | Blink detection process should stop, pausing the blink count update. | | | | Low |
These tables provide detailed testing instructions for each screen, ensuring comprehensive coverage of the application's functionality. Please adjust or expand upon these examples as needed to suit your specific application requirements and testing environment.