remove multiline
This commit is contained in:
@@ -800,56 +800,33 @@ print("SUCCESS: Single-line text remains unchanged")
|
||||
assert test_result.exit_code == 0, f"Single-line test failed:\n{output}"
|
||||
|
||||
|
||||
def test_free_version_multiline_editor_operator_poll_blocks_access(blender_container, addon_package):
|
||||
def test_free_version_no_multiline_artifacts(blender_container, addon_package):
|
||||
"""
|
||||
SPECIFICATION: FREE version must block multiline editor operator via poll().
|
||||
SPECIFICATION: Multiline feature must be absent from the addon.
|
||||
|
||||
Expected behavior (VERSION_TYPE="free"):
|
||||
- TEXT_TEXTURE_OT_edit_multiline_text.poll() returns False
|
||||
- Operator button should be disabled/grayed out in UI
|
||||
- has_multiline_text() returns False
|
||||
|
||||
Current state (VERSION_TYPE="full"):
|
||||
- Test SKIPS (multiline editor is available)
|
||||
This verification runs inside Blender to ensure that stale helpers or
|
||||
operators are not exposed through the package API.
|
||||
"""
|
||||
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 multiline text feature is disabled
|
||||
from text_texture_generator.utils.constants import has_multiline_text
|
||||
|
||||
if has_multiline_text():
|
||||
print(f"FAIL: has_multiline_text() should return False in FREE version")
|
||||
def fail(msg):
|
||||
print(f"FAIL: {msg}")
|
||||
sys.exit(1)
|
||||
|
||||
# Verify operator is a MockOperator (text_editor_ops.py should be excluded)
|
||||
# has_multiline_text helper must be gone
|
||||
try:
|
||||
import text_texture_generator.operators.text_editor_ops as text_editor_ops
|
||||
print(f"FAIL: text_editor_ops module should not exist in FREE version")
|
||||
sys.exit(1)
|
||||
except (ImportError, ModuleNotFoundError):
|
||||
pass # Expected - module excluded from FREE build
|
||||
from text_texture_generator.utils.constants import has_multiline_text
|
||||
fail("has_multiline_text() helper is still importable")
|
||||
except ImportError:
|
||||
print("SUCCESS: has_multiline_text helper removed")
|
||||
|
||||
# Import operator from main module (should be MockOperator)
|
||||
import text_texture_generator
|
||||
op_class = text_texture_generator.TEXT_TEXTURE_OT_edit_multiline_text
|
||||
|
||||
# Verify it's a MockOperator (no bl_rna, empty bl_idname)
|
||||
if hasattr(op_class, 'bl_rna'):
|
||||
print(f"FAIL: Operator should be MockOperator (has bl_rna)")
|
||||
sys.exit(1)
|
||||
|
||||
if not hasattr(op_class, 'bl_idname') or op_class.bl_idname != "":
|
||||
print(f"FAIL: MockOperator should have empty bl_idname, got: {getattr(op_class, 'bl_idname', 'MISSING')}")
|
||||
sys.exit(1)
|
||||
|
||||
print("SUCCESS: Multiline editor operator correctly blocked via poll()")
|
||||
# Legacy multiline operator must also be absent
|
||||
try:
|
||||
from text_texture_generator import TEXT_TEXTURE_OT_edit_multiline_text
|
||||
fail("TEXT_TEXTURE_OT_edit_multiline_text is still exposed")
|
||||
except ImportError:
|
||||
print("SUCCESS: Multiline editor operator removed")
|
||||
"""
|
||||
|
||||
tar_stream = io.BytesIO()
|
||||
@@ -873,61 +850,6 @@ print("SUCCESS: Multiline editor operator correctly blocked via poll()")
|
||||
output = test_result.output.decode('utf-8', errors='replace')
|
||||
|
||||
assert test_result.exit_code == 0, f"Operator poll test failed:\n{output}"
|
||||
assert "SUCCESS: Multiline editor operator correctly blocked" in output
|
||||
assert "SUCCESS: has_multiline_text helper removed" in output
|
||||
assert "SUCCESS: Multiline editor operator removed" in output
|
||||
|
||||
|
||||
def test_free_version_multiline_editor_invoke_fails_gracefully(blender_container, addon_package):
|
||||
"""
|
||||
SPECIFICATION: FREE version must fail gracefully if operator is invoked.
|
||||
|
||||
Expected behavior (VERSION_TYPE="free"):
|
||||
- Even if poll() is bypassed, invoke should fail gracefully
|
||||
- No crashes or exceptions
|
||||
- Returns appropriate error status
|
||||
|
||||
Current state (VERSION_TYPE="full"):
|
||||
- Test SKIPS (operator works normally)
|
||||
"""
|
||||
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
|
||||
|
||||
# Attempt to import the operator - in FREE version, this module should not exist
|
||||
try:
|
||||
from text_texture_generator.operators.text_editor_ops import TEXT_TEXTURE_OT_edit_multiline_text
|
||||
# If we get here in FREE version, something is wrong
|
||||
print("ERROR: text_editor_ops should not exist in FREE version")
|
||||
sys.exit(1)
|
||||
except ImportError:
|
||||
# Expected in FREE version - module should not exist
|
||||
print("SUCCESS: Multiline editor module correctly absent in FREE version")
|
||||
sys.exit(0)
|
||||
"""
|
||||
|
||||
tar_stream = io.BytesIO()
|
||||
with tarfile.open(fileobj=tar_stream, mode='w') as tar:
|
||||
script_info = tarfile.TarInfo(name='test_editor_invoke.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_editor_invoke.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"Operator invoke test failed:\n{output}"
|
||||
assert "SUCCESS: Multiline editor module correctly absent in FREE version" in output
|
||||
Reference in New Issue
Block a user