#!/bin/bash ################################################################################ # Script: test-progress.sh # Description: Test script to demonstrate ROM Groomer progress indicators. # Shows various progress features without actually processing ROMs. # # Usage: ${PROJECT_ROOT}/test-progress.sh ################################################################################ # Determine the directory of the current script SCRIPT_DIR="$(dirname "$(realpath "$0")")" # Determine the project root directory PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" # Load progress indicators source "${PROJECT_ROOT}/progress.sh" source "${PROJECT_ROOT}/core/logger.sh" # Test function test_progress_features() { echo "ROM Groomer Progress Indicators Test" echo "====================================" echo "" # Test multi-step progress log "INFO" "Testing multi-step progress tracking:" progress_steps_init 5 progress_step 1 5 "Checking dependencies" "active" sleep 1 progress_step 1 5 "Checking dependencies" "complete" progress_step 2 5 "Scanning ROM directories" "active" sleep 1 progress_step 2 5 "Scanning ROM directories" "complete" progress_step 3 5 "Processing ROM files" "active" sleep 1 progress_step 3 5 "Processing ROM files" "complete" progress_step 4 5 "Organizing collections" "active" sleep 1 progress_step 4 5 "Organizing collections" "complete" progress_step 5 5 "Finalizing" "active" sleep 1 progress_step 5 5 "Finalizing" "complete" echo "" log "INFO" "Testing file operation progress bar:" # Test file progress bar progress_init 15 "Processing ROM files" for i in $(seq 1 15); do sleep 0.2 case $((i % 3)) in 0) progress_file_operation "copy" "Super Mario Bros $i.nes" "organized/Super Mario Bros $i.nes" "$i" 15 ;; 1) progress_file_operation "move" "Zelda $i.nes" "filtered/Zelda $i.nes" "$i" 15 ;; 2) progress_file_operation "extract" "Metroid $i.zip" "extracted/Metroid $i.nes" "$i" 15 ;; esac done echo "" log "INFO" "Testing batch operation progress:" # Test batch operations progress_batch_start "Copy" 8 "/data/emu/source/nes" "/data/emu/filter/nes.usa.1g1r" for i in $(seq 1 8); do sleep 0.3 progress_file_operation "copy" "Game_${i}.nes" "filtered/Game_${i}.nes" "$i" 8 done progress_batch_complete "Copy" 8 0 8 echo "" log "INFO" "Testing indeterminate progress (spinner):" progress_init 0 "Analyzing ROM collection structure" sleep 3 stop_spinner echo -e "\r${PROGRESS_GREEN}✓ Analysis complete - found 1,247 ROM files${PROGRESS_NC}" echo "" log "INFO" "Testing download progress simulation:" progress_download "https://datomatic.no-intro.org/stuff/Nintendo%20-%20Nintendo%20Entertainment%20System.zip" \ "Nintendo - Nintendo Entertainment System.zip" \ "45.2 MB" sleep 2 stop_spinner echo -e "\r${PROGRESS_GREEN}✓ Download complete${PROGRESS_NC}" echo "" echo "Progress indicators test completed successfully!" echo "These features are now available in ROM Groomer scripts." } # Run the test test_progress_features