mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-31 05:15:42 +00:00 
			
		
		
		
	Scanner wedge mode (#437)
* Add code_scan_listener package * Implement wedge controller widget * Update barcode settings widget - Allow user to choose which barcode scanner to use * Fix typo * Select barcode scanner widget based on user preference * Fix rendering issues for wedge controller * Update release notes * Add unit test for wedge scanner widget - Required some tweaks to other code * Use better library - https://github.com/fuadreza/flutter_barcode_listener - Fork of https://github.com/shaxxx/flutter_barcode_listener - Properly handles key "case" issues (shift, essentially) - Verified that it works correctly for multiple character types * Local copy of code, rather than relying on package which is not available on pub.dev * Fix unit test
This commit is contained in:
		
							
								
								
									
										32
									
								
								test/wedge_scanner_test.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								test/wedge_scanner_test.dart
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
|  | ||||
|  | ||||
| import "package:flutter/material.dart"; | ||||
| import "package:flutter/services.dart"; | ||||
| import "package:flutter_test/flutter_test.dart"; | ||||
| import "package:inventree/barcode/barcode.dart"; | ||||
| import "package:inventree/barcode/wedge_controller.dart"; | ||||
| import "package:inventree/helpers.dart"; | ||||
|  | ||||
|  | ||||
| void main() { | ||||
|   testWidgets("Wedge Scanner Test", (tester) async { | ||||
|  | ||||
|     await tester.pumpWidget( | ||||
|       MaterialApp( | ||||
|         home: WedgeBarcodeController(BarcodeScanHandler()) | ||||
|       ) | ||||
|     ); | ||||
|  | ||||
|     // Generate some keyboard data | ||||
|     await simulateKeyDownEvent(LogicalKeyboardKey.keyA); | ||||
|     await simulateKeyDownEvent(LogicalKeyboardKey.keyB); | ||||
|     await simulateKeyDownEvent(LogicalKeyboardKey.keyC); | ||||
|     await simulateKeyDownEvent(LogicalKeyboardKey.enter); | ||||
|  | ||||
|     // Check debug output | ||||
|     debugContains("scanned: abc"); | ||||
|     debugContains("No match for barcode"); | ||||
|     debugContains("Server Error"); | ||||
|  | ||||
|   }); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user