feat(ui): Implement visual Slice Editor with colored overlays and click-drag
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import pytest
|
||||
from src.models import FileItem
|
||||
from src.fuzzy_anchor import FuzzyAnchor
|
||||
|
||||
def test_add_slice_with_annotations():
|
||||
f_item = FileItem(path="test.py")
|
||||
content = "line1\nline2\nline3\nline4\nline5"
|
||||
|
||||
# Simulate adding a slice from GUI
|
||||
s_line, e_line = 2, 4
|
||||
slice_data = FuzzyAnchor.create_slice(content, s_line, e_line)
|
||||
slice_data['tag'] = "important"
|
||||
slice_data['comment'] = "this is a test"
|
||||
|
||||
f_item.custom_slices.append(slice_data)
|
||||
|
||||
# Verify it's in the list
|
||||
assert len(f_item.custom_slices) == 1
|
||||
assert f_item.custom_slices[0]['tag'] == "important"
|
||||
assert f_item.custom_slices[0]['comment'] == "this is a test"
|
||||
|
||||
# Verify serialization
|
||||
d = f_item.to_dict()
|
||||
assert d['custom_slices'][0]['tag'] == "important"
|
||||
|
||||
# Verify deserialization
|
||||
f_item_2 = FileItem.from_dict(d)
|
||||
assert f_item_2.custom_slices[0]['comment'] == "this is a test"
|
||||
Reference in New Issue
Block a user