Testing Verification

testing verification placeholder

#!/bin/bash

Quick test to verify CSS is in APKG SQLite database

cat « ‘EOF’

╔═══════════════════════════════════════════════════════════════════════════════╗ ║ ║ ║ HOW TO VERIFY CSS IS EMBEDDED IN YOUR APKG FILES ║ ║ ║ ╚═══════════════════════════════════════════════════════════════════════════════╝

FILES TO TEST WITH ════════════════════════════════════════════════════════════════════════════════

Run this command to generate test APKGs:

python3 « ‘PYTHON’ import json import tempfile from pathlib import Path from scripts.anki.apkg_generator import APKGGenerator

Psychology APKG

psy_data = { “metadata”: {“course”: “psychology”, “deck_name”: “Psy-Test”, “unit”: “U1”, “module”: “M1”}, “flashcards”: [{“id”: “1”, “question”: “Q?”, “answer”: “A”, “tags”: [“test”], “difficulty”: 1}] }

with tempfile.TemporaryDirectory() as tmpdir: gen = APKGGenerator() psy = gen.generate_from_data(psy_data, tmpdir, “Psy-Test”) import shutil shutil.copy(psy, Path.home() / “Desktop” / “psychology-test.apkg”) print(f"✅ Copied to ~/Desktop/psychology-test.apkg")

DevOps APKG

devops_data = { “metadata”: {“course”: “devops”, “deck_name”: “Dev-Test”, “unit”: “U1”, “module”: “M1”}, “flashcards”: [{“id”: “1”, “question”: “Q?”, “answer”: “A”, “tags”: [“test”], “difficulty”: 1}] }

with tempfile.TemporaryDirectory() as tmpdir: gen = APKGGenerator() dev = gen.generate_from_data(devops_data, tmpdir, “Dev-Test”) import shutil shutil.copy(dev, Path.home() / “Desktop” / “devops-test.apkg”) print(f"✅ Copied to ~/Desktop/devops-test.apkg")

PYTHON

OPTION 1: Check File Sizes (Simplest) ════════════════════════════════════════════════════════════════════════════════

ls -lh ~/Desktop/*.apkg

Expected Output: psychology-test.apkg 68 KB ← Includes psychology CSS devops-test.apkg 72 KB ← Includes devops CSS

Why it matters: • Default APKG would be ~56 KB • Psychology adds ~12 KB (CSS overhead) • DevOps adds ~16 KB (CSS overhead) • Size difference proves CSS is embedded

OPTION 2: Extract and View APKG Contents (Intermediate) ════════════════════════════════════════════════════════════════════════════════

APKGs are ZIP files, extract one:

cd ~/Desktop unzip -l psychology-test.apkg

Expected Output: Archive: psychology-test.apkg Length Date Time Name


 69632  02-May-26 12:34    collection.anki2
     2  02-May-26 12:34    media

Note: CSS is NOT a separate file - it’s embedded in the SQLite database inside collection.anki2 as part of the model templates.

OPTION 3: Inspect CSS in SQLite Database (Advanced) ════════════════════════════════════════════════════════════════════════════════

Extract APKG and inspect the database:

cd ~/Desktop unzip psychology-test.apkg collection.anki2

Query the models table (where CSS is stored):

sqlite3 collection.anki2 « ‘SQL’ SELECT id, name, LENGTH(css) as css_length FROM models; SQL

Expected Output: id|name|css_length 1|Basic (with Difficulty)|16523 2|Cloze (with Difficulty)|16523 3|Hints (with Difficulty)|16523

The css_length of ~16,500+ bytes confirms psychology.css (16 KB) is embedded!

View first 200 characters of CSS:

sqlite3 collection.anki2 « ‘SQL’ SELECT SUBSTR(css, 1, 200) FROM models WHERE id = 1; SQL

Expected Output: /**

  • Anki Card Styling - Psychology Course
  • Version: 1.0
  • Psychology course-specific styling overrides…

This proves the psychology CSS is in the database!

OPTION 4: Compare CSS Between APKGs (Advanced) ════════════════════════════════════════════════════════════════════════════════

Extract both APKGs:

cd ~/Desktop unzip psychology-test.apkg collection.anki2 -d psy unzip devops-test.apkg collection.anki2 -d dev

Compare CSS size and first lines:

sqlite3 psy/collection.anki2 “SELECT SUBSTR(css, 1, 100) FROM models WHERE id = 1;” > psy_css.txt sqlite3 dev/collection.anki2 “SELECT SUBSTR(css, 1, 100) FROM models WHERE id = 1;” > dev_css.txt

diff psy_css.txt dev_css.txt

Expected Output: Different header comments showing different courses: - Psychology version - DevOps version

This proves each APKG has its own course-specific CSS!

OPTION 5: Full CSS Extraction (If You Want to See All Styling) ════════════════════════════════════════════════════════════════════════════════

Extract full CSS from psychology APKG:

sqlite3 collection.anki2 “SELECT css FROM models WHERE id = 1;” > psychology-full.css

View it:

head -50 psychology-full.css grep -A 5 “.skill-card” psychology-full.css grep “color-primary” psychology-full.css

Expected Output: Shows all the psychology styling rules Colors, spacing, custom components, etc.

VISUAL TESTING IN ANKI DESKTOP ════════════════════════════════════════════════════════════════════════════════

  1. Open Anki Desktop

  2. File → Import

  3. Select: ~/Desktop/psychology-test.apkg

  4. Click Import

  5. Look for Psychology Styling: ✓ Light blue background (#f0f7ff) ✓ Blue left border (4px) ✓ Blue text headings ✓ Professional color scheme

  6. Import devops-test.apkg next

  7. Look for DevOps Styling: ✓ Different colors (red, green, blue) ✓ Different feel from psychology ✓ Technical appearance

This visual check proves styling is rendered!

SUMMARY: HOW TO KNOW STYLING IS WORKING ════════════════════════════════════════════════════════════════════════════════

✅ File Size Test (Quick)

  • Psychology APKG should be ~68 KB
  • DevOps APKG should be ~72 KB
  • Default would be ~56 KB
  • Size difference = CSS embedded

✅ SQLite Database Test (Definitive)

  • Query models table with sqlite3
  • Check css_length > 16000 bytes
  • Proves CSS in database

✅ Content Test (Visual)

  • Extract CSS from database
  • Search for psychology/devops keywords
  • View first lines to confirm header

✅ Anki Desktop Test (User Experience)

  • Import APKG and view cards
  • Check colors, fonts, spacing
  • Verify styling renders correctly

TROUBLESHOOTING: CSS NOT SHOWING UP ════════════════════════════════════════════════════════════════════════════════

Problem 1: APKG size is same as default (56 KB) Solution: 1. Check metadata has course field 2. Check course name is lowercase and exact 3. Recompile CSS: npm run anki:styles:compile 4. Regenerate APKG

Problem 2: SQLite query shows small css_length (~1000 bytes) Solution: 1. CSS didn’t compile 2. CSS file not found 3. Using default CSS fallback

Fix: npm run anki:styles:compile npm run anki:styles:list Verify files exist!

Problem 3: Anki Desktop cards have no color/styling Solution: 1. Check APKG was imported (not copied) 2. Clear Anki cache: Tools → Check Database 3. Force reload cards 4. Try on mobile Anki to compare

═══════════════════════════════════════════════════════════════════════════════

Ready to test? Follow TESTING_GUIDE.md for complete walkthrough!

═══════════════════════════════════════════════════════════════════════════════

EOF