wxMaxima
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
test_EditorCellWrapping.cpp File Reference

Tests for automatic line-wrapping inside EditorCells. More...

#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/event.h>
#include <wx/log.h>
#include "CellPointers.h"
#include "Configuration.h"
#include "cells/EditorCell.h"
#include "cells/GroupCell.h"
#include <cstdlib>
#include <memory>
#include <vector>
#include <unistd.h>
#include <catch2/catch.hpp>
Include dependency graph for test_EditorCellWrapping.cpp:

Data Structures

class  TestApp
 

Functions

 SCENARIO ("Prose cells wrap when auto-wrap is on and stay intact")
 
 SCENARIO ("Code cells do not wrap while auto-wrap covers text only")
 
 SCENARIO ("Runs of consecutive spaces survive styling at any width")
 
 SCENARIO ("Soft breaks never leak out of a wrapped cell")
 
 SCENARIO ("Caret positions round-trip across soft breaks")
 
 SCENARIO ("Re-styling at a different width re-derives the wrapping")
 
 SCENARIO ("Code cells wrap when 'Text & Code' is selected, preserving content")
 
 SCENARIO ("Deeply nested code wraps with clamped indentation instead of degenerating")
 
 SCENARIO ("Mouse clicks on indented continuation lines hit the right character")
 
 SCENARIO ("Hard newlines reset the wrap accounting")
 
 SCENARIO ("Undo is unaffected by wrapping")
 
 SCENARIO ("The auto-wrap mode is clamped so code wrapping stays opt-in")
 
 SCENARIO ("Wrapped code leaks no soft break into serialization")
 
 SCENARIO ("Spaceless code still wraps at operators")
 
 SCENARIO ("The ** power operator is never split by a soft break")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Tests for automatic line-wrapping inside EditorCells.

A soft (word-wrap) line break is derived layout data kept OUTSIDE the content string, in the EditorCell::GetSoftBreaks() side table (a hard break is a '
' character in the content). StyleText() re-derives the whole table on every restyle, so wrapping is a pure function of (content, width) that must never change the cell's content or leak into serialization, the clipboard or the selection string. Each break offset is the start of a continuation display line. These tests pin that for the prose path, the code path, and the operator-aware code breaks (wrap after + - * / ( ) ; $, but never inside a '**').

Windowless: real GroupCell/EditorCell against a memory-DC Configuration, no Worksheet, no wxFrame - the test_WorksheetLayout pattern.