OpenTTD Source: src/tests/test_window_desc.cpp File Reference

OpenTTD Source 14.0-beta3

Data Structures | Functions | Variables
test_window_desc.cpp File Reference
`#include "../stdafx.h"`
`#include "../3rdparty/catch2/catch.hpp"`
`#include "mock_environment.h"`
`#include "../window_gui.h"`

Go to the source code of this file.

## Data Structures
class | WindowDescTestsFixture

## Functions
| TEST_CASE ("WindowDesc - ini_key uniqueness")
| TEST_CASE ("WindowDesc - ini_key validity")
static bool | IsNWidgetTreeClosed (const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end)
| Test if a NWidgetTree is properly closed, meaning the number of container-type parts matches the number of EndContainer() parts. More...
| TEST_CASE ("WindowDesc - NWidgetParts properly closed")
| TEST_CASE_METHOD (WindowDescTestsFixture, "WindowDesc - NWidgetPart validity")

## Variables
std::vector< WindowDesc * > * | _window_descs
| List of WindowDescs. More...

## Detailed Description

Test WindowDescs for valid widget parts.

Definition in file test_window_desc.cpp.

## Function Documentation

## ◆ IsNWidgetTreeClosed()

static bool IsNWidgetTreeClosed | ( | const NWidgetPart * | nwid_begin,
|  | const NWidgetPart * | nwid_end
| ) |  |
| static

Test if a NWidgetTree is properly closed, meaning the number of container-type parts matches the number of EndContainer() parts.

Parameters

  nwid_begin | Pointer to beginning of nested widget parts.
  nwid_end | Pointer to ending of nested widget parts.

Returns
  True iff nested tree is properly closed.

Definition at line 67 of file test_window_desc.cpp.

References IsContainerWidgetType(), NWidgetPart::type, and WPT_ENDCONTAINER.

## Variable Documentation

## ◆ _window_descs

std::vector<WindowDesc*>* _window_descs

List of WindowDescs.

Defined in window.cpp but not exposed as this unit-test is the only other place that needs it. WindowDesc is a self-registering class so all WindowDescs will be included in the list.

List of WindowDescs.

This is a pointer to ensure initialisation order with the various static WindowDesc instances.

Definition at line 99 of file window.cpp.

Referenced by WindowDesc::LoadFromConfig(), WindowDesc::SaveToConfig(), and WindowDesc::WindowDesc().