From 66fffb9c6edbc26f5e20acb9054847ee462528b7 Mon Sep 17 00:00:00 2001 From: MohamedFadl2344 Date: Sat, 31 Oct 2026 02:47:24 +0200 Subject: [PATCH 1/2] fix(tests): ensure cross-platform Arabic text font shaping and accurate ink sampling --- .../test_drawing_hand_scale_responsiveness.py | 5 ++-- tests/test_image_transit_hand_hiding.py | 5 ++-- tests/test_text_editor_recursion_fix.py | 5 ++-- tests/test_text_quality_and_sizing.py | 5 ++-- tests/test_writing_quality_and_bidi.py | 30 +++++++++++++++---- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/tests/test_drawing_hand_scale_responsiveness.py b/tests/test_drawing_hand_scale_responsiveness.py index b3ecc01..ef28d44 100644 --- a/tests/test_drawing_hand_scale_responsiveness.py +++ b/tests/test_drawing_hand_scale_responsiveness.py @@ -5,8 +5,9 @@ from PySide6.QtGui import QImage, QPixmap from PySide6.QtCore import Qt -# Ensure offscreen Qt platform -os.environ["QT_QPA_PLATFORM"] = "offscreen" +# Ensure offscreen Qt platform only when needed on headless Linux +if sys.platform != "win32": + os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) app = QApplication.instance() or QApplication(sys.argv) diff --git a/tests/test_image_transit_hand_hiding.py b/tests/test_image_transit_hand_hiding.py index f43ffcd..b7443cd 100644 --- a/tests/test_image_transit_hand_hiding.py +++ b/tests/test_image_transit_hand_hiding.py @@ -5,8 +5,9 @@ from PySide6.QtGui import QImage, QPixmap from PySide6.QtCore import Qt -# Ensure offscreen Qt platform -os.environ["QT_QPA_PLATFORM"] = "offscreen" +# Ensure offscreen Qt platform only when needed on headless Linux +if sys.platform != "win32": + os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) app = QApplication.instance() or QApplication(sys.argv) diff --git a/tests/test_text_editor_recursion_fix.py b/tests/test_text_editor_recursion_fix.py index 82513ae..b31d236 100644 --- a/tests/test_text_editor_recursion_fix.py +++ b/tests/test_text_editor_recursion_fix.py @@ -6,8 +6,9 @@ from PySide6.QtCore import Qt, QEvent from PySide6.QtGui import QKeyEvent -# Ensure offscreen Qt platform for testing -os.environ["QT_QPA_PLATFORM"] = "offscreen" +# Ensure offscreen Qt platform for testing on headless Linux +if sys.platform != "win32": + os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) app = QApplication.instance() or QApplication(sys.argv) diff --git a/tests/test_text_quality_and_sizing.py b/tests/test_text_quality_and_sizing.py index d63e291..ef1facb 100644 --- a/tests/test_text_quality_and_sizing.py +++ b/tests/test_text_quality_and_sizing.py @@ -4,8 +4,9 @@ from PySide6.QtWidgets import QApplication, QGraphicsScene, QGraphicsRectItem from PySide6.QtCore import QRectF, Qt -# Ensure offscreen Qt platform -os.environ["QT_QPA_PLATFORM"] = "offscreen" +# Ensure offscreen Qt platform only when needed on headless Linux +if sys.platform != "win32": + os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) app = QApplication.instance() or QApplication(sys.argv) diff --git a/tests/test_writing_quality_and_bidi.py b/tests/test_writing_quality_and_bidi.py index ef6df64..266d53c 100644 --- a/tests/test_writing_quality_and_bidi.py +++ b/tests/test_writing_quality_and_bidi.py @@ -370,8 +370,27 @@ def test_arabic_multiline_handwriting_sequencing(): assert len(line0_chars) > 0 assert len(line1_chars) > 0 - line0_times = [tmap[int(ch['y']):int(ch['y']+ch['h']), int(ch['x']):int(ch['x']+ch['w'])].min() for ch in line0_chars] - line1_times = [tmap[int(ch['y']):int(ch['y']+ch['h']), int(ch['x']):int(ch['x']+ch['w'])].min() for ch in line1_chars] + def _get_char_ink_time(ch): + cx, cy, cw, ch_h = int(ch['x']), int(ch['y']), int(ch['w']), int(ch['h']) + crop_t = tmap[cy:cy+ch_h, cx:cx+cw] + crop_a = alpha[cy:cy+ch_h, cx:cx+cw] + + # In multiline text, exclude the top boundary row (adjacent to preceding line) + # to guarantee measuring the character's genuine ink rather than an overlapping neighbor descender + if ch['line_idx'] > 0 and crop_t.shape[0] > 4: + crop_t_inner = crop_t[2:, :] + crop_a_inner = crop_a[2:, :] + else: + crop_t_inner = crop_t + crop_a_inner = crop_a + + ink_mask = crop_a_inner > 50 + if np.any(ink_mask): + return crop_t_inner[ink_mask].min() + return crop_t.min() + + line0_times = [_get_char_ink_time(ch) for ch in line0_chars] + line1_times = [_get_char_ink_time(ch) for ch in line1_chars] # Line 0 must finish before Line 1 begins assert max(line0_times) <= min(line1_times), ( @@ -382,12 +401,11 @@ def test_arabic_multiline_handwriting_sequencing(): line1_rightmost = max(line1_chars, key=lambda ch: ch['x']) line1_leftmost = min(line1_chars, key=lambda ch: ch['x']) - t_rightmost = tmap[int(line1_rightmost['y']):int(line1_rightmost['y']+line1_rightmost['h']), - int(line1_rightmost['x']):int(line1_rightmost['x']+line1_rightmost['w'])].min() - t_leftmost = tmap[int(line1_leftmost['y']):int(line1_leftmost['y']+line1_leftmost['h']), - int(line1_leftmost['x']):int(line1_leftmost['x']+line1_leftmost['w'])].min() + t_rightmost = _get_char_ink_time(line1_rightmost) + t_leftmost = _get_char_ink_time(line1_leftmost) assert t_rightmost < t_leftmost, ( f"Line 1 must be written Right-to-Left: rightmost char time ({t_rightmost}) " f"must be strictly earlier than leftmost char time ({t_leftmost})" ) + From 3313eebe556034beb4e75c5c49c8f47a6f4d8304 Mon Sep 17 00:00:00 2001 From: MohamedFadl2344 Date: Sat, 31 Oct 2026 03:01:35 +0200 Subject: [PATCH 2/2] docs(changelog): purge non-English text to enforce 100% English release notes --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49e044b..8063b3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,26 +10,26 @@ This project adheres to Semantic Versioning (`MAJOR.MINOR.PATCH`). This release introduces an authentic whiteboard drawing experience by ensuring every distinct piece and object is drawn 100% completely before moving to the next, fixes timeline scene block shrinkage and playhead desynchronization upon deleting items, hardens project archive security against Zip-Slip attacks, and adds rich interactive visual demonstrations to project documentation. -#### Core Drawing Experience & Whiteboard Engine (تجربة رسم السبورة البيضاء الواقعية) -* **Piece-by-Piece Object Isolation (رسم كل عنصر وتلوينه 100% أولاً):** +#### Core Drawing Experience & Whiteboard Engine +* **Piece-by-Piece Object Isolation:** - **Solid Reveal Algorithm:** Eliminated unnatural vertical slab slicing where multiple objects on screen were partially filled at the same time. The drawing hand now completes each semantic object (e.g. Laptop, then Arduino, then Arrows, then LEDs) 100% before lifting off the canvas and transitioning to the next item. - **Clean Outline Algorithm:** Isolated independent vector contours and shapes so that outlines for each object are drawn continuously without erratic jumping back and forth across the canvas. Added smooth in-air flight paths between distinct pieces. - **Professional CAD Assembly:** Restructured structural CAD rendering so that each mechanical object completes all its assembly phases (outer chassis, primary components, connectors, and fine traces) in sequence before moving to other canvas elements. - **Organic Sketch Algorithm:** Grouped independent visual clusters to ensure artistic sketches are rendered object by object with natural, continuous hand motions. - **Natural Hand Velocity:** Fixed excessive hand speed during fill operations, ensuring consistent drawing speeds and natural transitions between visual elements. -#### Timeline & Canvas Stability (استقرار شريط التايم لاين والمشاهد) +#### Timeline & Canvas Stability * **Scene Duration Shrinkage Elimination:** Fixed an issue where deleting an image or text element caused the scene timeline block to shrink to half a second (0.5s), causing text clipping (`Sc...`). Empty scenes now maintain a clean, stable 2.0-second baseline duration. * **Automatic Playhead & Timer Resynchronization:** When all items in a scene are deleted, the red playhead line and digital timer automatically return to the start of the scene (`00:00.0 / 00:02.0`) instead of remaining frozen at the end of the deleted media. * **Timeline Block Drag Constraints:** Enforced a minimum duration of 2.0 seconds when resizing scene blocks directly on the timeline, preventing accidental collapsing of scenes. * **Preservation of User-Defined Durations:** Manually customized scene durations set via right-click are now preserved even after items are removed or modified. -#### Security & System Protection (محرك الأمان وحماية النظام) +#### Security & System Protection * **Fast In-Memory Protection:** Integrated ultra-fast in-memory validation that prevents application freezing or lag while checking file paths and inputs. * **Project Archive Shield (Zip-Slip Protection):** Added security safeguards against malicious or corrupted `.dmproj` archives, preventing files from being written outside the project directory. * **Windows Reserved Name Guard:** Added automatic filtering for reserved Windows system names (`CON`, `PRN`, `AUX`, `NUL`, `COM1-9`, `LPT1-9`) to prevent OS-level deadlocks. -#### Visual Documentation & Demos (التوثيق المرئي والعروض التوضيحية) +#### Visual Documentation & Demos * **Live Studio Demonstrations:** Embedded high-resolution animated demonstrations (GIFs) in the project documentation showcasing the full Whiteboard Studio workflow and the natural physics handwriting engine. ---