Nilorea Library
C utilities for networking, threading, graphics
Loading...
Searching...
No Matches
ex_gui_slider_handle.c File Reference
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "nilorea/n_common.h"
#include "nilorea/n_gui.h"
#include "nilorea/n_log.h"
Include dependency graph for ex_gui_slider_handle.c:

Go to the source code of this file.

Macros

#define ALLEGRO_UNSTABLE   1

Functions

static void expect_near (const char *label, double got, double want)
 Assert two values are equal to within a tolerance.
static void expect_true (const char *label, int cond)
 Assert a condition, logging which check failed.
static void handle_stays_inside (N_GUI_CTX *gui, int id, float along, const char *what)
 Check that a slider's handle is drawn whole wherever its value is.
int main (void)
static ALLEGRO_EVENT mouse_event (int type, int x, int y)
 Build a mouse event at (x, y).

Variables

static int failures = 0
 Count of failed assertions.

Macro Definition Documentation

◆ ALLEGRO_UNSTABLE

#define ALLEGRO_UNSTABLE   1

Definition at line 41 of file ex_gui_slider_handle.c.

Function Documentation

◆ expect_near()

void expect_near ( const char * label,
double got,
double want )
static

Assert two values are equal to within a tolerance.

Parameters
labelWhat is being checked.
gotThe value under test.
wantThe expected value.
Examples
ex_gui_slider_handle.c, and ex_gui_slider_step.c.

Definition at line 75 of file ex_gui_slider_handle.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

Referenced by main().

Here is the caller graph for this function:

◆ expect_true()

void expect_true ( const char * label,
int cond )
static

Assert a condition, logging which check failed.

Parameters
labelWhat is being checked.
condNon-zero to pass.

Definition at line 60 of file ex_gui_slider_handle.c.

References failures, LOG_ERR, LOG_INFO, and n_log.

◆ handle_stays_inside()

void handle_stays_inside ( N_GUI_CTX * gui,
int id,
float along,
const char * what )
static

Check that a slider's handle is drawn whole wherever its value is.

Parameters
guiThe context.
idThe slider.
alongThe widget's length along its own axis.
whatA name for the log lines.
Examples
ex_gui_slider_handle.c.

Definition at line 108 of file ex_gui_slider_handle.c.

References expect_true(), failures, gui, LOG_ERR, n_gui_slider_handle_pos(), n_gui_slider_set_value(), and n_log.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

◆ mouse_event()

ALLEGRO_EVENT mouse_event ( int type,
int x,
int y )
static

Build a mouse event at (x, y).

Parameters
typeThe ALLEGRO_EVENT_MOUSE_* type.
xCursor x.
yCursor y.
Returns
The event.

Definition at line 91 of file ex_gui_slider_handle.c.

References type().

Here is the call graph for this function:

Variable Documentation

◆ failures

int failures = 0
static

Count of failed assertions.

Definition at line 53 of file ex_gui_slider_handle.c.