@echo off
REM 测试嵌入式Python环境

echo 🧪 Testing Embedded Python Environment...
echo.

REM 切换到项目根目录
cd /d "%~dp0.."

REM 检查嵌入式Python是否存在
if not exist "src-tauri\python-embed\python.exe" (
    echo ❌ Embedded Python not found
    echo Please run: scripts\setup_embedded_python.bat
    pause
    exit /b 1
)

echo ✅ Embedded Python found

REM 测试Python版本
echo 📋 Testing Python version...
src-tauri\python-embed\python.exe --version
if errorlevel 1 (
    echo ❌ Python version test failed
    pause
    exit /b 1
)

REM 测试基础依赖
echo 📦 Testing dependencies...
src-tauri\python-embed\python.exe -c "import requests; print('✅ requests OK')"
src-tauri\python-embed\python.exe -c "import PIL; print('✅ Pillow OK')"
src-tauri\python-embed\python.exe -c "import json; print('✅ json OK')"

REM 测试python_core模块
echo 🔧 Testing python_core module...
src-tauri\python-embed\python.exe -c "import python_core; print('✅ python_core OK')"
if errorlevel 1 (
    echo ❌ python_core module test failed
    echo The module might not be copied correctly
    pause
    exit /b 1
)

REM 测试主入口
echo 🚀 Testing main entry point...
src-tauri\python-embed\python.exe -m python_core.main --module test --action hello
if errorlevel 1 (
    echo ❌ Main entry point test failed
    pause
    exit /b 1
)

REM 测试服务模块
echo 🔧 Testing service modules...
src-tauri\python-embed\python.exe -m python_core.main --module template_manager --action get_templates
if errorlevel 1 (
    echo ❌ Service module test failed
    echo This is expected if using mock services
)

echo.
echo 🎉 All tests passed!
echo.
echo 📋 Next steps:
echo 1. Start your Tauri app: cargo tauri dev
echo 2. Go to Python Test page
echo 3. Run tests - should show "Using embedded Python for execution"
echo.

pause
