UEFIStarter
a simple UEFI framework
Functions
graphics.c File Reference

Assertions and utilities for graphics tests. More...

#include <Library/BaseMemoryLib.h>
#include <UEFIStarter/core/string.h>
#include <UEFIStarter/tests/graphics.h>
#include <UEFIStarter/tests/asserts.h>

Functions

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 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 destroy_graphics_difftest (graphics_difftest_t *difftest)
 Destroys a graphics difference test structure. 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...
 

Detailed Description

Assertions and utilities for graphics tests.

Some of the graphics tests work by looking for changes between two images, then asserting whether those changes are within a given rectangular region, the bounding box.

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

Function Documentation

◆ 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

◆ 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

◆ destroy_graphics_difftest()

void destroy_graphics_difftest ( graphics_difftest_t difftest)

Destroys a graphics difference test structure.

Parameters
difftestthe difference test to destroy

◆ 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