Files
infoscreen-dev/scripts/test-progress-bars.sh

175 lines
4.3 KiB
Bash
Executable File

#!/bin/bash
# Test script for page_progress and auto_progress features in presentations
echo "=========================================="
echo "Progress Bar Features Test"
echo "=========================================="
echo ""
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Check if MQTT broker is configured
if [ -f ../.env ]; then
source ../.env
MQTT_HOST=${MQTT_BROKER:-localhost}
else
MQTT_HOST=localhost
fi
echo -e "${YELLOW}Using MQTT broker: ${MQTT_HOST}${NC}"
echo ""
# Menu for testing different progress bar configurations
echo "Select a test configuration:"
echo ""
echo "1. No progress bars (default)"
echo "2. Page progress only (overall position)"
echo "3. Auto-progress only (per-page countdown)"
echo "4. Both progress bars (maximum feedback)"
echo ""
read -p "Enter choice (1-4): " choice
case $choice in
1)
PAGE_PROG=false
AUTO_PROG=false
DESC="No progress bars"
;;
2)
PAGE_PROG=true
AUTO_PROG=false
DESC="Page progress only (--page-progress)"
;;
3)
PAGE_PROG=false
AUTO_PROG=true
DESC="Auto-progress only (--auto-progress)"
;;
4)
PAGE_PROG=true
AUTO_PROG=true
DESC="Both progress bars"
;;
*)
echo "Invalid choice"
exit 1
;;
esac
echo ""
echo -e "${BLUE}Configuration: $DESC${NC}"
echo " page_progress: $PAGE_PROG"
echo " auto_progress: $AUTO_PROG"
echo ""
# Create test event with progress bar settings
TEST_EVENT=$(cat <<EOF
{
"id": 888,
"group_id": 2,
"title": "Progress Bar Test Event",
"start": "2025-01-01T00:00:00+00:00",
"end": "2025-12-31T23:59:59+00:00",
"presentation": {
"type": "slideshow",
"auto_advance": true,
"slide_interval": 5,
"loop": true,
"page_progress": $PAGE_PROG,
"auto_progress": $AUTO_PROG,
"files": [
{
"name": "Wissenschaftliches Arbeiten Literaturrecherche.pdf",
"url": "http://server:8000/api/files/test.pdf"
}
]
}
}
EOF
)
echo "Sending test event to MQTT..."
echo ""
mosquitto_pub -h "$MQTT_HOST" -t "infoscreen/events/2" -m "$TEST_EVENT"
if [ $? -eq 0 ]; then
echo -e "${GREEN}✓ Event sent successfully${NC}"
else
echo -e "${RED}✗ Failed to send event${NC}"
exit 1
fi
echo ""
echo "Waiting for Display Manager to process event..."
sleep 3
echo ""
echo "Checking Display Manager log for progress bar settings..."
echo ""
LOG_FILE="../logs/display_manager.log"
if [ -f "$LOG_FILE" ]; then
echo -e "${YELLOW}Recent log entries:${NC}"
tail -30 "$LOG_FILE" | grep -E "(progress|Progress|Impressive)" | tail -10
else
echo -e "${YELLOW}Log file not found: $LOG_FILE${NC}"
fi
echo ""
echo "=========================================="
echo "Expected Behavior"
echo "=========================================="
echo ""
case $choice in
1)
echo "• No progress indicators visible"
echo "• Clean presentation display"
;;
2)
echo "• Progress bar at bottom of screen"
echo "• Shows current position: [=====> ] 50%"
echo "• Updates as slides change"
;;
3)
echo "• Countdown bar for each slide"
echo "• Shows time remaining until next slide"
echo "• Resets on each slide transition"
;;
4)
echo "• Overall progress bar at bottom"
echo "• Per-slide countdown overlay"
echo "• Both indicators update in real-time"
;;
esac
echo ""
echo "=========================================="
echo "Impressive Command Options"
echo "=========================================="
echo ""
echo "The Display Manager translates event fields to Impressive options:"
echo ""
echo "Event Field → Impressive Option"
echo "-------------------- → ------------------"
echo "page_progress: true → --page-progress (or -q)"
echo "auto_progress: true → --auto-progress (or -k)"
echo ""
echo "Check the impressive.out.log for the exact command used:"
echo " tail -20 ../logs/impressive.out.log"
echo ""
echo -e "${GREEN}Test complete!${NC}"
echo ""
echo "Tips:"
echo " • Press 'q' to quit the presentation"
echo " • Run this script again to test different configurations"
echo " • Check logs/display_manager.log for detailed output"
echo ""