marco 1.29.1
Window manager
Loading...
Searching...
No Matches
testboxes.c File Reference
View source
#include "boxes.h"
#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xutil.h>
#include <time.h>
#include <math.h>
Include dependency graph for testboxes.c:

Macros

#define NUM_RANDOM_RUNS   10000
 
#define EPSILON   0.000000001
 

Functions

static void init_random_ness (void)
 
static void get_random_rect (MetaRectangle *rect)
 
static MetaRectangle * new_meta_rect (int x, int y, int width, int height)
 
static MetaStrut * new_meta_strut (int x, int y, int width, int height, int side)
 
static MetaEdge * new_screen_edge (int x, int y, int width, int height, int side_type)
 
static MetaEdge * new_xinerama_edge (int x, int y, int width, int height, int side_type)
 
static void test_area (void)
 
static void test_intersect (void)
 
static void test_equal (void)
 
static void test_overlap_funcs (void)
 
static void test_basic_fitting (void)
 
static void free_strut_list (GSList *struts)
 
static GSList * get_strut_list (int which)
 
static GList * get_screen_region (int which)
 
static GList * get_screen_edges (int which)
 
static GList * get_xinerama_edges (int which_xinerama_set, int which_strut_set)
 
static void verify_lists_are_equal (GList *code, GList *answer)
 
static void test_regions_okay (void)
 
static void test_region_fitting (void)
 
static void test_clamping_to_region (void)
 
static gboolean rect_overlaps_region (const GList *spanning_rects, const MetaRectangle *rect)
 
static void test_clipping_to_region (void)
 
static void test_shoving_into_region (void)
 
static void verify_edge_lists_are_equal (GList *code, GList *answer)
 
static void test_find_onscreen_edges (void)
 
static void test_find_nonintersected_xinerama_edges (void)
 
static void test_gravity_resize (void)
 
static void test_find_closest_point_to_line (void)
 
int main (void)
 

Variables

gboolean time_to_print = FALSE
 

Macro Definition Documentation

◆ EPSILON

#define EPSILON   0.000000001

◆ NUM_RANDOM_RUNS

#define NUM_RANDOM_RUNS   10000

Function Documentation

◆ free_strut_list()

static void free_strut_list ( GSList *  struts)
static

◆ get_random_rect()

◆ get_screen_edges()

static GList * get_screen_edges ( int  which)
static

References free_strut_list(), get_strut_list(), meta_rect(), meta_rectangle_find_onscreen_edges(), and NULL.

Referenced by test_find_onscreen_edges().

Here is the call graph for this function:

◆ get_screen_region()

static GList * get_screen_region ( int  which)
static

References FALSE, free_strut_list(), get_strut_list(), meta_rect(), meta_rectangle_get_minimal_spanning_set_for_region(), and NULL.

Referenced by test_clamping_to_region(), test_clipping_to_region(), test_region_fitting(), test_regions_okay(), and test_shoving_into_region().

Here is the call graph for this function:

◆ get_strut_list()

static GSList * get_strut_list ( int  which)
static

References new_meta_strut(), and NULL.

Referenced by get_screen_edges(), get_screen_region(), and get_xinerama_edges().

Here is the call graph for this function:

◆ get_xinerama_edges()

static GList * get_xinerama_edges ( int  which_xinerama_set,
int  which_strut_set 
)
static

References free_strut_list(), get_strut_list(), _MetaRectangle::height, meta_rectangle_find_nonintersected_xinerama_edges(), new_meta_rect(), NULL, _MetaRectangle::width, _MetaRectangle::x, and _MetaRectangle::y.

Referenced by test_find_nonintersected_xinerama_edges().

Here is the call graph for this function:

◆ init_random_ness()

static void init_random_ness ( void  )
static

References NULL.

Referenced by main().

◆ main()

◆ new_meta_rect()

static MetaRectangle * new_meta_rect ( int  x,
int  y,
int  width,
int  height 
)
static

◆ new_meta_strut()

static MetaStrut * new_meta_strut ( int  x,
int  y,
int  width,
int  height,
int  side 
)
static

References _MetaStrut::edge, META_EDGE_SCREEN, meta_rect(), _MetaStrut::rect, and _MetaStrut::side.

Referenced by get_strut_list().

Here is the call graph for this function:

◆ new_screen_edge()

static MetaEdge * new_screen_edge ( int  x,
int  y,
int  width,
int  height,
int  side_type 
)
static

◆ new_xinerama_edge()

static MetaEdge * new_xinerama_edge ( int  x,
int  y,
int  width,
int  height,
int  side_type 
)
static

◆ rect_overlaps_region()

static gboolean rect_overlaps_region ( const GList *  spanning_rects,
const MetaRectangle *  rect 
)
static

References FALSE, meta_rectangle_overlap(), and NULL.

Referenced by test_clipping_to_region().

Here is the call graph for this function:

◆ test_area()

static void test_area ( void  )
static

References get_random_rect(), _MetaRectangle::height, meta_rect(), meta_rectangle_area(), NUM_RANDOM_RUNS, and _MetaRectangle::width.

Referenced by main().

Here is the call graph for this function:

