diff --git a/bindings/php/opencreport.c b/bindings/php/opencreport.c index 5818626c..30959a62 100644 --- a/bindings/php/opencreport.c +++ b/bindings/php/opencreport.c @@ -5239,6 +5239,18 @@ PHP_METHOD(opencreport_barcode, set_value_delayed) { ocrpt_barcode_set_value_delayed(bco->bc, expr_string ? ZSTR_VAL(expr_string) : NULL); } +PHP_METHOD(opencreport_barcode, set_suppress) { + zval *object = ZEND_THIS; + php_opencreport_barcode_object *bco = Z_OPENCREPORT_BARCODE_P(object); + zend_string *expr_string = NULL; + + ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + Z_PARAM_STR_EX(expr_string, 1, 0); + ZEND_PARSE_PARAMETERS_END(); + + ocrpt_barcode_set_suppress(bco->bc, expr_string ? ZSTR_VAL(expr_string) : NULL); +} + PHP_METHOD(opencreport_barcode, set_type) { zval *object = ZEND_THIS; php_opencreport_barcode_object *bco = Z_OPENCREPORT_BARCODE_P(object); @@ -5307,6 +5319,10 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opencreport_barcode_set_value_de ZEND_ARG_TYPE_INFO(0, expr_string, IS_STRING, 1) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opencreport_barcode_set_suppress, 0, 1, IS_VOID, 0) +ZEND_ARG_TYPE_INFO(0, expr_string, IS_STRING, 1) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_opencreport_barcode_set_type, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, expr_string, IS_STRING, 1) ZEND_END_ARG_INFO() @@ -5330,6 +5346,7 @@ ZEND_END_ARG_INFO() static const zend_function_entry opencreport_barcode_class_methods[] = { PHP_ME(opencreport_barcode, set_value, arginfo_opencreport_barcode_set_value, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) PHP_ME(opencreport_barcode, set_value_delayed, arginfo_opencreport_barcode_set_value_delayed, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) + PHP_ME(opencreport_barcode, set_suppress, arginfo_opencreport_barcode_set_suppress, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) PHP_ME(opencreport_barcode, set_type, arginfo_opencreport_barcode_set_type, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) PHP_ME(opencreport_barcode, set_width, arginfo_opencreport_barcode_set_width, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) PHP_ME(opencreport_barcode, set_height, arginfo_opencreport_barcode_set_height, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) diff --git a/doc/c-api-reference.sgm b/doc/c-api-reference.sgm index 1e4b78c2..b8c3e693 100644 --- a/doc/c-api-reference.sgm +++ b/doc/c-api-reference.sgm @@ -2733,6 +2733,21 @@ ocrpt_barcode_set_value_delayed(ocrpt_barcode *bc, const char *expr_string); + + Set barcode suppression + + Set the barcode's suppression value from + an expression string. The expression + must evaluate to a boolean value. + void +ocrpt_barcode_set_suppress(ocrpt_barcode *bc, + const char *expr_string); + + + Default value is false, + i.e. no suppression. + + Set barcode type diff --git a/doc/php-api-reference.sgm b/doc/php-api-reference.sgm index ccbf94cb..f0f68bca 100644 --- a/doc/php-api-reference.sgm +++ b/doc/php-api-reference.sgm @@ -3672,6 +3672,21 @@ OpenCReport\Barcode::set_value_delayed( ?string $expr_string = null): void; + + Set the barcode suppression + + Set the barcode's suppression value from + an expression string. The expression + must evaluate to a boolean value. + public final +OpenCReport\Barcode::set_suppress( + ?string $expr_string = null): void; + + + Default value is false, + i.e. no suppression. + + Set the barcode type diff --git a/doc/xmldescription.sgm b/doc/xmldescription.sgm index 2a8a9513..df70cf28 100644 --- a/doc/xmldescription.sgm +++ b/doc/xmldescription.sgm @@ -3698,6 +3698,28 @@ report_height_after_last="no" Barcode element attributes + + Suppress + + <Barcode> elements + in <Output> may be + suppressed. + <Line> + <Barcode suppress="yes" ... /> +</Line> + + + Default value is false, + i.e. no suppression. + + + The expression for suppress + must be a constant expression. An environment + variable (since it can't - or shouldn't - change + during the report execution) is considered + constant. See . + + Value diff --git a/include/opencreport.h b/include/opencreport.h index 301e52d3..526f3297 100644 --- a/include/opencreport.h +++ b/include/opencreport.h @@ -966,6 +966,7 @@ ocrpt_barcode *ocrpt_line_add_barcode(ocrpt_line *line); void ocrpt_barcode_set_value(ocrpt_barcode *bc, const char *expr_string); void ocrpt_barcode_set_value_delayed(ocrpt_barcode *bc, const char *expr_string); +void ocrpt_barcode_set_suppress(ocrpt_barcode *bc, const char *expr_string); void ocrpt_barcode_set_type(ocrpt_barcode *bc, const char *expr_string); void ocrpt_barcode_set_width(ocrpt_barcode *bc, const char *expr_string); void ocrpt_barcode_set_height(ocrpt_barcode *bc, const char *expr_string); diff --git a/libsrc/common-output.c b/libsrc/common-output.c index 01df886e..02f40617 100644 --- a/libsrc/common-output.c +++ b/libsrc/common-output.c @@ -268,7 +268,16 @@ void ocrpt_common_get_text_sizes(opencreport *o, ocrpt_part *p, ocrpt_part_row * w *= l->font_width; } else if (ocrpt_list_length(l->elements) == 1) { w = total_width; - w -= output->current_image_width; + + double diff; + if (output->current_image) + diff = output->current_image->image_width; + else if (output->current_barcode) + diff = output->current_barcode->barcode_width; + else + diff = 0.0; + + w -= diff; } else { PangoRectangle logical_rect; @@ -279,7 +288,15 @@ void ocrpt_common_get_text_sizes(opencreport *o, ocrpt_part *p, ocrpt_part_row * if (last && w < total_width - le->start) w = total_width - le->start; - w -= output->current_image_width; + double diff; + if (output->current_image) + diff = output->current_image->image_width; + else if (output->current_barcode) + diff = output->current_barcode->barcode_width; + else + diff = 0.0; + + w -= diff; } le->width_computed = w; diff --git a/libsrc/html-output.c b/libsrc/html-output.c index 63389ce9..abb54bfb 100644 --- a/libsrc/html-output.c +++ b/libsrc/html-output.c @@ -84,7 +84,16 @@ static void ocrpt_html_start_data_row(opencreport *o, ocrpt_part *p, ocrpt_part_ } static void ocrpt_html_end_data_row(opencreport *o, ocrpt_part *p, ocrpt_part_row *pr, ocrpt_part_column *pd, ocrpt_report *r, ocrpt_break *br, ocrpt_output *output, ocrpt_line *l) { + html_private_data *priv = o->output_private; + ocrpt_mem_string_append(o->output_buffer, "

\n"); + + /* + * Cheat a little in accounting for line heights. + * Lines (despite everything is in "pt") have gaps between them. + * Add two pt for every line finished. + */ + priv->curr_pos_from_last_image += l->line_height + 2.0; } static void ocrpt_html_add_new_page_epilogue(opencreport *o) { @@ -179,9 +188,16 @@ static void ocrpt_html_draw_text(opencreport *o, ocrpt_part *p, ocrpt_part_row * if (pd && (le->start > pd->real_width)) return; + ocrpt_mem_string_append_printf(o->output_buffer, "line_height); + + if (l->elements->data == le && priv->image_indent > 0.0 && priv->curr_pos_from_last_image >= priv->image_height) + ocrpt_mem_string_append_printf(o->output_buffer, + "margin-left: %.2lfpt; ", + priv->image_indent); + if (le->width) { bool text_fits = (pd && (le->start + le->width_computed < pd->column_width)) || !pd; ocrpt_mem_string_append_printf(o->output_buffer, @@ -326,6 +342,8 @@ static void ocrpt_html_draw_image(opencreport *o, ocrpt_part *p, ocrpt_part_row ocrpt_html_truncate_file_prefix(priv, img->img_file->name), w, h); priv->image_indent = w; + priv->image_height = h; + priv->curr_pos_from_last_image = 0.0; } } @@ -394,21 +412,18 @@ static void ocrpt_html_draw_barcode(opencreport *o, ocrpt_part *p, ocrpt_part_ro cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, bc->encoded_width - first_space + 20.0, bc->barcode_height); cairo_t *cr = cairo_create(surface); - ocrpt_color bg, fg; + ocrpt_color bg = { 1.0, 1.0, 1.0 }; + ocrpt_color fg = { 0.0, 0.0, 0.0 }; - char *color_name = NULL; if (bc->color && bc->color->result[o->residx] && bc->color->result[o->residx]->type == OCRPT_RESULT_STRING && bc->color->result[o->residx]->string) - color_name = bc->color->result[o->residx]->string->str; + ocrpt_get_color(bc->color->result[o->residx]->string->str, &fg, false); + else if (line && line->color && line->color->result[o->residx] && line->color->result[o->residx]->type == OCRPT_RESULT_STRING && line->color->result[o->residx]->string) + ocrpt_get_color(line->color->result[o->residx]->string->str, &fg, false); - ocrpt_get_color(color_name, &fg, false); - - if (bc->encoded_width > 0) { - color_name = NULL; - if (bc->bgcolor && bc->bgcolor->result[o->residx] && bc->bgcolor->result[o->residx]->type == OCRPT_RESULT_STRING && bc->bgcolor->result[o->residx]->string) - color_name = bc->bgcolor->result[o->residx]->string->str; - - ocrpt_get_color(color_name, &bg, true); - } + if (bc->bgcolor && bc->bgcolor->result[o->residx] && bc->bgcolor->result[o->residx]->type == OCRPT_RESULT_STRING && bc->bgcolor->result[o->residx]->string) + ocrpt_get_color(bc->bgcolor->result[o->residx]->string->str, &bg, true); + else if (line && line->bgcolor && line->bgcolor->result[o->residx] && line->bgcolor->result[o->residx]->type == OCRPT_RESULT_STRING && line->bgcolor->result[o->residx]->string) + ocrpt_get_color(line->bgcolor->result[o->residx]->string->str, &bg, false); cairo_save(cr); @@ -478,10 +493,12 @@ static void ocrpt_html_draw_barcode(opencreport *o, ocrpt_part *p, ocrpt_part_ro "
\n", pd->real_width); ocrpt_mem_string_append_printf(o->output_buffer, - "\"background\n", + "\"background\n", priv->pngbase64->str, w, h); priv->image_indent = w; + priv->image_height = h; + priv->curr_pos_from_last_image = 0.0; } } diff --git a/libsrc/html-output.h b/libsrc/html-output.h index 7a638c96..148face1 100644 --- a/libsrc/html-output.h +++ b/libsrc/html-output.h @@ -15,6 +15,8 @@ struct html_private_data { char *cwd; size_t cwdlen; double image_indent; + double image_height; + double curr_pos_from_last_image; ocrpt_string *png; ocrpt_string *pngbase64; }; diff --git a/libsrc/json-output.c b/libsrc/json-output.c index f982ebbe..fc2b1376 100644 --- a/libsrc/json-output.c +++ b/libsrc/json-output.c @@ -316,7 +316,6 @@ static void ocrpt_json_draw_barcode(opencreport *o, ocrpt_part *p, ocrpt_part_ro yajl_gen_string(priv->yajl_gen, (ystr)"color", 5); yajl_gen_string(priv->yajl_gen, (ystr)priv->base.data->str, priv->base.data->len); - yajl_gen_string(priv->yajl_gen, (ystr)"value", 5); if (bc->value && bc->value->result[o->residx] && bc->value->result[o->residx]->type == OCRPT_RESULT_STRING) yajl_gen_string(priv->yajl_gen, (ystr)bc->value->result[o->residx]->string->str, bc->value->result[o->residx]->string->len); diff --git a/libsrc/layout.c b/libsrc/layout.c index 92066a31..121aaa7e 100644 --- a/libsrc/layout.c +++ b/libsrc/layout.c @@ -456,6 +456,44 @@ static void ocrpt_layout_image(bool draw, opencreport *o, ocrpt_part *p, ocrpt_p output->current_image = image; } +static void ocrpt_layout_barcode_setup(opencreport *o, ocrpt_part *p, ocrpt_part_row *pr, ocrpt_part_column *pd, ocrpt_report *r, ocrpt_output *output, ocrpt_line *line, ocrpt_barcode *bc, double page_width, double page_indent, double *page_position) { + bc->suppress_bc = false; + + /* Don't render the barcode if the value, the width or the height are not set. */ + if (!bc->value || !bc->value->result[o->residx] || bc->value->result[o->residx]->type != OCRPT_RESULT_STRING || !bc->value->result[o->residx]->string) { + bc->suppress_bc = true; + return; + } + + if (!bc->width || !bc->width->result[o->residx] || bc->width->result[o->residx]->type != OCRPT_RESULT_NUMBER || !bc->width->result[o->residx]->number_initialized) { + if (!bc->in_line) { + bc->suppress_bc = true; + return; + } + bc->barcode_width = 0.0; + } else + bc->barcode_width = mpfr_get_d(bc->width->result[o->residx]->number, o->rndmode); + + if (!bc->height || !bc->height->result[o->residx] || bc->height->result[o->residx]->type != OCRPT_RESULT_NUMBER || !bc->height->result[o->residx]->number_initialized) { + if (!bc->in_line) { + bc->suppress_bc = true; + return; + } + bc->barcode_height = 0.0; + } else + bc->barcode_height = mpfr_get_d(bc->height->result[o->residx]->number, o->rndmode); +} + +static void ocrpt_layout_barcode(bool draw, opencreport *o, ocrpt_part *p, ocrpt_part_row *pr, ocrpt_part_column *pd, ocrpt_report *r, ocrpt_break *br, ocrpt_output *output, ocrpt_barcode *bc, bool last, double page_width, double page_indent, double *page_position) { + if (draw && o->output_functions.draw_barcode) { + ocrpt_barcode_encode(o, bc); + o->output_functions.draw_barcode(o, p, pr, pd, r, br, output, NULL, bc, last, page_width, page_indent, page_indent, *page_position, bc->barcode_width, bc->barcode_height); + } + + output->old_page_position = *page_position; + output->current_barcode = bc; +} + static void ocrpt_layout_imageend(bool draw, opencreport *o, ocrpt_part *p, ocrpt_part_row *pr, ocrpt_part_column *pd, ocrpt_report *r, ocrpt_break *br, ocrpt_output *output) { if (draw && o->output_functions.draw_imageend) o->output_functions.draw_imageend(o, p, pr, pd, r, br, output); @@ -639,6 +677,11 @@ static void ocrpt_layout_output_resolve_barcode(ocrpt_barcode *bc) { ocrpt_expr_resolve(bc->value); ocrpt_expr_optimize(bc->value); + ocrpt_expr_resolve(bc->delayed); + ocrpt_expr_optimize(bc->delayed); + if (bc->delayed) + ocrpt_expr_set_delayed(bc->value, !!ocrpt_expr_get_long(bc->delayed)); + ocrpt_expr_resolve(bc->bctype); ocrpt_expr_optimize(bc->bctype); @@ -803,13 +846,15 @@ void ocrpt_layout_output_internal_preamble(opencreport *o, ocrpt_part *p, ocrpt_ for (ocrpt_list *ol = output->output_list; ol; ol = ol->next) { ocrpt_output_element *oe = (ocrpt_output_element *)ol->data; + ocrpt_line *l = (ocrpt_line *)oe; + ocrpt_hline *hl = (ocrpt_hline *)oe; + ocrpt_image *img = (ocrpt_image *)oe; + ocrpt_barcode *bc = (ocrpt_barcode *)oe; const char *font_name; double font_size; switch (oe->type) { - case OCRPT_OUTPUT_LINE: { - ocrpt_line *l = (ocrpt_line *)oe; - + case OCRPT_OUTPUT_LINE: l->suppress_line = false; if (l->suppress && l->suppress->result[o->residx] && l->suppress->result[o->residx]->type == OCRPT_RESULT_NUMBER && l->suppress->result[o->residx]->number_initialized) { long suppress = mpfr_get_si(l->suppress->result[o->residx]->number, o->rndmode); @@ -839,13 +884,12 @@ void ocrpt_layout_output_internal_preamble(opencreport *o, ocrpt_part *p, ocrpt_ o->output_functions.set_font_sizes(o, font_name, font_size, false, false, &l->fontsz, &l->font_width); if (output->current_image) ocrpt_layout_line_get_text_sizes(o, p, pr, pd, r, output, l, page_width - output->current_image->image_width, page_position); + else if (output->current_barcode) + ocrpt_layout_line_get_text_sizes(o, p, pr, pd, r, output, l, page_width - output->current_barcode->barcode_width, page_position); else ocrpt_layout_line_get_text_sizes(o, p, pr, pd, r, output, l, page_width, page_position); break; - } - case OCRPT_OUTPUT_HLINE: { - ocrpt_hline *hl = (ocrpt_hline *)oe; - + case OCRPT_OUTPUT_HLINE: hl->suppress_hline = false; if (hl->suppress && hl->suppress->result[o->residx] && hl->suppress->result[o->residx]->type == OCRPT_RESULT_NUMBER && hl->suppress->result[o->residx]->number_initialized) { long suppress = mpfr_get_si(hl->suppress->result[o->residx]->number, o->rndmode); @@ -871,11 +915,9 @@ void ocrpt_layout_output_internal_preamble(opencreport *o, ocrpt_part *p, ocrpt_ if (o->output_functions.set_font_sizes) o->output_functions.set_font_sizes(o, font_name, font_size, false, false, NULL, &hl->font_width); break; - } - case OCRPT_OUTPUT_IMAGE: { - ocrpt_image *img = (ocrpt_image *)oe; - + case OCRPT_OUTPUT_IMAGE: output->current_image = NULL; + output->current_barcode = NULL; img->suppress_image = false; if (img->suppress && img->suppress->result[o->residx] && img->suppress->result[o->residx]->type == OCRPT_RESULT_NUMBER && img->suppress->result[o->residx]->number_initialized) { long suppress = mpfr_get_si(img->suppress->result[o->residx]->number, o->rndmode); @@ -887,19 +929,26 @@ void ocrpt_layout_output_internal_preamble(opencreport *o, ocrpt_part *p, ocrpt_ } ocrpt_layout_image_setup(o, p, pr, pd, r, output, NULL, img, page_width, page_indent, page_position); - output->current_image_width = img->image_width; break; - } case OCRPT_OUTPUT_IMAGEEND: - output->current_image_width = 0.0; break; case OCRPT_OUTPUT_BARCODE: - /* TODO */ + output->current_image = NULL; + output->current_barcode = NULL; + bc->suppress_bc = false; + if (bc->suppress && bc->suppress->result[o->residx] && bc->suppress->result[o->residx]->type == OCRPT_RESULT_NUMBER && bc->suppress->result[o->residx]->number_initialized) { + long suppress = mpfr_get_si(bc->suppress->result[o->residx]->number, o->rndmode); + + if (suppress) { + bc->suppress_bc = true; + break; + } + } + + ocrpt_layout_barcode_setup(o, p, pr, pd, r, output, NULL, bc, page_width, page_indent, page_position); break; } } - - output->current_image_width = 0.0; } static inline void get_height_exceeded(opencreport *o, ocrpt_part *p, ocrpt_part_row *pr, ocrpt_part_column *pd, ocrpt_report *r, double old_page_position, double new_page_position, bool *height_exceeded, bool *pd_height_exceeded, bool *r_height_exceeded) { @@ -908,12 +957,25 @@ static inline void get_height_exceeded(opencreport *o, ocrpt_part *p, ocrpt_part *r_height_exceeded = o->output_functions.supports_report_height && r && r->height_expr && (r->remaining_height < (new_page_position - old_page_position)); } +void ocrpt_layout_output_adjust_page_position(ocrpt_output *output, double *page_position) { + if (output->current_image) { + if (*page_position < output->old_page_position + output->current_image->image_height) + *page_position = output->old_page_position + output->current_image->image_height; + } else if (output->current_barcode) { + if (*page_position < output->old_page_position + output->current_barcode->barcode_height) + *page_position = output->old_page_position + output->current_barcode->barcode_height; + } +} + bool ocrpt_layout_output_internal(bool draw, opencreport *o, ocrpt_part *p, ocrpt_part_row *pr, ocrpt_part_column *pd, ocrpt_report *r, ocrpt_break *br, ocrpt_output *output, double page_width, double page_indent, double *page_position) { if (output->suppress_output) return false; for (; output->iter; output->iter = output->iter->next) { ocrpt_output_element *oe = (ocrpt_output_element *)output->iter->data; + ocrpt_hline *hl = (ocrpt_hline *)oe; + ocrpt_image *img = (ocrpt_image *)oe; + ocrpt_barcode *bc = (ocrpt_barcode *)oe; switch (oe->type) { case OCRPT_OUTPUT_LINE: { @@ -939,6 +1001,8 @@ bool ocrpt_layout_output_internal(bool draw, opencreport *o, ocrpt_part *p, ocrp if (output->current_image) ocrpt_layout_line(draw, o, p, pr, pd, r, br, output, l, page_width - output->current_image->image_width, page_indent + output->current_image->image_width, page_position); + else if (output->current_barcode) + ocrpt_layout_line(draw, o, p, pr, pd, r, br, output, l, page_width - output->current_barcode->barcode_width, page_indent + output->current_barcode->barcode_width, page_position); else ocrpt_layout_line(draw, o, p, pr, pd, r, br, output, l, page_width, page_indent, page_position); } @@ -946,46 +1010,49 @@ bool ocrpt_layout_output_internal(bool draw, opencreport *o, ocrpt_part *p, ocrp l->current_line = 0; break; } - case OCRPT_OUTPUT_HLINE: { - ocrpt_hline *hl = (ocrpt_hline *)oe; - + case OCRPT_OUTPUT_HLINE: if (hl->suppress_hline) break; if (output->current_image) ocrpt_layout_hline(draw, o, p, pr, pd, r, br, output, hl, page_width - output->current_image->image_width, page_indent + output->current_image->image_width, page_position); + else if (output->current_barcode) + ocrpt_layout_hline(draw, o, p, pr, pd, r, br, output, hl, page_width - output->current_barcode->barcode_width, page_indent + output->current_barcode->barcode_width, page_position); else ocrpt_layout_hline(draw, o, p, pr, pd, r, br, output, hl, page_width, page_indent, page_position); break; - } - case OCRPT_OUTPUT_IMAGE: { - ocrpt_image *img = (ocrpt_image *)oe; - - if (output->current_image) - *page_position = output->old_page_position + output->current_image->image_height; + case OCRPT_OUTPUT_IMAGE: + ocrpt_layout_output_adjust_page_position(output, page_position); output->current_image = NULL; + output->current_barcode = NULL; if (img->suppress_image) break; ocrpt_layout_image(draw, o, p, pr, pd, r, br, output, img, false, page_width, page_indent, page_position); break; - } case OCRPT_OUTPUT_IMAGEEND: - if (output->current_image) - *page_position = output->old_page_position + output->current_image->image_height; + ocrpt_layout_output_adjust_page_position(output, page_position); output->current_image = NULL; + output->current_barcode = NULL; ocrpt_layout_imageend(draw, o, p, pr, pd, r, br, output); break; case OCRPT_OUTPUT_BARCODE: + ocrpt_layout_output_adjust_page_position(output, page_position); + + output->current_image = NULL; + output->current_barcode = NULL; + if (bc->suppress_bc) + break; + + ocrpt_layout_barcode(draw, o, p, pr, pd, r, br, output, bc, false, page_width, page_indent, page_position); break; } } - if (output->current_image) - *page_position = output->old_page_position + output->current_image->image_height; + ocrpt_layout_output_adjust_page_position(output, page_position); output->current_image = NULL; @@ -1515,6 +1582,7 @@ DLL_EXPORT_SYM ocrpt_barcode *ocrpt_line_add_barcode(ocrpt_line *line) { memset(bc, 0, sizeof(ocrpt_barcode)); bc->le_type = OCRPT_OUTPUT_LE_BARCODE; bc->output = line->output; + bc->in_line = true; line->elements = ocrpt_list_append(line->elements, bc); return bc; @@ -1902,6 +1970,16 @@ DLL_EXPORT_SYM void ocrpt_barcode_set_value_delayed(ocrpt_barcode *bc, const cha bc->delayed = expr_string ? ocrpt_layout_expr_parse(bc->output->o, bc->output->r, expr_string, true, false) : NULL; } +DLL_EXPORT_SYM void ocrpt_barcode_set_suppress(ocrpt_barcode *bc, const char *expr_string) { + if (!bc) + return; + + if (bc->suppress) + ocrpt_expr_free(bc->suppress); + + bc->suppress = expr_string ? ocrpt_layout_expr_parse(bc->output->o, bc->output->r, expr_string, true, false) : NULL; +} + DLL_EXPORT_SYM void ocrpt_barcode_set_type(ocrpt_barcode *bc, const char *expr_string) { if (!bc) return; diff --git a/libsrc/layout.h b/libsrc/layout.h index 855b15d4..f1ba392b 100644 --- a/libsrc/layout.h +++ b/libsrc/layout.h @@ -167,6 +167,8 @@ struct ocrpt_barcode { ocrpt_output_type type; ocrpt_output_line_element_type le_type; }; + bool in_line:1; + bool suppress_bc:1; double start; double vertical_gap; double barcode_width; @@ -176,6 +178,7 @@ struct ocrpt_barcode { ocrpt_output *output; ocrpt_expr *value; /* string to encode into barcode */ ocrpt_expr *delayed; + ocrpt_expr *suppress; ocrpt_expr *bctype; /* 'upc-a', 'upc-e', 'ean-13', 'ean-8', 'code39', 'code128b', 'code128c', 'code128' */ ocrpt_expr *width; ocrpt_expr *height; @@ -205,7 +208,7 @@ static inline void ocrpt_layout_output_init(ocrpt_output *output) { output->has_memo = false; output->iter = output->output_list; output->current_image = NULL; - output->current_image_width = 0.0; + output->current_barcode = NULL; for (ocrpt_list *ol = output->output_list; ol; ol = ol->next) { ocrpt_output_element *oe = (ocrpt_output_element *)ol->data; diff --git a/libsrc/output.h b/libsrc/output.h index 39219806..722c2048 100644 --- a/libsrc/output.h +++ b/libsrc/output.h @@ -63,13 +63,13 @@ typedef struct ocrpt_output_functions ocrpt_output_functions; struct ocrpt_output { double old_page_position; - double current_image_width; opencreport *o; ocrpt_report *r; ocrpt_list *output_list; ocrpt_list *iter; ocrpt_expr *suppress; ocrpt_image *current_image; + ocrpt_barcode *current_barcode; bool suppress_output:1; bool has_memo:1; bool height_exceeded:1; diff --git a/libsrc/parsexml.c b/libsrc/parsexml.c index 1bfef630..bcc7b31e 100644 --- a/libsrc/parsexml.c +++ b/libsrc/parsexml.c @@ -753,13 +753,14 @@ static void ocrpt_parse_output_imageend_node(opencreport *o, ocrpt_report *r, oc static void ocrpt_parse_output_barcode_node(opencreport *o, ocrpt_report *r, ocrpt_output *output, ocrpt_line *line, xmlTextReaderPtr reader) { ocrpt_barcode *bc; - xmlChar *value, *delayed, *type, *width, *height, *color, *bgcolor; + xmlChar *value, *delayed, *suppress, *type, *width, *height, *color, *bgcolor; struct { char *attrs[3]; xmlChar **attrp; } xmlattrs[] = { { { "value" }, &value }, { { "delayed", "precalculate" }, &delayed }, + { { "suppress" }, &suppress }, { { "type" }, &type }, { { "width" }, &width }, { { "height" }, &height }, @@ -784,6 +785,7 @@ static void ocrpt_parse_output_barcode_node(opencreport *o, ocrpt_report *r, ocr ocrpt_barcode_set_value(bc, (char *)value); ocrpt_barcode_set_value_delayed(bc, (char *)delayed); + ocrpt_barcode_set_suppress(bc, (char *)suppress); ocrpt_barcode_set_type(bc, (char *)type); ocrpt_barcode_set_width(bc, (char *)width); ocrpt_barcode_set_height(bc, (char *)height); diff --git a/libsrc/pdf-output.c b/libsrc/pdf-output.c index 9b7b11fd..0e96f606 100644 --- a/libsrc/pdf-output.c +++ b/libsrc/pdf-output.c @@ -151,21 +151,18 @@ static void ocrpt_pdf_draw_barcode(opencreport *o, ocrpt_part *p, ocrpt_part_row cairo_save(priv->cr); - ocrpt_color bg, fg; + ocrpt_color bg = { 1.0, 1.0, 1.0 }; + ocrpt_color fg = { 0.0, 0.0, 0.0 }; - char *color_name = NULL; if (bc->color && bc->color->result[o->residx] && bc->color->result[o->residx]->type == OCRPT_RESULT_STRING && bc->color->result[o->residx]->string) - color_name = bc->color->result[o->residx]->string->str; - - ocrpt_get_color(color_name, &fg, false); - - if (bc->encoded_width > 0) { - color_name = NULL; - if (bc->bgcolor && bc->bgcolor->result[o->residx] && bc->bgcolor->result[o->residx]->type == OCRPT_RESULT_STRING && bc->bgcolor->result[o->residx]->string) - color_name = bc->bgcolor->result[o->residx]->string->str; - - ocrpt_get_color(color_name, &bg, true); - } + ocrpt_get_color(bc->color->result[o->residx]->string->str, &fg, false); + else if (line && line->bgcolor && line->bgcolor->result[o->residx] && line->bgcolor->result[o->residx]->type == OCRPT_RESULT_STRING && line->bgcolor->result[o->residx]->string) + ocrpt_get_color(line->bgcolor->result[o->residx]->string->str, &fg, false); + + if (bc->bgcolor && bc->bgcolor->result[o->residx] && bc->bgcolor->result[o->residx]->type == OCRPT_RESULT_STRING && bc->bgcolor->result[o->residx]->string) + ocrpt_get_color(bc->bgcolor->result[o->residx]->string->str, &bg, true); + else if (line && line->bgcolor && line->bgcolor->result[o->residx] && line->bgcolor->result[o->residx]->type == OCRPT_RESULT_STRING && line->bgcolor->result[o->residx]->string) + ocrpt_get_color(line->bgcolor->result[o->residx]->string->str, &bg, true); /* * The background filler is 0.2 points wider. diff --git a/opencreport.dtd b/opencreport.dtd index ef76dade..c9053563 100644 --- a/opencreport.dtd +++ b/opencreport.dtd @@ -204,6 +204,7 @@ + + + + + + + +OpenCReports report + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
+
+background image +

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
+
+background image +

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+
+ +
+ +
+ diff --git a/tests/expected/layout_barcode2_test.json b/tests/expected/layout_barcode2_test.json new file mode 100644 index 00000000..9dc676aa --- /dev/null +++ b/tests/expected/layout_barcode2_test.json @@ -0,0 +1,442 @@ +{ + "part": { + "pr": { + "pd": { + "report": { + "nodata": [ + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#00ffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#0000ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffc59f", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#d3d3d3", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff00ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#00ff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#800000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#000080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff0000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#c0c0c0", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "barcode", + "width": 100.0, + "height": 100.0, + "bgcolor": "#ffffff", + "color": "#000000", + "value": "123456789012" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "barcode", + "width": 100.0, + "height": 100.0, + "bgcolor": "#ffffff", + "color": "#000000", + "value": "987654321098" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + } + ] + } + } + } + } +} diff --git a/tests/expected/layout_barcode2_test.pdf b/tests/expected/layout_barcode2_test.pdf new file mode 100644 index 00000000..85b039cd Binary files /dev/null and b/tests/expected/layout_barcode2_test.pdf differ diff --git a/tests/expected/layout_barcode2_test.txt b/tests/expected/layout_barcode2_test.txt new file mode 100644 index 00000000..1286e031 --- /dev/null +++ b/tests/expected/layout_barcode2_test.txt @@ -0,0 +1,4 @@ +There isno data here. +There isno data here. +There isno data here. +There isno data here. diff --git a/tests/expected/layout_barcode2_test.xml b/tests/expected/layout_barcode2_test.xml new file mode 100644 index 00000000..8d5c0ff4 --- /dev/null +++ b/tests/expected/layout_barcode2_test.xml @@ -0,0 +1,47 @@ + + + + + + + +
+ + + + 123456789012 + + There + is + no + data + here. + + + There + is + no + data + here. + + 987654321098 + + There + is + no + data + here. + + + There + is + no + data + here. + + + + +
+
+
diff --git a/tests/expected/layout_barcode3_test.csv b/tests/expected/layout_barcode3_test.csv new file mode 100644 index 00000000..6c5a3342 --- /dev/null +++ b/tests/expected/layout_barcode3_test.csv @@ -0,0 +1,4 @@ +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." diff --git a/tests/expected/layout_barcode3_test.html b/tests/expected/layout_barcode3_test.html new file mode 100644 index 00000000..0c43281c --- /dev/null +++ b/tests/expected/layout_barcode3_test.html @@ -0,0 +1,84 @@ + + + + + + + + +OpenCReports report + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
+
+background image +

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+
+ +
+ +
+ diff --git a/tests/expected/layout_barcode3_test.json b/tests/expected/layout_barcode3_test.json new file mode 100644 index 00000000..e9b896ea --- /dev/null +++ b/tests/expected/layout_barcode3_test.json @@ -0,0 +1,434 @@ +{ + "part": { + "pr": { + "pd": { + "report": { + "nodata": [ + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#00ffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#0000ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffc59f", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#d3d3d3", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff00ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#00ff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#800000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#000080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff0000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#c0c0c0", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "barcode", + "width": 100.0, + "height": 100.0, + "bgcolor": "#ffffff", + "color": "#000000", + "value": "987654321098" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + } + ] + } + } + } + } +} diff --git a/tests/expected/layout_barcode3_test.pdf b/tests/expected/layout_barcode3_test.pdf new file mode 100644 index 00000000..b0dcefe7 Binary files /dev/null and b/tests/expected/layout_barcode3_test.pdf differ diff --git a/tests/expected/layout_barcode3_test.txt b/tests/expected/layout_barcode3_test.txt new file mode 100644 index 00000000..1286e031 --- /dev/null +++ b/tests/expected/layout_barcode3_test.txt @@ -0,0 +1,4 @@ +There isno data here. +There isno data here. +There isno data here. +There isno data here. diff --git a/tests/expected/layout_barcode3_test.xml b/tests/expected/layout_barcode3_test.xml new file mode 100644 index 00000000..8bf8d02a --- /dev/null +++ b/tests/expected/layout_barcode3_test.xml @@ -0,0 +1,46 @@ + + + + + + + +
+ + + + + There + is + no + data + here. + + + There + is + no + data + here. + + 987654321098 + + There + is + no + data + here. + + + There + is + no + data + here. + + + + +
+
+
diff --git a/tests/expected/layout_barcode4_test.csv b/tests/expected/layout_barcode4_test.csv new file mode 100644 index 00000000..fd0b9e78 --- /dev/null +++ b/tests/expected/layout_barcode4_test.csv @@ -0,0 +1,17 @@ +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." diff --git a/tests/expected/layout_barcode4_test.html b/tests/expected/layout_barcode4_test.html new file mode 100644 index 00000000..7767a2e2 --- /dev/null +++ b/tests/expected/layout_barcode4_test.html @@ -0,0 +1,116 @@ + + + + + + + + +OpenCReports report + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
+
+background image +

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+
+
+background image +

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+
+
+

Thereisnodatahere.

+
 
+
+ +
+ +
+ diff --git a/tests/expected/layout_barcode4_test.json b/tests/expected/layout_barcode4_test.json new file mode 100644 index 00000000..88517e8a --- /dev/null +++ b/tests/expected/layout_barcode4_test.json @@ -0,0 +1,1388 @@ +{ + "part": { + "pr": { + "pd": { + "report": { + "nodata": [ + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#00ffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#0000ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffc59f", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#d3d3d3", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff00ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#00ff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#800000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#000080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff0000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#c0c0c0", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "barcode", + "width": 100.0, + "height": 100.0, + "bgcolor": "#ffffff", + "color": "#000000", + "value": "123456789012" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "barcode", + "width": 100.0, + "height": 100.0, + "bgcolor": "#ffffff", + "color": "#000000", + "value": "987654321098" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "imageend" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + } + ] + } + } + } + } +} diff --git a/tests/expected/layout_barcode4_test.pdf b/tests/expected/layout_barcode4_test.pdf new file mode 100644 index 00000000..b8b614bb Binary files /dev/null and b/tests/expected/layout_barcode4_test.pdf differ diff --git a/tests/expected/layout_barcode4_test.txt b/tests/expected/layout_barcode4_test.txt new file mode 100644 index 00000000..d08b5d31 --- /dev/null +++ b/tests/expected/layout_barcode4_test.txt @@ -0,0 +1,17 @@ +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. diff --git a/tests/expected/layout_barcode4_test.xml b/tests/expected/layout_barcode4_test.xml new file mode 100644 index 00000000..e2cff453 --- /dev/null +++ b/tests/expected/layout_barcode4_test.xml @@ -0,0 +1,138 @@ + + + + + + + +
+ + + + 123456789012 + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + 987654321098 + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + + +
+
+
diff --git a/tests/expected/layout_xml3_ver2_test.csv b/tests/expected/layout_xml3_ver2_test.csv new file mode 100644 index 00000000..fd0b9e78 --- /dev/null +++ b/tests/expected/layout_xml3_ver2_test.csv @@ -0,0 +1,17 @@ +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." +"There","is","no","data","here." diff --git a/tests/expected/layout_xml3_ver2_test.html b/tests/expected/layout_xml3_ver2_test.html new file mode 100644 index 00000000..770b2daf --- /dev/null +++ b/tests/expected/layout_xml3_ver2_test.html @@ -0,0 +1,116 @@ + + + + + + + + +OpenCReports report + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
+
+ +

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+
+
+background image +

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+

Thereisnodatahere.

+
 
+
+
+

Thereisnodatahere.

+
 
+
+ +
+ +
+ diff --git a/tests/expected/layout_xml3_ver2_test.json b/tests/expected/layout_xml3_ver2_test.json new file mode 100644 index 00000000..6c5e973f --- /dev/null +++ b/tests/expected/layout_xml3_ver2_test.json @@ -0,0 +1,1384 @@ +{ + "part": { + "pr": { + "pd": { + "report": { + "nodata": [ + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#00ffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#0000ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffc59f", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#d3d3d3", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff00ff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#00ff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#800000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#000080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#808000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#ff0000", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#c0c0c0", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#008080", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffffff", + "indent": 0.0, + "size": 1.0, + "length": 100.802734375 + }, + { + "type": "horizontal_line", + "color": "#ffff00", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + }, + { + "type": "image", + "width": 100.0, + "height": 100.0, + "file": "images/images/matplotlib.svg" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "image", + "width": 100.0, + "height": 100.0, + "file": "images/images/math-formula.png" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#800080", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 100.0, + "size": 1.0, + "length": 466.47559055118108517 + }, + { + "type": "imageend" + }, + { + "type": "line", + "elements": [ + { + "type": "text", + "width": 43.201171875, + "font_point": 12.0, + "font_face": "Courier", + "bold": true, + "italic": false, + "align": "left", + "bgcolor": "#0000ff", + "color": "#ff0000", + "data": "There" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "right", + "bgcolor": "#000000", + "color": "#ffffff", + "data": "is" + }, + { + "type": "text", + "width": 21.6005859375, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": true, + "align": "center", + "bgcolor": "#008080", + "color": "#00ff00", + "data": "no" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#c0c0c0", + "color": "#00ffff", + "data": "data" + }, + { + "type": "text", + "width": 36.0009765625, + "font_point": 12.0, + "font_face": "Courier", + "bold": false, + "italic": false, + "align": "left", + "bgcolor": "#008000", + "color": "#ff00ff", + "data": "here." + } + ] + }, + { + "type": "horizontal_line", + "color": "#000000", + "indent": 0.0, + "size": 1.0, + "length": 566.47559055118108517 + } + ] + } + } + } + } +} diff --git a/tests/expected/layout_xml3_ver2_test.pdf b/tests/expected/layout_xml3_ver2_test.pdf new file mode 100644 index 00000000..a5f9cf68 Binary files /dev/null and b/tests/expected/layout_xml3_ver2_test.pdf differ diff --git a/tests/expected/layout_xml3_ver2_test.txt b/tests/expected/layout_xml3_ver2_test.txt new file mode 100644 index 00000000..d08b5d31 --- /dev/null +++ b/tests/expected/layout_xml3_ver2_test.txt @@ -0,0 +1,17 @@ +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. +There isno data here. diff --git a/tests/expected/layout_xml3_ver2_test.xml b/tests/expected/layout_xml3_ver2_test.xml new file mode 100644 index 00000000..d9dd77cc --- /dev/null +++ b/tests/expected/layout_xml3_ver2_test.xml @@ -0,0 +1,138 @@ + + + + + + + +
+ + + + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + There + is + no + data + here. + + + + +
+
+
diff --git a/tests/layout_barcode2_test.c b/tests/layout_barcode2_test.c new file mode 100644 index 00000000..3ff6164b --- /dev/null +++ b/tests/layout_barcode2_test.c @@ -0,0 +1,40 @@ +/* + * OpenCReports test + * Copyright (C) 2019-2023 Zoltán Böszörményi + * See COPYING.LGPLv3 in the toplevel directory. + */ + +#include +#include +#include + +#include +#include "test_common.h" + +const char *array[1][5] = { + { "id", "name", "property", "age", "adult" }, +}; + +const int32_t coltypes[5] = { + OCRPT_RESULT_NUMBER, OCRPT_RESULT_STRING, OCRPT_RESULT_STRING, OCRPT_RESULT_NUMBER, OCRPT_RESULT_NUMBER +}; + +int main(int argc, char **argv) { + opencreport *o = ocrpt_init(); + + if (!ocrpt_parse_xml(o, "layout_barcode2_test.xml")) { + printf("XML parse error\n"); + ocrpt_free(o); + return 0; + } + + ocrpt_set_output_format(o, argc >= 2 ? atoi(argv[1]) : OCRPT_OUTPUT_PDF); + + ocrpt_execute(o); + + ocrpt_spool(o); + + ocrpt_free(o); + + return 0; +} diff --git a/tests/layout_barcode2_test.xml b/tests/layout_barcode2_test.xml new file mode 100644 index 00000000..7d22e19b --- /dev/null +++ b/tests/layout_barcode2_test.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + + diff --git a/tests/layout_barcode3_test.c b/tests/layout_barcode3_test.c new file mode 100644 index 00000000..c3301089 --- /dev/null +++ b/tests/layout_barcode3_test.c @@ -0,0 +1,40 @@ +/* + * OpenCReports test + * Copyright (C) 2019-2023 Zoltán Böszörményi + * See COPYING.LGPLv3 in the toplevel directory. + */ + +#include +#include +#include + +#include +#include "test_common.h" + +const char *array[1][5] = { + { "id", "name", "property", "age", "adult" }, +}; + +const int32_t coltypes[5] = { + OCRPT_RESULT_NUMBER, OCRPT_RESULT_STRING, OCRPT_RESULT_STRING, OCRPT_RESULT_NUMBER, OCRPT_RESULT_NUMBER +}; + +int main(int argc, char **argv) { + opencreport *o = ocrpt_init(); + + if (!ocrpt_parse_xml(o, "layout_barcode3_test.xml")) { + printf("XML parse error\n"); + ocrpt_free(o); + return 0; + } + + ocrpt_set_output_format(o, argc >= 2 ? atoi(argv[1]) : OCRPT_OUTPUT_PDF); + + ocrpt_execute(o); + + ocrpt_spool(o); + + ocrpt_free(o); + + return 0; +} diff --git a/tests/layout_barcode3_test.xml b/tests/layout_barcode3_test.xml new file mode 100644 index 00000000..494b2a43 --- /dev/null +++ b/tests/layout_barcode3_test.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + + diff --git a/tests/layout_barcode4_test.c b/tests/layout_barcode4_test.c new file mode 100644 index 00000000..12dcb509 --- /dev/null +++ b/tests/layout_barcode4_test.c @@ -0,0 +1,40 @@ +/* + * OpenCReports test + * Copyright (C) 2019-2023 Zoltán Böszörményi + * See COPYING.LGPLv3 in the toplevel directory. + */ + +#include +#include +#include + +#include +#include "test_common.h" + +const char *array[1][5] = { + { "id", "name", "property", "age", "adult" }, +}; + +const int32_t coltypes[5] = { + OCRPT_RESULT_NUMBER, OCRPT_RESULT_STRING, OCRPT_RESULT_STRING, OCRPT_RESULT_NUMBER, OCRPT_RESULT_NUMBER +}; + +int main(int argc, char **argv) { + opencreport *o = ocrpt_init(); + + if (!ocrpt_parse_xml(o, "layout_barcode4_test.xml")) { + printf("XML parse error\n"); + ocrpt_free(o); + return 0; + } + + ocrpt_set_output_format(o, argc >= 2 ? atoi(argv[1]) : OCRPT_OUTPUT_PDF); + + ocrpt_execute(o); + + ocrpt_spool(o); + + ocrpt_free(o); + + return 0; +} diff --git a/tests/layout_barcode4_test.xml b/tests/layout_barcode4_test.xml new file mode 100644 index 00000000..fc047006 --- /dev/null +++ b/tests/layout_barcode4_test.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + + is + + data + + + + + + + diff --git a/tests/layout_xml3_ver2_test.c b/tests/layout_xml3_ver2_test.c new file mode 100644 index 00000000..4bddc096 --- /dev/null +++ b/tests/layout_xml3_ver2_test.c @@ -0,0 +1,51 @@ +/* + * OpenCReports test + * Copyright (C) 2019-2023 Zoltán Böszörményi + * See COPYING.LGPLv3 in the toplevel directory. + */ + +#include +#include +#include + +#include +#include "test_common.h" + +const char *array[1][5] = { + { "id", "name", "property", "age", "adult" }, +}; + +const int32_t coltypes[5] = { + OCRPT_RESULT_NUMBER, OCRPT_RESULT_STRING, OCRPT_RESULT_STRING, OCRPT_RESULT_NUMBER, OCRPT_RESULT_NUMBER +}; + +int main(int argc, char **argv) { + opencreport *o = ocrpt_init(); + + if (!ocrpt_parse_xml(o, "layout_xml3_ver2_test.xml")) { + printf("XML parse error\n"); + ocrpt_free(o); + return 0; + } + + char srcdir0[PATH_MAX]; + char *srcdir = getenv("abs_srcdir"); + if (!srcdir || !*srcdir) + srcdir = getcwd(srcdir0, sizeof(srcdir0)); + char *csrcdir = ocrpt_canonicalize_path(srcdir); + ocrpt_string *imgdir = ocrpt_mem_string_new("", true); + ocrpt_mem_string_append_printf(imgdir, "%s/images/images", csrcdir); + ocrpt_add_search_path(o, imgdir->str); + ocrpt_mem_free(csrcdir); + ocrpt_mem_string_free(imgdir, true); + + ocrpt_set_output_format(o, argc >= 2 ? atoi(argv[1]) : OCRPT_OUTPUT_PDF); + + ocrpt_execute(o); + + ocrpt_spool(o); + + ocrpt_free(o); + + return 0; +} diff --git a/tests/layout_xml3_ver2_test.xml b/tests/layout_xml3_ver2_test.xml new file mode 100644 index 00000000..c07339a0 --- /dev/null +++ b/tests/layout_xml3_ver2_test.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + is + + data + + + + + + + is + + data + + + + + + +