text fitting pro feature

This commit is contained in:
2025-10-10 14:41:18 +02:00
parent 0edf324335
commit 596f640912
23 changed files with 909 additions and 86 deletions

View File

@@ -347,7 +347,66 @@ print("SUCCESS: Image overlay properly blocked")
output = test_result.output.decode('utf-8', errors='replace')
assert test_result.exit_code == 0, f"Overlay block test failed:\n{output}"
assert "SUCCESS: Image overlay properly blocked" in output
def test_free_version_blocks_text_fitting(blender_container, addon_package):
"""
SPECIFICATION: Free version MUST block text fitting functionality.
Expected behavior (VERSION_TYPE="free"):
- "text_fitting" NOT in ENABLED_FEATURES
- has_text_fitting() returns False
- Text fitting controls unavailable
- UI shows "🔒 PRO" on text fitting controls
Current state (VERSION_TYPE="full"):
- Test SKIPS (text_fitting is available)
"""
version_type, enabled_features = get_version_type(blender_container, addon_package)
if version_type == "full":
pytest.skip("Test requires VERSION_TYPE='free' - currently 'full' (specification test)")
script_content = """
import bpy
import sys
# Verify text_fitting NOT enabled
from text_texture_generator.utils.constants import ENABLED_FEATURES, has_text_fitting
if "text_fitting" in ENABLED_FEATURES:
print(f"FAIL: text_fitting should NOT be in ENABLED_FEATURES for free version")
sys.exit(1)
# Verify has_text_fitting() returns False
if has_text_fitting():
print(f"FAIL: has_text_fitting() should return False for free version")
sys.exit(1)
print("SUCCESS: Text fitting properly blocked")
"""
tar_stream = io.BytesIO()
with tarfile.open(fileobj=tar_stream, mode='w') as tar:
script_info = tarfile.TarInfo(name='test_text_fitting.py')
script_bytes = script_content.encode('utf-8')
script_info.size = len(script_bytes)
tar.addfile(script_info, io.BytesIO(script_bytes))
tar_stream.seek(0)
blender_container.put_archive('/addon-test', tar_stream)
test_cmd = [
"/usr/local/bin/run_blender.sh",
"--background",
"--python",
"/addon-test/test_text_fitting.py"
]
test_result = blender_container.exec_run(test_cmd, workdir="/addon-test")
output = test_result.output.decode('utf-8', errors='replace')
assert test_result.exit_code == 0, f"Text fitting block test failed:\n{output}"
assert "SUCCESS: Text fitting properly blocked" in output
def test_free_version_texture_size_limited(blender_container, addon_package):