GrafX2 2.9.3227
The ultimate 256-color painting program
testformats.c File Reference

Unit tests for picture format loaders/savers. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../global.h"
#include "../fileformats.h"
#include "../gfx2log.h"
#include "../gfx2mem.h"
#include "tests.h"
+ Include dependency graph for testformats.c:

Macros

#define Load_ACBM   Load_IFF
 
#define Load_LBM   Load_IFF
 
#define Load_PBM   Load_IFF
 
#define Save_LBM   Save_IFF
 
#define Save_PBM   Save_IFF
 
#define FLAG_16C   1
 
#define FLAG_CPCO   2
 
#define FLAG_C64   4
 
#define TESTFMTF(fmt, sample, flags)   { FORMAT_ ## fmt, # fmt, Test_ ## fmt, Load_ ## fmt, Save_ ## fmt, flags, sample },
 
#define TESTFMT(fmt, sample)   TESTFMTF(fmt, sample, 0)
 
#define TESTFMTL(fmt, sample)   { FORMAT_ ## fmt, # fmt, Test_ ## fmt, Load_ ## fmt, NULL, 0, sample },
 

Functions

static void context_set_file_path (T_IO_Context *context, const char *filepath)
 Set the context File_directory and File_name. More...
 
int Test_Formats (char *errmsg)
 test the Test_* functions More...
 
int Test_Load (char *errmsg)
 test the Load_* functions More...
 
int Test_Save (char *errmsg)
 Test the Save_* functions. More...
 
int Test_C64_Formats (char *errmsg)
 

Variables

struct {
   enum FILE_FORMATS   format
 
   const char *   name
 
   Func_IO_Test   Test
 
   Func_IO   Load
 
   Func_IO   Save
 
   int   flags
 
   const char *   sample
 
formats []
 

Detailed Description

Unit tests for picture format loaders/savers.

Macro Definition Documentation

◆ Load_ACBM

#define Load_ACBM   Load_IFF

◆ Load_LBM

#define Load_LBM   Load_IFF

◆ Load_PBM

#define Load_PBM   Load_IFF

◆ Save_LBM

#define Save_LBM   Save_IFF

◆ Save_PBM

#define Save_PBM   Save_IFF

◆ FLAG_16C

#define FLAG_16C   1

◆ FLAG_CPCO

#define FLAG_CPCO   2

◆ FLAG_C64

#define FLAG_C64   4

◆ TESTFMTF

#define TESTFMTF (   fmt,
  sample,
  flags 
)    { FORMAT_ ## fmt, # fmt, Test_ ## fmt, Load_ ## fmt, Save_ ## fmt, flags, sample },

◆ TESTFMT

#define TESTFMT (   fmt,
  sample 
)    TESTFMTF(fmt, sample, 0)

◆ TESTFMTL

#define TESTFMTL (   fmt,
  sample 
)    { FORMAT_ ## fmt, # fmt, Test_ ## fmt, Load_ ## fmt, NULL, 0, sample },

Function Documentation

◆ context_set_file_path()

static void context_set_file_path ( T_IO_Context context,
const char *  filepath 
)
static

Set the context File_directory and File_name.

References T_IO_Context::File_directory, T_IO_Context::File_name, GFX2_malloc, and NULL.

Referenced by Test_C64_Formats(), Test_Formats(), Test_Load(), and Test_Save().

◆ Test_Formats()

◆ Test_Load()

◆ Test_Save()

◆ Test_C64_Formats()

Variable Documentation

◆ format

◆ name

◆ Test

◆ Load

Func_IO Load

Referenced by Button_Load_or_Save().

◆ Save

◆ flags

◆ sample

const char* sample

Referenced by Test_Formats(), and Test_Load().

◆ 

const struct { ... } formats[]