Skip to content

Latest commit

 

History

History
190 lines (137 loc) · 5.14 KB

File metadata and controls

190 lines (137 loc) · 5.14 KB

Testing Your SWG STF Editor Extension

Step-by-Step Testing Guide

Step 1: Launch Extension in Debug Mode

  1. Open the extension folder in VS Code:

    c:\Users\Joseph Ridder\Documents\SWG-Source\swg-stf-editor-extension
    
  2. Press F5 to launch the Extension Development Host window

  3. A new VS Code window will open with the extension loaded

Step 2: Find Test STF Files

You have STF files in your workspace! They're located in:

c:\Users\Joseph Ridder\Documents\SWG-Source\client-assets-master\string\en\

Example STF files you can test with:

  • Any .stf files in the string/en/ directory
  • Common ones include UI strings, creature names, etc.

Step 3: Open an STF File

Method 1: File Explorer

  1. In the Extension Development Host window, open your SWG-Source folder
  2. Navigate to client-assets-master\string\en\
  3. Right-click any .stf file
  4. Select "Open With..." > "SWG String File Editor"

Method 2: Command Palette

  1. Press Ctrl+Shift+P
  2. Type "Open SWG String File"
  3. Browse to client-assets-master\string\en\
  4. Select any .stf file

Step 4: Test Editing

  1. The file should open in a custom editor showing text format like:

    [string_name]
    id=0
    crc=123456
    text=Some localized text
    
  2. Make a change to one of the text= lines

  3. Press Ctrl+S to save

  4. Close and reopen the file to verify your changes were saved

Step 5: Verify Binary Format

To verify the extension is correctly writing binary files:

  1. Open an STF file with the extension
  2. Make a simple change
  3. Save the file
  4. Check the file size - it should still be reasonable (not massively larger)
  5. Try opening with the original LocalizationTool (if available) to verify compatibility

Test Cases

Test Case 1: Read-Only Test

  • Action: Open any STF file
  • Expected: File content displays as readable text
  • Verify: Check that all sections appear with [name], id=, crc=, text=

Test Case 2: Edit and Save

  • Action: Edit a text field and save
  • Expected: File saves without errors
  • Verify: Reopen file and see your changes

Test Case 3: Special Characters

  • Action: Add text with newlines: text=Line 1\\nLine 2
  • Expected: Saves correctly
  • Verify: Reopen shows the escaped newline

Test Case 4: New String Entry

  • Action: Add a new section at the end:
    [test_string]
    id=9999
    crc=0
    text=Test text
    
  • Expected: Saves successfully
  • Verify: Reopen shows the new entry

Test Case 5: Multiple Files

  • Action: Open multiple STF files simultaneously
  • Expected: Each file works independently
  • Verify: Changes in one don't affect the other

Debugging Issues

If the extension doesn't activate:

  1. Check the Output panel: View > Output > Select "Extension Host"
  2. Look for any error messages
  3. Check that the file has .stf extension
  4. Try reloading: Ctrl+Shift+P > "Developer: Reload Window"

If files won't open:

  1. Check file permissions
  2. Verify the file is a valid STF file (starts with 0xDEADBEEF magic number)
  3. Look at the developer console: Help > Toggle Developer Tools

If saves are corrupted:

  1. Keep backups of original files
  2. Check the text format for syntax errors
  3. Verify IDs are unique integers
  4. Check that section headers use [name] format correctly

Finding STF Files in Your Workspace

Run this command to find all STF files:

Get-ChildItem -Path "c:\Users\Joseph Ridder\Documents\SWG-Source" -Filter "*.stf" -Recurse | Select-Object FullName

Common locations:

  • client-assets-master\string\en\*.stf
  • Look for subdirectories with localization data

Manual Binary Inspection (Advanced)

To verify the binary format is correct:

# View first 20 bytes of an STF file in hex
Format-Hex -Path "path\to\file.stf" -Count 20

Expected output should start with:

  • EF BE AD DE (magic number in little-endian)
  • Followed by version byte (00 or 01)

Success Criteria

The extension is working correctly if:

  • ✅ STF files open and display readable text
  • ✅ Text edits save successfully
  • ✅ Reopened files show the saved changes
  • ✅ File sizes remain reasonable
  • ✅ No errors appear in the output panel
  • ✅ Multiple files can be edited simultaneously

Next Steps After Testing

  1. Package the extension: vsce package
  2. Install locally: Test the .vsix file
  3. Share with testers: Get feedback from other SWG developers
  4. Publish: Follow BUILD.md instructions for marketplace publication

Reporting Issues

If you find bugs:

  1. Note the exact steps to reproduce
  2. Check the Output panel for error messages
  3. Save the problematic STF file (if safe to share)
  4. Document the expected vs. actual behavior

Performance Testing

For large files:

  1. Find the largest STF file in your workspace
  2. Open it and measure load time
  3. Make an edit and measure save time
  4. Verify memory usage (Task Manager or Activity Monitor)

Target performance:

  • Load: <2 seconds for files under 1MB
  • Save: <1 second for typical files
  • Memory: <100MB total

Happy Testing! 🧪

Once you've verified everything works, you're ready to publish to the VS Code Marketplace!