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

Regression coverage for RTF/OMML/MathML export (Cell::ToRTF()/ToOMML()/ ToMathML(), Cell::ListToRTF()/ListToOMML()/ListToMathML(), Cell::OMML2RTF()) – until now this path had no test coverage at all. More...

#include <wx/app.h>
#include <wx/bitmap.h>
#include <wx/dcmemory.h>
#include <wx/log.h>
#include "Configuration.h"
#include "MathParser.h"
#include "cells/Cell.h"
#include <catch2/catch.hpp>
Include dependency graph for test_RTFExport.cpp:

Data Structures

class  TestApp
 

Functions

 SCENARIO ("A hidden multiplication sign in RTF export respects the " "\"Hide multiplication sign\" setting (GH #1456)")
 
 SCENARIO ("A hidden multiplication sign leaves visible horizontal space in " "MathML/OMML export, not a zero-width gap (GH #2263)")
 
 SCENARIO ("A matrix's delimiters grow to match its height in RTF/OMML " "export, for every bracket style (GH #1457)")
 
 SCENARIO ("abs()'s bars grow to match content height in RTF/OMML export, " "consistent with the other delimiter-emitting cells")
 
 wxDECLARE_APP (TestApp)
 
int main (int argc, char **argv)
 

Detailed Description

Regression coverage for RTF/OMML/MathML export (Cell::ToRTF()/ToOMML()/ ToMathML(), Cell::ListToRTF()/ListToOMML()/ListToMathML(), Cell::OMML2RTF()) – until now this path had no test coverage at all.

GH #1456: TextCell::ToRTF() didn't check IsHidden()/GetHidableMultSign()/ HidemultiplicationSign() the way ToTeX()/ToXML() already do. A hidden multiplication sign therefore always showed up as a literal "*" in RTF export regardless of the "Hide multiplication sign" setting, and – had it ever been suppressed without a replacement – would have concatenated its neighbours with no separator at all (e.g. the scientific-notation "2*10^7" becoming the unreadable "210^7").

GH #1457: MatrCell::ToOMML() emitted "<m:grow>\"1\"</m:grow>" (a child element whose text content is the two literal characters '"' and '1' and '"') instead of the "m:grow=\"1\"" attribute form every other delimiter- emitting cell (ParenCell/ListCell/IntervalCell) already uses. Since Cell::OMML2RTF() turns element text content into raw RTF, that produced the malformed math control word "{\mgrow "1"}" (literal quote characters in what must be a bare flag) instead of the well-formed "{\mgrow 1}" – Word/LibreOffice silently ignored it and rendered the delimiter at a fixed, small size regardless of the matrix's actual height.

GH #2263: TextCell::ToMathML()/ToOMML() replaced a hidden multiplication sign with the zero-width U+2062 INVISIBLE TIMES character (MathML) or nothing/a bare space (OMML), which – being genuinely zero-width by definition – left far less horizontal separation than the on-screen rendering does: RecalculateWidths() reserves a real quarter-em gap for a hidden multiplication sign even though nothing is drawn there. Fixed by giving the MathML <mo> explicit lspace/rspace attributes summing to that same quarter em (keeping the semantically-correct invisible-times character for accessibility), and by returning immediately once the hidden-multiplication substitution has been made in both ToMathML() and ToOMML() – the style-specific cases further down in each function (e.g. TS_FUNCTION re-deriving the text from scratch) are written for real operator/variable text and would otherwise discard the substitution, falling back to a visible "*"/"ยท" regardless of the hidden setting.

All content below is hand-written XML matching exactly what wxMathML.lisp emits for the corresponding Maxima expressions (verified against wxMathML.lisp itself, not guessed) – no live Maxima needed.