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

Regression tests for the GroupCell <-> EditorCell layout coupling. More...

#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/event.h>
#include <wx/frame.h>
#include <wx/log.h>
#include "Configuration.h"
#include "worksheet/Worksheet.h"
#include "cells/CellList.h"
#include "cells/GroupCell.h"
#include "cells/EditorCell.h"
#include "cells/MatrCell.h"
#include "cells/TextCell.h"
#include <cstdlib>
#include <unistd.h>
#include <catch2/catch.hpp>
Include dependency graph for test_GroupCellLayout.cpp:

Data Structures

class  TestApp
 

Functions

 SCENARIO ("A GroupCell's height tracks the number of lines in its input cell")
 
 SCENARIO ("Adding a line to an already-laid-out input cell grows its GroupCell")
 
 SCENARIO ("A GroupCell's editable is the EditorCell subclass matching its type")
 
 SCENARIO ("Code cells auto-close brackets and %-prefix operators; prose does not")
 
 SCENARIO ("Code and prose cells serialize to RTF via their own override")
 
 SCENARIO ("Incremental search extends the current match in place")
 
 SCENARIO ("Growing a cell pushes the cell below it further down")
 
 SCENARIO ("A matrix whose layout the deadline cancels is recomputed afterwards")
 
 SCENARIO ("A wide output line wraps onto more display lines when the canvas is narrow")
 
 SCENARIO ("A time-sliced recalculation resumes instead of stalling after a slice")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Regression tests for the GroupCell <-> EditorCell layout coupling.

Historically the GroupCell repeatedly stopped growing when its input EditorCell gained a line (by pressing Enter or by word-wrapping) once the cell had been evaluated and thus carried a "(%i1)" prompt label. Two bugs caused this:

  1. GroupCell::RecalculateInput() only counted the height of the first cell on each line, so the taller EditorCell that follows the prompt label was ignored (the group kept the label's one-line height).
  2. EditorCell::Recalculate() updated its height without invalidating the cached list geometry (GetHeightList()), so an incremental recalculation (the keypress path, which does not go through ResetSize()) read a stale, too-small editor height.

These tests exercise the real GroupCell/EditorCell/Worksheet/Configuration code (linked in via the wxmTestApp object library) so a future regression in either path fails the build.