◆ test_basic_fitting()

static void test_basic_fitting ( void  )
static

References get_random_rect(), meta_rect(), meta_rectangle_contains_rect(), meta_rectangle_could_fit_rect(), and NUM_RANDOM_RUNS.

Referenced by main().

Here is the call graph for this function:

◆ test_clamping_to_region()

static void test_clamping_to_region ( void  )
static

References FIXED_DIRECTION_X, FIXED_DIRECTION_Y, get_random_rect(), get_screen_region(), _MetaRectangle::height, meta_rect(), meta_rectangle_clamp_to_fit_into_region(), meta_rectangle_could_fit_in_region(), NUM_RANDOM_RUNS, _MetaRectangle::width, _MetaRectangle::x, and _MetaRectangle::y.

Referenced by main().

Here is the call graph for this function:

◆ test_clipping_to_region()

static void test_clipping_to_region ( void  )
static

References FIXED_DIRECTION_X, get_random_rect(), get_screen_region(), meta_rect(), meta_rectangle_clip_to_region(), meta_rectangle_contained_in_region(), meta_rectangle_equal(), NUM_RANDOM_RUNS, and rect_overlaps_region().

Referenced by main().

Here is the call graph for this function:

◆ test_equal()

static void test_equal ( void  )
static

References meta_rectangle_equal().

Referenced by main().

Here is the call graph for this function:

◆ test_find_closest_point_to_line()

static void test_find_closest_point_to_line ( void  )
static

References EPSILON, and meta_rectangle_find_linepoint_closest_to_point().

Referenced by main().

Here is the call graph for this function:

◆ test_find_nonintersected_xinerama_edges()

static void test_find_nonintersected_xinerama_edges ( void  )
static

References EDGE_LENGTH, get_xinerama_edges(), META_DIRECTION_BOTTOM, META_DIRECTION_LEFT, META_DIRECTION_RIGHT, META_DIRECTION_TOP, meta_rectangle_edge_list_to_string(), new_xinerama_edge(), NULL, and verify_edge_lists_are_equal().

Referenced by main().

Here is the call graph for this function:

◆ test_find_onscreen_edges()

static void test_find_onscreen_edges ( void  )
static

References EDGE_LENGTH, get_screen_edges(), META_DIRECTION_BOTTOM, META_DIRECTION_LEFT, META_DIRECTION_RIGHT, META_DIRECTION_TOP, meta_rectangle_edge_list_to_string(), new_screen_edge(), NULL, and verify_edge_lists_are_equal().

Referenced by main().

Here is the call graph for this function:

◆ test_gravity_resize()

static void test_gravity_resize ( void  )
static

References meta_rect(), meta_rectangle_equal(), meta_rectangle_resize_with_gravity(), and _MetaRectangle::x.

Referenced by main().

Here is the call graph for this function:

◆ test_intersect()

static void test_intersect ( void  )
static

References meta_rect(), meta_rectangle_area(), meta_rectangle_equal(), and meta_rectangle_intersect().

Referenced by main().

Here is the call graph for this function:

◆ test_overlap_funcs()

static void test_overlap_funcs ( void  )
static

References get_random_rect(), meta_rect(), meta_rectangle_horiz_overlap(), meta_rectangle_overlap(), meta_rectangle_vert_overlap(), and NUM_RANDOM_RUNS.

Referenced by main().

Here is the call graph for this function:

◆ test_region_fitting()

static void test_region_fitting ( void  )
static

References get_random_rect(), get_screen_region(), meta_rect(), meta_rectangle_contained_in_region(), meta_rectangle_could_fit_in_region(), and NUM_RANDOM_RUNS.

Referenced by main().

Here is the call graph for this function:

◆ test_regions_okay()

static void test_regions_okay ( void  )
static

References get_screen_region(), meta_rectangle_region_to_string(), new_meta_rect(), NULL, RECT_LENGTH, and verify_lists_are_equal().

Referenced by main().

Here is the call graph for this function:

◆ test_shoving_into_region()

static void test_shoving_into_region ( void  )
static

References FIXED_DIRECTION_X, FIXED_DIRECTION_Y, get_random_rect(), get_screen_region(), meta_rect(), meta_rectangle_contained_in_region(), meta_rectangle_could_fit_in_region(), meta_rectangle_equal(), meta_rectangle_shove_into_region(), and NUM_RANDOM_RUNS.

Referenced by main().

Here is the call graph for this function:

◆ verify_edge_lists_are_equal()

static void verify_edge_lists_are_equal ( GList *  code,
GList *  answer 
)
static

References _MetaEdge::edge_type, _MetaRectangle::height, meta_rectangle_equal(), _MetaEdge::rect, _MetaEdge::side_type, _MetaRectangle::width, _MetaRectangle::x, and _MetaRectangle::y.

Referenced by test_find_nonintersected_xinerama_edges(), and test_find_onscreen_edges().

Here is the call graph for this function:

◆ verify_lists_are_equal()

static void verify_lists_are_equal ( GList *  code,
GList *  answer 
)
static

Variable Documentation

◆ time_to_print

gboolean time_to_print = FALSE