|
wxMaxima
|
Regression tests for images surviving the .wxm serialization round-trip. More...
#include <wx/app.h>#include <wx/bitmap.h>#include <wx/dcmemory.h>#include <wx/filename.h>#include <wx/frame.h>#include <wx/image.h>#include <wx/log.h>#include <wx/mstream.h>#include <wx/tokenzr.h>#include "Configuration.h"#include "WXMformat.h"#include "worksheet/Worksheet.h"#include "cells/CellList.h"#include "cells/EditorCell.h"#include "cells/GroupCell.h"#include "cells/ImgCell.h"#include <cstdlib>#include <unistd.h>#include <catch2/catch.hpp>Data Structures | |
| class | TestApp |
Functions | |
| SCENARIO ("Raster images survive the .wxm round-trip byte-for-byte") | |
| SCENARIO ("An image loaded from a file (background task) survives the .wxm round-trip") | |
| SCENARIO ("Cells following an image are not lost by the .wxm round-trip") | |
| SCENARIO ("Every text cell type survives the .wxm round-trip with its content and order") | |
| SCENARIO ("Code cell answers and the send-known-answers flag survive the round-trip") | |
| SCENARIO ("A page break does not swallow the cell that follows it") | |
| SCENARIO ("A .wxm that opens with a fold marker does not crash the parser") | |
| SCENARIO ("A folded section's hidden children survive the .wxm round-trip") | |
| SCENARIO ("Nested folds survive the .wxm round-trip") | |
| SCENARIO ("An image folded into a section survives the .wxm round-trip byte-for-byte") | |
| wxDECLARE_APP (TestApp) | |
| int | main (int argc, char **argv) |
Regression tests for images surviving the .wxm serialization round-trip.
Copying cells to the clipboard is essentially the same code path as saving a .wxm worksheet (Format::TreeToWXM), so these tests guard both. The concrete bug that motivated them: ImgCell::GetCompressedImage() read the raw compressed buffer without waiting for a still-running background image load, so copying a freshly drag-dropped image serialized it as zero bytes -> a "cannot render the image / zero length" cell after paste. Here we build image cells in several formats, serialize them to .wxm and parse them back, and check the image data survives (byte-for-byte – .wxm stores the compressed bytes verbatim as base64). A file-loaded image additionally exercises the background-load path that GetCompressedImage() must wait for.