You will find a general example for the use of test here.
Functions to deal with CometTests
static String test::get_definition_file()
Get the path to the currently connected definition file.
Name | Type | Default | Description |
Return | String | Path to the currently connected definition file. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o values. |
static String test::get_default_definition_file()
Get the default path to the definition file.
Name | Type | Default | Description |
Return | String | Default path to the definition file. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o values. |
static int test::connect()
Connect to a definition file.
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
path | String oder char* | - | Path to definition file |
static int test::disconnect()
Disconnect from a definition file.
Name | Type | Default | Description |
Return | int | 0 |
static int test::execute(char* path)
Execute comet tests. Proof data has to be created for the selected tests before using this function. The path parameter is the path inside the test hierarchy. If the path points to a test domain, all child tests will be executed. Creates test results which can be deleted with test::delete_test_results.
The function has no meaning in InDesign® CS5.5.
Name | Type | Default | Description |
Return | int | Errorcode or 0 | |
path | String or char* | - | Path to test/test domain in the test hierarchy |
static int test::create_proofs(char* path)
Proof creation for comet tests. Any existing proof data will be overwritten. The path parameter is the path inside the test hierarchy. If the path points to a test domain, proof data for all child tests will be created.
The function has no meaning in InDesign® CS5.5.
Name | Type | Default | Description |
Return | int | Errorcode or 0 | |
path | String or char* | - | Path to test/test domain in the test hierarchy |
static int test::delete_proofs(char* path)
Proof deletion for comet tests. The path parameter is the path inside the test hierarchy. If the path points to a test domain, proof data for all child tests will be deleted.
The function has no meaning in InDesign® CS5.5.
Name | Type | Default | Description |
Return | int | Errorcode or 0 | |
path | String or char* | - | Path to test/test domain in the test hierarchy |
static int test::delete_test_results(char* path)
Deletion of test results for comet tests. The path parameter is the path inside the test hierarchy. If the path points to a test domain, test results for all child tests will be deleted.
The function has no meaning in InDesign® CS5.5.
Name | Type | Default | Description |
Return | int | Errorcode or 0 | |
path | String or char* | - | Path to test/test domain in the test hierarchy |
static int test::count()
Count all defined CometTests. Also doamins are counted here.
Name | Type | Default | Description |
Return | int | Number of all defined CometTest and CometTest domains 0 : No tests defined or error |
static int test::count_runnings(
int* current = 0,
int* count = 0,
int* ok = 0,
int* failed = 0)
Count all currently executing CometTests
Name | Type | Default | Description |
Return | int | 0 or ErrorCode | |
current | int* | 0 | Index of currently running test in current test queue |
count | int* | 0 | Number of tests in queue |
ok | int* | 0 | Number of tests succeeded |
failed | int* | 0 | Number of tests failed |
static int test::get_nth_ID(int nth)
ID of nth CometTest.
Name | Type | Default | Description |
Return | int | ID of nth CometTest 0 : Error |
|
nth | int | - | 0-based index of text |
static int test::get_nth_depth(int nth)
Depth in hierarchy of nth test.
Name | Type | Default | Description |
Return | int | Depth in hierarchy of nth test | |
nth | int | - | 0-based index of text |
static char* test::get_nth_name(int nth)
Name of nth test.
Name | Type | Default | Description |
Return | char* | Name of nth test. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static int test::get_nth_type(int nth)
Type of nth CometTest.
Name | Type | Default | Description |
Return | int | Type of nth CometTest 0 : Domain 1 : Test |
|
nth | int | - | 0-based index of text |
static char* test::get_nth_connectionInfo(int nth)
Error description of nth CometTest.
Name | Type | Default | Description |
Return | char* | Error description of nth CometTest. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static char* test::get_nth_file(int nth)
Test document (INDD) of nth CometTest.
Name | Type | Default | Description |
Return | char* | Test document (INDD) of nth CometTest. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static char* test::get_nth_preScriptPath(int nth)
Prescript of nth CometTest.
Name | Type | Default | Description |
Return | char* | Prescript of nth CometTest. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static char* test::get_nth_actionPath(int nth)
Script of nth CometTest.
Name | Type | Default | Description |
Return | char* | Script of nth CometTest. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static char* test::get_nth_postScriptPath(int nth)
Post-Script of nth CometTest.
Name | Type | Default | Description |
Return | char* | Post-Script of nth CometTest. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static int test::get_nth_simulateOverprint(int nth)
Overprint property of nth CometTest.
Name | Type | Default | Description |
Return | int | Overprint property of nth CometTest | |
nth | int | - | 0-based index of text |
static char* test::get_nth_errorDescription(int nth)
Error description of nth CometTest.
Name | Type | Default | Description |
Return | char* | Error description of nth CometTest. The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static char* test::get_nth_numberInQueue(int nth)
Index in queue as char*-string in the format "a/ALL", for instance "3/10".
Name | Type | Default | Description |
Return | char* | Name of nth test The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values. |
|
nth | int | - | 0-based index of text |
static char* test::get_nth_wasInQueue(int nth)
Is a CometTest currently in the queue?
Name | Type | Default | Description |
Return | int | Is the CometTest currently in the queue? 0 : No or error 1 : Yes |
|
nth | int | - | 0-based index of text |
static int test::assert(int successful, char* message)
Set the assertion error state of the currently running assert test.
Name | Type | Default | Description |
Return | int | ErrorCode or 0 | |
successful | int | 1 | Was the test successful? 0: 0 1: Yes |
message | String or char* | "" | When successful is 0, this message is displayed as the error message. |
Send an email report of all tests currently in use.
#include string'>"internal/types.h"
int main () { int err; char subject [8192]; char * body = alloc (1000000); char * tmp = alloc (1000000); char id [1000]; char errdescr [10000]; int current, count, ok, failed; int c = test::count (); int i, j, idv;
test::count_runnings (¤t, &count, &ok, &failed); if (count == 0) return; if (failed == 0) sprintf.html>sprintf (subject, string'>"CometTests Report : %d tests successfully done", count); else sprintf.html>sprintf (subject, string'>"CometTests Report : %d of %d tests FAILED", failed, count);
// InDesign® version strcpy (id, string'>"InDesign "); if (system.html#is_server>system::is_server ()) strcat.html>strcat (id, string'>"Server "); idv = system.html#is_version>system::version (); if (idv <= 8) sprintf.html>sprintf (tmp, string'>"CS %d", idv-2); else if (idv <= 11) sprintf.html>sprintf (tmp, string'>"CC %d", idv+2004); else sprintf.html>sprintf (tmp, string'>"CC %d", idv+2005); strcat.html>strcat (id, tmp);
// Init body text strcpy (body, string'>"<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" /><meta name=\"generator\" content=\"Adobe GoLive\" /><title>index</title><link href=\"css/basic.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" /></head><body style=\"font-size: 120%;\"><h2><font face=\"Arial\">COMETTEST REPORT</font></h2><table width=\"435\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">User</font></td><td style=\"font-size: 120%;\"><em><font face=\"Arial\">$USER</font></em></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">Date</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\">$DATE</font></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">InDesign</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\">$INDESIGN</font></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">Comet</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\"><strong>v$COMET R$REVISION</strong></font></td></tr><tr><td style=\"font-size: 120%;\" width=\"140\"><font color=\"#aaaaaa\" face=\"Arial\">No. of Tests</font></td><td style=\"font-size: 120%;\"><font face=\"Arial\">$COUNT</font></td></tr></table><p style=\"font-size: 120%;\"><font color=\"#0077bb\" face=\"Arial\">$OKAY</font><font color=\"#ff4488\" face=\"Arial\"><b>$FAILED</b></font></p><p><font face=\"Arial\">$DESCR</font></p><p style=\"font-size: 80%;\">This mail was automatically created by the priint:comet test suite using system::send_mail.</p></body></html>");
// Finish header table strreplace.html>strreplace (body, string'>"$USER", system.html#login>system::login (tmp)); strreplace.html>strreplace (body, string'>"$DATE", system.html#now>system::now (tmp)); strreplace.html>strreplace (body, string'>"$INDESIGN",id); strreplace.html>strreplace (body, string'>"$COMET", system.html#comet_version>system::comet_version (tmp)); strreplace.html>strreplace (body, string'>"$REVISION",system.html#revision>system::revision ()); strreplace.html>strreplace (body, string'>"$COUNT", itoa.html>itoa (count));
strcpy (tmp, string'>""); for (i = 0; i < c-1; i++) { if (test::get_nth_wasInQueue (i)) { if (strlen (test::get_nth_errorDescription (i)) == 0) strcat.html>strcat (tmp, string'>"<font color=\"#0077bb\" face=\"Arial\"> "); else strcat.html>strcat (tmp, string'>"<font color=\"#ff4488\" face=\"Arial\"> "); strcat.html>strcat (tmp, test::get_nth_name (i)); strcat.html>strcat (tmp, string'>"</font><br/>"); } } strcat.html>strcat (tmp, string'>"<br/></p><p>");
// Write result if (failed == 0) { strreplace.html>strreplace (body, string'>"$OKAY", "EVERYTHING IS OKAY!"); strreplace.html>strreplace (body, string'>"$DESCR", tmp); } else { if (failed == 1) sprintf.html>sprintf (id, string'>"\n%d TEST FAILED!<br/>", failed); else sprintf.html>sprintf (id, string'>"\n%d TESTS FAILED!<br/>", failed); strreplace.html>strreplace (body,string'>"$FAILED", id); for (i = 0; i < c; i++) { strcpy (errdescr, test::get_nth_errorDescription (i)); if (strlen (errdescr)) { strreplace.html>strreplace (errdescr, string'>"ERRORS\n", string'>"", 0); strreplace.html>strreplace (errdescr, string'>"- ", string'>"<li/>", 1); strcat.html>strcat (tmp, string'>"<b>"); strcat.html>strcat (tmp, test::get_nth_name (i)); strcat.html>strcat (tmp, string'>"</b> : <i><ul>"); strcat.html>strcat (tmp, errdescr); strcat.html>strcat (tmp, string'>"</ul></i><br/><br/>"); } } strreplace.html>strreplace (body, string'>"$DESCR", tmp); }
system.html#send_mail>system::send_mail ( string'>"you@your.email.com", subject, kMailAccount, string'>"your name" // applied on Windows only kBody, body);
return 0; }
Alphabetic index HTML hierarchy of classes or Java