Helpful and useful Delphi Routines as Single Pas Files
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Useful Delphi Units which provide full functionality in a single PAS file.

There are currently 3 units available:

  • DUnitm - A test framework
  • MultiPageImage - Support for Multipage Tif in Standard Delphi TImage.
  • Record Utils - JSON, XML, Value-Pair Type serializer/deserializer for Record types

DUnitm - Mini Test Framework

The Mini Test framework is a light-weight unit testing framework which simply requires that you include the single MiniTestFrameWork.pas in a console app, and start testing your code. Check out the Blog here

Added Features: Release 1

  • Test Run support
  • Set level Skipping
  • Set level Expected Exceptions
  • Project Templates

Added Features: Release 2

  • Refactoring to correct issues with naming conventions
  • Deprecated functions using incorrect previous naming convention
  • Case level skipping stops cases from actually being evaluated. **

Breaking changes Release 1 to 2

The Skip parameter type in AddTestCase and Assertions has been changed from boolean to a custom Enum TSkipType. This was required to support case level skipping. Using the Frameworks SKIP or SKIPPED constants will continue to work as normal, however this is a breaking change for existing cases where the Skip parameter has been implemented using a BOOLEAN expression. You need to change to skipTrue or skipFalse in this case.

See the updated wiki!

Updated Support

Now Supports All versions of Delphi back to Delphi 7 (and probably 4). This has been tested on:

Version Version Version Version Version
4 ☐ 2005 ☐ XE ☑ XE6 ☐ 10.0 Seattle
5 ☑ 2006 ☐ XE2 ☑ XE7 ☐ 10.1 Berlin
6 ☐ 2007 ☑ XE3 ☐ XE8 ☐ 10.2 Tokyo
7 ☑ 2009 ☑ XE4 ☐
8 ☐ 2010 ☑ XE5 ☑

If using versions of Delphi 2005 or 2006, You may have trouble with the 2007 DPROJ file in the Test Unit and the Project Template folders. If you do have trouble, simply remove the DPROJ file and get Delphi to rebuild from the DPR file.


This unit MultiPageImage.pas supports multipage TIF in the standard VCL TImage by simply adding the unit to the project. This is in the same way as you add JPEG, GIF and PNG support. The Unit has helper methods for TImage and TPicture which provides TIF multi page support including:

  • PageCount (read only)
  • PageNumber (read or set)
  • LoadFromFile(Filename, PageNo)
  • LoadFromStream(Stream, PageNo)

NOTE: This is MOSTLY not new work: it simply moves a copy of the TWICImage class (from VCL.Graphics) to its own unit and adds the few lines of code required to support multiple pages, and implements the helpers for TImage and TPicture to use the feature.

WARNING! SaveToFile still only has single file support as of September 2018.

Supported Versions

Graphics.WICMultipage supports all versions of Delphi back to Delphi 2010. Delphi 2009 also works, but there are a number of minor issues and is dependent on a copy of Delphi 2010 Wincodec unit with some modification. So 2009 is not recommended. This unit has has been tested on:

Version Version Version Version Version
4 ☐ 2005 ☐ XE ☑ XE6 ☐ 10.0 Seattle
5 ☐ 2006 ☐ XE2 ☑ XE7 ☐ 10.1 Berlin
6 ☐ 2007 ☒ XE3 ☐ XE8 ☐ 10.2 Tokyo
7 ☐ 2009 ☑ XE4 ☐ Delpi 2010 ☑
8 ☐ 2010 ☑ XE5 ☑

Record Utils - Utils for cloning, clearing, serialising/Deserialising Pascal Record Types

Pascal Records are extremely useful for working with the Parallel Type Library because they are automatically memory managed. However not not being classes, they are more difficult to automatically populate from Streamed Data without using published properties.

The RecordUtils.pas file uses RTTI to automatically serialise and deserialse as value pairs. eg

TMyRecordStatus = (mrsNone, mrsBusy, mrsIdle); 
  id : integer;
  Name: string;
  isNew : boolean;
  Status : TMyRecordStatus; // enum

WIll be serialised as


Supported Types

Currently only the Data types Integer, String, Boolean and any Enumerated type are supported. NESTED Records is not supported at this time.

Support for Arrays

Yes, arrays are supported. The Above example as an array would be output as:



The Data Type and Array count can optionally be included in the data in the following way:

Single Record


Array of Records


The alternative format where each id is prefixed with the data type is also supported for Parsing (but will not be output in this format). Eg

Single Record

Array of Records



Line Endings

Internally the string structure is managed as a TStringlist, so the line ending symantics are a consequence of that architecture. The

The <CR> (Carriage Return, ASCII-13) cannot be represented as a single line in the TStringlist (by default) and consequently are always converted to <LF> (Line Feed, ASCII-10). So <CRLF> becomes <LF>, <CR> becomes <LF>, <CRLF><LF> becomes <LF><LF>. At this stage, to preserve <CR>, you must pre-process the string representation using an alternate encoding scheme (eg HTML encoding )