UEFIStarter
a simple UEFI framework
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Structures | Macros | Functions
graphics.h File Reference

Assertions and utilities for graphics tests. More...

#include <Uefi.h>
#include <UEFIStarter/graphics.h>

Go to the source code of this file.

Data Structures

struct  bounding_box_t
 data type for bounding boxes More...
 
struct  graphics_difftest_t
 data type for image change tests More...
 

Macros

#define BYTES_PER_PIXEL   sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
 shortcut macro for pixel's size in bytes
 
#define DIFFTEST_DEFAULT_BACKGROUND_UINT32   0x11223344
 default background color for color tests
 

Functions

void init_graphics_difftest_ex (graphics_difftest_t *difftest, INTN width, INTN height, UINT32 bgcol)
 Initializes a graphics difference test. More...
 
void init_graphics_difftest (graphics_difftest_t *difftest, INTN width, INTN height)
 Initializes a default graphics difference test. More...
 
void find_bounding_box_for_changes (graphics_difftest_t *difftest)
 Compares "before" and "after" images of a difference test and determines the bounding box changes happened in. More...
 
void assert_box_equals (bounding_box_t *box, INTN left, INTN top, INTN right, INTN bottom, CHAR16 *message)
 Asserts a bounding box matches expected values. More...
 
void assert_differences_within_box (graphics_difftest_t *difftest, INTN min_width, INTN max_width, INTN min_height, INTN max_height, CHAR16 *message)
 Asserts the bounding box of changes is within given ranges of width and height. More...
 
void reset_bounding_box (bounding_box_t *box)
 Initializes a bounding box. More...
 
void reset_graphics_difftest (graphics_difftest_t *difftest)
 Resets a graphics difference test. More...
 
void destroy_graphics_difftest (graphics_difftest_t *difftest)
 Destroys a graphics difference test structure. More...
 

Detailed Description

Assertions and utilities for graphics tests.

Author
Richard Nusser
License
GPLv3 (see http://www.gnu.org/licenses/)
See also
https://github.com/rinusser/UEFIStarter

Function Documentation

◆ init_graphics_difftest_ex()

void init_graphics_difftest_ex ( graphics_difftest_t difftest,
INTN  width,
INTN  height,
UINT32  bgcol 
)

Initializes a graphics difference test.

Parameters
difftestthe difference test to reset
widththe compared images' width
heightthe compared images' height
bgcolthe background color to paint "before" and "after" images with

◆ init_graphics_difftest()

void init_graphics_difftest ( graphics_difftest_t difftest,
INTN  width,
INTN  height 
)

Initializes a default graphics difference test.

Parameters
difftestthe difference test to reset
widththe compared images' width
heightthe compared images' height

◆ find_bounding_box_for_changes()

void find_bounding_box_for_changes ( graphics_difftest_t difftest)

Compares "before" and "after" images of a difference test and determines the bounding box changes happened in.

Parameters
difftestthe difference test to update

◆ assert_box_equals()

void assert_box_equals ( bounding_box_t box,
INTN  left,
INTN  top,
INTN  right,
INTN  bottom,
CHAR16 *  message 
)

Asserts a bounding box matches expected values.

Parameters
boxthe actual bounding box
leftthe expected left coordinate
topthe expected top coordinate
rightthe expected right coordinate
bottomthe expected bottom coordinate
messagea descriptive message of what's being tested

◆ assert_differences_within_box()

void assert_differences_within_box ( graphics_difftest_t difftest,
INTN  min_width,
INTN  max_width,
INTN  min_height,
INTN  max_height,
CHAR16 *  message 
)

Asserts the bounding box of changes is within given ranges of width and height.

Parameters
difftestthe difference test to check
min_widththe smallest allowed bounding box width
max_widththe largest allowed bounding box width
min_heightthe smallest allowed bounding box height
max_heightthe largest allowed bounding box height
messagea descriptive message of what's being tested

◆ reset_bounding_box()

void reset_bounding_box ( bounding_box_t box)

Initializes a bounding box.

Parameters
boxthe bounding box to reset

◆ reset_graphics_difftest()

void reset_graphics_difftest ( graphics_difftest_t difftest)

Resets a graphics difference test.

Initializes the expected bounding box and resets the "after" image.

Parameters
difftestthe difference test to reset

◆ destroy_graphics_difftest()

void destroy_graphics_difftest ( graphics_difftest_t difftest)

Destroys a graphics difference test structure.

Parameters
difftestthe difference test to destroy