Testing¶
make check (with the same variables as the build) builds the programs
in tests/ in ANSI and Unicode and runs them under Wine, starting Xvfb
when there is no display. For a Linux or macOS target it builds core,
memtest, wintest, disptest, isapitest, dlgtest, sditest,
mditest, cmntest, splittest, docktest, dbtest, rvtest,
socktest, occtest, dlltest, inettest, oletest, iptest,
docobtest, linktest, bindtest, richtest, richsrvtest,
autotest, srvtest, atlwintest, atltest, conntest, ctltest,
wltest, dragtest, daotest, dvtest, htmltest, atlctltest,
atlutiltest, cdlgtest, vistatest, iotest, audiotest and wtltest against
the portable layer, and exttest, core, sditest,
dlgtest and dlltest again with the shared libraries
(SHARED_TESTS), and runs them directly; NATIVE_TESTS names others to
try.
core: CString, collections, CFile, CArchive and serialization, CTime, exceptions and run-time classes, on the console.memtest: the memory diagnostics in a debug build: DEBUG_NEW and object blocks, CMemoryState (Checkpoint, Difference, DumpStatistics, DumpAllObjectsSince) caught through afxDump, guard bytes and AfxCheckMemory, AfxIsMemoryBlock, AfxDoForAllObjects, tracking turned off, the allocation hook and delayed frees, on the console.wintest: windows and drawing below the MFC classes: window classes and windows, the window tree and coordinates, sending and posting, the message loop, timers, messages between threads, hooks, ANSI and Unicode window procedures, focus, painting and scrolling, memory DCs, monochrome bitmaps, DIB sections, raster operations, regions, clipping, SaveDC and mapping modes, lines, shapes, fill modes, flood fills, paths, text metrics and extents, TextOut and DrawText; the common controls through their messages (status bar, progress, trackbar, up-down, header, tabs, hotkey, list and tree views, IP address, ComboBoxEx, month calendar, date and time picker, an animation from an AVI file) and property sheets; printer DCs, a job printed to a file, and the Print and Page Setup dialogs driven through their hooks; a window shaped by SetWindowRgn (hit testing and clipping) and files dropped on a window (WM_DROPFILES, DragQueryFile and DragQueryPoint); a CWnd with a message map; and, on Linux and macOS, the monitor, layered windows, PrintWindow, scroll bar and cursor information, flat scroll bars, GradientFill, shadowed text, glyph indices and fractional widths, a metafile's description, themes and OpenGL (both absent), DECIMAL conversions and comparison, and the shell namespace (ID lists, shell folders and their items) with SHBrowseForFolder driven through its callback, on the console.disptest: the automation helpers inafxdisp.h(COleDateTime and its span, COleCurrency, COleVariant, COleSafeArray) and a COleDispatchDriver calling an IDispatch written in the test, on the console.autotest: automation servers: a dispatch map's methods and properties called through IDispatch and COleDispatchDriver (argument conversion, by-reference arguments, errors, exceptions, the default member, derived classes), interface maps, aggregation, a COleObjectFactory in the same process and its registry entries, and the program started again by COM as a local server (with type information from it, natively), on the console.conntest: connection points and type libraries, on the console: a connection map through IConnectionPointContainer and IConnectionPoint (enumeration, limits, cookies), AfxConnectionAdvise with and without a reference, events fired to dispatch sinks, and the type information of IMPLEMENT_OLETYPELIB from a type library the test writes and registers.socktest:afxsock.hover the loopback interface: CAsyncSocket events, blocking CSocket calls against a server thread, CArchive through a CSocketFile, datagrams, errors and cancelling a blocking call, and IPv6 datagrams and connections over::1with the Ex functions (the IPv6 checks run only where the system has IPv6).inettest:afxinet.hagainst an HTTP server and an FTP server the test runs itself: AfxParseURL, OpenURL for http, ftp and file URLs, GET, POST and PUT requests (SendRequest, SendRequestEx and EndRequest, buffered writes), request headers, status codes and QueryInfo, ReadString, cookies, the status callback, CInternetException, and FTP directories, files, listings (CFtpFileFind), PutFile, GetFile, Rename and Remove, in passive and active mode. On Linux and macOS (Windows' WinINet has had no gopher since IE 7, and Wine's is a stub) a gopher server too: locators, menus, submenus and searches (CGopherFileFind), text, binary and gopher+ files, gopher+ attributes, and gopher URLs. And HTTPS againstopenssl s_serverwith a certificate of its own: the unknown authority and the wrong host refused, each let go with its security flag, through the API and through CHttpFile.isapitest:afxisapi.h, with an extension and a filter called through the functions an ISAPI DLL exports by a pretend server: CHtmlStream (growing, attached buffers), a parse map's commands (the default command, a base class's map, arguments by position and by name with defaults, numbers of each ITS_ type, posted form data read in parts, ITS_RAW data, parse errors), the reply's status and headers, server variables, and CHttpFilter notifications.htmltest:afxhtml.hwith a WebBrowser control of the test's own (Wine's needs Gecko to show a page), registered for CLSID_WebBrowser in the process. First the internet security manager that decides window.external: zones (on the port, which has no zone settings of its own: local files and res: are the local machine, a share or a dotless host the intranet, the rest the internet), what each zone allows, security ids, zone mappings, and a service provider's own manager asked first. For CHtmlView: the browser filling the view, Navigate, the Navigate2 forms and LoadFromResource with their arguments, the browser's events reaching the handlers (and a cancel going back), the properties, PutProperty and GetProperty, ExecWB, File Print, the forms commands, GetSource, the IDocHostUIHandler questions and the browser's keys. For CDHtmlDialog, over a page of fake elements: the page from the resources and its title, the DDX_DHtml functions both ways, the element and control functions, the DHTML event map by id, class and tag and the document's events, window.external only for a local page, and a new page. For CMultiPageDHtmlDialog: each page's embedded map from the URL map, by resource id or name, with the dialog's own map on every page, and an ActiveX control's events (DHTML_EVENT_AXCONTROL) with by-value and by-reference arguments. For HTML editing: CHtmlEditView's start page in design mode, the CHtmlEditCtrlBase commands with their arguments and values, the page's text both ways, the editing command map (enabling, checks, handlers), CHtmlEditDoc saving, a new document and opening a URL, and CHtmlEditCtrl.dlgtest: a dialog with data exchange and validation, common controls, and a property sheet; a Wizard97 wizard (CPropertySheetEx with a watermark and header bitmap, CPropertyPageEx with header titles); CPrintDialogEx's defaults; CDialogEx's background color and tiled bitmap, read back from the screen; and a CTaskDialog that drives itself from its timer (command links, radio buttons, the check box, the progress bar, a click refused by OnCommandControlClick).sditest: a single-document program with a toolbar, a status bar and an edit view; idle command updates, tooltips, saving and loading.mditest: a multiple-document program whose child frames are split into a form view and a scroll view; several documents, the Window menu commands, closing.docktest: toolbars docked side by side and on each edge, floating, dragged with the mouse, double-clicked, resized while floating, and the layout saved and loaded with SaveBarState and LoadBarState. With clang-retro's compiler its message map names handlers both ways.splittest: a dynamic splitter split by dragging its split boxes and with Window > Split from the keyboard, panes scrolling together on shared scroll bars, next and previous pane, and unsplitting by dragging a bar to the edge.richtest: a rich edit document and view; bold, italic and paragraph alignment on the selection, finding and replacing, saving and loading rich text and plain text, page layout for printing, word wrap, an object embedded in the text (selected, saved and loaded with it), and the Insert Object, Paste Special and Links dialogs.richsrvtest: CRichEditDoc as a server document, with its container in the same program: a new rich text object embedded, its text read back through the object's data, a copy saved and loaded again with its formatting, and a link to a saved file.dbtest:afxdb.hagainst an in-memory ODBC driver written in the test (tests/odbcmock.h), since Wine has no 32-bit ODBC driver to test with: opening, moving, filters, sorts and parameters, nulls, adding, editing and deleting records, stored procedures (a result set, a return value, output and input/output parameters), transactions, field info and errors, and a dynaset seeing another connection's changes and deletions where a snapshot does not, on the console.odbctest(Linux and macOS): the same classes and the wide ODBC functions against a real driver, SQLite 3 through unixODBC, with text outside ASCII going in and coming back: connecting, creating, inserting with parameters, reading wide text in pieces, a filtered and sorted recordset with a parameter, a transaction rolled back, and the driver's errors. Without the driver manager or the driver it notes that and passes, unlessMFC_TEST_ODBC=1;MFC_TEST_ODBC_DRIVERnames the driver's library where none is registered.rvtest: a CRecordView over the same driver; the form showing the current record, edits written back when moving, nulls shown as empty fields and indeterminate check boxes, and the record commands enabled at each end.oledbtest: the OLE DB consumer templates against an OLE DB provider written in the test: data sources opened by class ID and ProgID (and a password refused), tables and commands through column maps, accessor maps, parameter maps and the dynamic, string and manual accessors, rows changed, inserted and deleted, a transaction aborted and one committed, the provider's error records, and every object, row and accessor released at the end; then a COleDBRecordView moving through the rows and writing the form back. Windows only.daotest:afxdao.hagainst an in-memory DAO engine written in the test (tests/daomock.h, with the interfaces' stubs generated bytests/gen-daostubs.py), since Wine has no DAO: the engine made through its licence key, workspaces, creating a database with tables, fields and indexes and reading their info back, recordsets of each type (moves, positions, bookmarks, Find, Seek on an index, filters, sorts and Requery), DFX members and nulls, AddNew, Edit, Update, CancelUpdate and Delete, parameters of recordsets and querydefs, saved and temporary querydefs, transactions and CDaoException, on the console.dvtest: a CDaoRecordView over the same engine: the form showing the current record, edits written back when moving, nulls shown as empty fields and indeterminate check boxes, and the record commands enabled at each end (known from the start, through bookmarks).dragtest:afxole.hin a scroll view: data put on the clipboard and read back (cached, rendered when asked for, and as a file), a COleDropTarget fed enter, over, leave and drop by hand, scrolling near the edges, and a real DoDragDrop from the view onto itself.cdlgtest: the common dialogs, driven by their hooks: CFileDialog opening a file (its hook turning the first OK down), two files at once, and none, saving with the default extension, and a buffer too small for the answer; CColorDialog with a color typed in its fields; CFontDialog starting from a LOGFONT; and the modeless CFindReplaceDialog telling its owner about Find Next, Replace, Replace All and its closing.vistatest: the Vista pieces: a CSplitButton dropping down its menu (a resource menu, then the program's own) with the chosen command reaching the parent, the split style, size and glyph; a command link's note, the ideal size, text margin and image list; CNetAddressCtrl where shell32 (or the portable layer) has it; and the Vista-style CFileDialog driven by a timer: opening a file with a check box and edit box added (the first OK turned down), two files at once, saving with the default extension, cancelling, and CFolderPickerDialog. On XP the test checks the classic fallback instead.iotest: pipes and serial ports, on the console: CreatePipe and PeekNamedPipe (peeked data still read, a broken pipe each way), a child (the test itself) with pipes for its standard handles, polled and read, and BuildCommDCB; on Linux and macOS also a serial port (a pseudo-terminal named as COM9): its DCB and properties, time-outs that return at once, wait, or end when the line goes quiet, a command out and a reply in, and WaitCommEvent overlapped, ended by data, by SetCommMask and by CancelIo.audiotest: voice audio, on the console: ACM format details, enumeration and suggestion, and streams through mu-law, IMA ADPCM and a rate change; a WAVE file written and read through mmio, its buffer used directly, and a file in memory; periodic and one-shot timers; and, where there is a sound device, a mu-law tone played while recording (checked against what was recorded on the loopback device), positions, pause, reset, a loop, a recording stopped early, and PlaySound.oletest: an OLE container: objects of a class the test registers itself, embedded in a COleDocument, drawn by its view, opened and changed through their verbs and the verb menu, saved to flat and compound files and loaded again (Save As included), deleted, copied through the clipboard and cloned.srvtest: an OLE server and its container in one program, which COM starts again as the server: registration, an embedded object made, shown, changed, updated and closed through COleServerDoc and COleServerItem, the server's embedded menu and data, the object loaded again by a second server process, and its clipboard copy; natively also a server's object held directly, its advise connections enumerated and its moniker asked for across processes.linktest: links to a server's files and their items, bound as a container's link binds them: to an open document through the running object table, and to a closed file whose class the shell registration gives, which COM opens hidden and closes when the link lets go. It checks the item's moniker, data and notifications, the item container, the Link Source data Paste Link uses, links to an object embedded in a container's file, the object information the Object Properties and Change Source dialogs show, and COleMessageFilter's answers. Then the objects a container makes from a file: a link, which keeps its picture without the file open and is saved, loaded and bound again; a copy embedded from the file; a link from Link Source data; and a storage converted to the class the registry's AutoConvertTo names. And the OLE dialogs themselves, answered by their hooks: Server Busy, Convert, Change Icon, Change Source, Object Properties (its View page applying a new scale) and the progress of Update Links.iptest: in-place activation, with the container and the server in one program: the object activated in the container's view, the shared menu and its commands (each goes to the side whose popup it is on, through the menu descriptor), both sides' accelerators (IsAccelerator reading the container's), the server's toolbar in the container's frame, resizing through the resize bar, UI deactivation and full deactivation, and CRectTracker.docobtest: Active Documents, with the container and the server in one program: a COleDocObjectItem's document site makes the server's document a DocObject, which shows over the whole of the container's view; the test checks the view's rectangle, the shared menu with both Help popups, commands through IOleCommandTarget (standard ones and an OLE command map's own, with an update handler's text and check), the view state, printing through IPrint (the page count, page sets, a target printer and the continue callback), closing the view, and the DocObject registration.occtest: ActiveX control containment, with a control of the test's own: CWnd::CreateControl in a frame window (properties, methods, events and property notifications through event sink maps, ambient properties, frozen events, moving, enabling, focus and destroying), and a dialog template with controls among ordinary items (made on WM_INITDIALOG in the template's tab order, state from DLGINIT after its license key, DDX_Control and the DDX_OC functions).exttest: an extension DLL (exttest-dll), with the program and the DLL usingmfc.dll: the DLL's document and view in the program's document template, a command routed to the DLL's message map, the DLL's serializable class through FromName and CArchive, strings and a dialog template from the DLL's resources and the program's from the program, AfxGetApp in the DLL, exceptions from one module caught in the other, objects and memory freed in the other module, and a CStringArray grown in both. It runs only against the shared library, as docore,sditest,dlgtestanddlltesta second time (SHARED_TESTS; logs intests/saandtests/su).dlltest: MFC in a DLL: a control in a regular DLL (dlltest-dll, built like an.ocx) registered through DllRegisterServer, made by COM from the registry and hosted by the program (properties, methods and events across the two modules), the DLL's own instance, resources and CWinApp, a dialog from the DLL's template whose messages run in the DLL's state, and unloading through DllCanUnloadNow, with the DLL's ExitInstance and window classes. It runs with the static library and again withmfc.dll(_AFXDLLand_USRDLL), where AFX_MANAGE_STATE switches between the two modules' states.atltest: a COM server written with ATL (atltest-dll), an ATL 3 one (CComModule and an object map) in the ANSI build and an ATL 7 one (CAtlDllModuleT and OBJECT_ENTRY_AUTO) in the Unicode build: registration from an.rgsscript with replacements and from the old DECLARE_REGISTRY, CoCreateInstance through the class factories, calls through the vtable and through IDispatchImpl over a type library the test writes and registers, Error and ISupportErrorInfo (also through IDispatch, as an exception), events to a sink made with CComObject through the connection point (Advise, Unadvise, the enumerators), IProvideClassInfo2, a tear-off and a cached tear-off, aggregation, a singleton class factory, unloading through DllCanUnloadNow and unregistration; and the client's own CComObject, CComObjectStack and CComEnum.atlwintest: ATL's windows without MFC: a CWindowImpl frame with its own window class and traits, its message map (MESSAGE_, COMMAND_ and NOTIFY_ handlers, a range, bHandled set to FALSE, a chained map, GetCurrentMessage) and OnFinalMessage; a CContainedWindow edit control on an alternate map of its parent; a superclassed button whose notifications its parent reflects; SubclassWindow and UnsubclassWindow; CWindow's wrappers; CDialogImpl, modal and modeless, and CSimpleDialog.atlctltest: ATL's controls and their host, without MFC: a windowed control (CComControl) with stock and custom properties (CStockPropImpl), a property map saved to and loaded from a stream, a storage and a property bag, events through the connection point and IPropertyNotifySink, IViewObjectEx, IOleObject and IQuickActivate; a windowless one; a licensed one (CComClassFactory2); a composite control (CComCompositeControl) and a property page (IPropertyPageImpl). CAxWindow and AtlAxWin making and attaching controls by CLSID and ProgID; event sinks (IDispEventImpl over the type library, IDispEventSimpleImpl with _ATL_FUNC_INFO, a sink map advised with AtlAdviseSinkMap); and CAxDialogImpl over DIALOG and DIALOGEX templates that name controls by CLSID, their saved state (and a license key) from DLGINIT, as the dialog editor writes them.atlutiltest: ATL's utility headers in a program without MFC: CString fromatlstr.h(formatting, string resources, conversions, errors as CAtlException); CSimpleArray and CSimpleMap; CAtlArray, CAtlList, CAtlMap (rehashing as it grows), CRBMap and CRBMultiMap, and the arrays and lists of CAutoPtr and interface pointers; CHeapPtr, CComHeapPtr, CTempBuffer, CAutoPtr, CHandle; AtlThrow; CComSafeArray of numbers, BSTRs and VARIANTs, in one and two dimensions; CComDispatchDriver; CAtlFile, CAtlTemporaryFile and CAtlFileMapping; CTime, CTimeSpan, CFileTime and CFileTimeSpan without MFC; CImage (a 32-bit image with alpha through PNG and back and drawn with AlphaBlend, 24 bits through BMP, JPEG and a stream, an 8-bit image's color table, SetPixelIndexed and a transparent color, a device-dependent bitmap saved, and the file dialogs' filter strings); COleDateTime and COleDateTimeSpan; the synchronization objects ofatlsync.hacross a second thread; Base64, hex, UUEncode, quoted-printable, the B encoding, EscapeXML and UTF-8; MD5 and SHA-1 of a known string, and RC4 through a key derived from a hash; CSocketAddr; CAtlRegExp (groups, anchors, alternation, lazy repeats, negation, abbreviations and the parse errors); CUrl cracked and rebuilt, escaping, AtlCanonicalizeUrl and AtlCombineUrl; a CWorkerThread with an event and a timer, and a CThreadPool summing its requests; CPath; CSid and the well-known SIDs, CDacl, CSecurityDesc to SDDL and back, an event created through CSecurityAttributes and its DACL read and replaced, a file's owner and DACL, and the process's CAccessToken; and CAtlServiceModuleT, installed with /Service, started and stopped by the service control manager, and removed with /UnregServer.wtltest: WTL 10 over this ATL, on Windows and natively, built whentools/fetch-wtl.shhas fetched WTL's headers (skipped otherwise): a CFrameWindowImpl frame with CUpdateUI, a message filter and an idle handler, a command bar, a toolbar from a toolbar resource in a rebar, a status bar, and a splitter of a tree view and a list view; the message cracker maps (atlcrack.h); a dialog with DDX and CDialogResize; a dialog from CIndirectDialogImpl's in-memory template; a modeless property sheet; a CScrollWindowImpl view; and WTL's GDI and USER wrappers, CResource and CFindFile.ctltest: writing a control with COleControl, the test being both its server and its container: stock and custom properties, a method, stock and custom events, verbs from its message map (ON_OLEVERB, ON_STDOLEVERB), the font object, ambient properties, frozen events, activation and focus, the container's extended control (its extender properties, moving and hiding the control through it, and the control's own properties and methods), drawing in its window and through IViewObject, its state through IPersistStreamInit, IPersistPropertyBag and IPersistStorage into new instances, the registry keys of AfxOleRegisterControlClass, and the control's COlePropertyPage, through IPropertyPage (its size and title, DDP_ and DDX values from and to one or two controls, dirty controls, Apply) and in the property frame of the Properties verb or of COleControlSite::ShowPropertyFrame, which also shows the stock color page; IViewObjectEx hit testing, drawing clipped to the control's bounds or with the DC left as it is (the clipPaintDC and canOptimizeDraw flags), and IPointerInactive for a control with the pointerInactive flag; the stock color, font and picture pages setting the control's colors, font and picture; CPictureHolder (its kinds of picture, drawing one, PX_Picture); IPerPropertyBrowsing and IQuickActivate; and licensing, through IClassFactory2 with and without a license file (AfxVerifyLicFile) and a run-time key, also from CreateControl; and downloads of a local file through CMonikerFile, CAsyncMonikerFile and a CCachedDataPathProperty loaded from a property bag (PX_DataPath).cmntest: a CReBar with a toolbar, a combo box and a second row in its bands (the frame's layout as rows come and go, idle updates of the bands' controls), CReBarCtrl, CCheckListBox (item data, clicks on the box, the space bar, disabled items, three states), a CDragListBox drag, CLinkCtrl (in comctl32 6, from the test's manifest) and CPagerCtrl.wltest: windowless controls, with a COleControl of the test's own in a frame window: drawing in the container's window (checked by its pixels) and InvalidateControl, mouse messages with capture, focus and keys, the control's own GetDC, drag and drop through the drop target the container made for the frame (entering, leaving for the frame, coming back, the drop and its data), moving, hiding and destroying, and the same control made windowed when it does not ask for windowless activation.bindtest: data binding, with a data source control and bound controls of the test's own: properties bound to fields follow the current row (and null fields and no row), changes to the fields, and set the fields, and the other controls bound to them; a property given the data source; the data source control's rowset; unbinding; destroying the bound controls or the data source control first; a data source without a row position; bindings from a dialog template's DLGINIT records; an older data source control that makes an ICursor, with the same bindings; and ON_DSCNOTIFY, which hears of each step of a change and can refuse it.
The GUI tests drive themselves with timers, check what they see, and
save screenshots (PNG when ImageMagick is installed) next to their logs
in build/<triple>/tests/a and tests/u. CI runs them on every pull
request with the stock MinGW-w64 toolchain.