cwSvg.h/cpp : Minor updates to SVG test.

This commit is contained in:
kevin 2024-12-14 09:59:15 -05:00
parent 375ed8bed4
commit 4ef6d649f5
2 changed files with 42 additions and 23 deletions

View File

@ -5,10 +5,11 @@
#include "cwCommonImpl.h"
#include "cwMem.h"
#include "cwFile.h"
#include "cwSvg.h"
#include "cwText.h"
#include "cwTest.h"
#include "cwObject.h"
#include "cwNumericConvert.h"
#include "cwSvg.h"
namespace cw
{
@ -868,14 +869,29 @@ cw::rc_t cw::svg::write( handle_t h, const char* outFn, const char* cssFn, unsig
return rc;
}
cw::rc_t cw::svg::test( const char* outFn, const char* cssFn )
cw::rc_t cw::svg::test( const cw::object_t* cfg )
{
rc_t rc = kOkRC;
handle_t h;
if((rc = create(h)) != kOkRC )
cwLogError(rc,"SVG Test failed on create.");
const char* outFn = nullptr;
const char* cssFn = nullptr;
if((rc = cfg->getv("outHtmlFn",outFn,
"outCssFn",cssFn)) != kOkRC )
{
rc = cwLogError(rc,"SVG test parameter parsing failed.");
goto errLabel;
}
if((rc = create(h)) != kOkRC )
{
cwLogError(rc,"SVG Test failed on create.");
goto errLabel;
}
else
{
double yV[] = { 0, 10, 30, 60, 90 };
double xV[] = { 0, 40, 60, 40, 10 };
@ -900,9 +916,12 @@ cw::rc_t cw::svg::test( const char* outFn, const char* cssFn )
write(h,outFn, cssFn, kStandAloneFl, 10,10,10,10);
}
errLabel:
if((rc = destroy(h)) != kOkRC )
cwLogError(rc,"SVG destroy failed.");
rc = cwLogError(rc,"SVG destroy failed.");
return rc;

View File

@ -102,7 +102,7 @@ namespace cw
enum { kStandAloneFl=0x01, kPanZoomFl=0x02, kGenCssFileFl=0x04 };
rc_t write( handle_t h, const char* outFn, const char* cssFn, unsigned flags, double bordL=5, double bordT=5, double bordR=5, double bordB=5 );
rc_t test( const char* outFn, const char* cssFn );
rc_t test( const object_t* cfg );
}
}