diff options
Diffstat (limited to 'test/test-nautilus-font.c')
-rw-r--r-- | test/test-nautilus-font.c | 182 |
1 files changed, 0 insertions, 182 deletions
diff --git a/test/test-nautilus-font.c b/test/test-nautilus-font.c index 7ac8647a7..553eed1ab 100644 --- a/test/test-nautilus-font.c +++ b/test/test-nautilus-font.c @@ -4,7 +4,6 @@ #include "test.h" #include <libnautilus-extensions/nautilus-scalable-font.h> -#include <libnautilus-extensions/nautilus-text-layout.h> int main (int argc, char* argv[]) @@ -15,11 +14,9 @@ main (int argc, char* argv[]) ArtIRect whole_area; ArtIRect multi_lines_area; - const char *text = "\nLine Two\n\nLine Four\n\n\nLine Seven"; const guint font_size = 48; const guint pixbuf_width = 500; const guint pixbuf_height = 700; - const guint line_offset = 2; const guint empty_line_height = font_size; const int multi_line_x = 10; const int multi_line_y = 10; @@ -45,37 +42,6 @@ main (int argc, char* argv[]) multi_lines_area.x0 = multi_line_x; multi_lines_area.y0 = multi_line_y; - /* Measure some text lines */ - { - guint num_text_lines; - NautilusDimensions *text_line_dimensions; - guint max_width_out; - guint total_height_out; - - num_text_lines = nautilus_str_count_characters (text, '\n') + 1; - - text_line_dimensions = g_new (NautilusDimensions, num_text_lines); - - nautilus_scalable_font_measure_text_lines (font, - font_size, - text, - num_text_lines, - empty_line_height, - text_line_dimensions, - &max_width_out, - &total_height_out); - - multi_lines_area.x1 = multi_lines_area.x0 + max_width_out; - multi_lines_area.y1 = multi_lines_area.y0 + total_height_out + ((num_text_lines - 1) * line_offset); - - g_print ("num_text_lines = %d, max_width = %d, total_height = %d\n", - num_text_lines, - max_width_out, - total_height_out); - - g_free (text_line_dimensions); - } - clip_area.x0 = 300; clip_area.y0 = 20; clip_area.x1 = clip_area.x0 + 100; @@ -107,22 +73,6 @@ main (int argc, char* argv[]) -1); /* - * Multiple text lines test. - */ - nautilus_scalable_font_draw_text_lines (font, - pixbuf, - multi_line_x, - multi_line_y, - &whole_area, - font_size, - text, - GTK_JUSTIFY_LEFT, - line_offset, - empty_line_height, - NAUTILUS_RGBA_COLOR_OPAQUE_BLUE, - NAUTILUS_OPACITY_FULLY_OPAQUE); - - /* * Clipped text test. The "Something" string should be clipped such * that horizontally you can only see "Som" and a tiny fraction of * the "e". @@ -177,138 +127,6 @@ main (int argc, char* argv[]) gdk_pixbuf_unref (tile_pixbuf); } - /* - * Text layout test. - */ - { - NautilusTextLayout *text_layout; - const guint max_text_width = 100; - const char *separators = " -_,;.?/&"; - const char *text = "This is a long piece of text!-This is the second piece-Now we have the third piece-And finally the fourth piece"; - const guint font_size = 14; - ArtIRect layout_area; - - text_layout = nautilus_text_layout_new (font, - font_size, - text, - separators, - max_text_width, - TRUE); - g_assert (text_layout != NULL); - - layout_area.x0 = 20; - layout_area.y0 = 550; - layout_area.x1 = layout_area.x0 + max_text_width; - layout_area.y1 = layout_area.y0 + 130; - - nautilus_debug_pixbuf_draw_rectangle_inset (pixbuf, - FALSE, - layout_area.x0, - layout_area.y0, - layout_area.x1, - layout_area.y1, - NAUTILUS_RGBA_COLOR_OPAQUE_RED, - NAUTILUS_OPACITY_FULLY_OPAQUE, - -1); - - nautilus_text_layout_paint (text_layout, - pixbuf, - layout_area.x0, - layout_area.y0, - GTK_JUSTIFY_LEFT, - NAUTILUS_RGBA_COLOR_OPAQUE_BLACK, - FALSE); - - layout_area.x0 += (max_text_width + 20); - layout_area.x1 += (max_text_width + 20); - - nautilus_debug_pixbuf_draw_rectangle_inset (pixbuf, - FALSE, - layout_area.x0, - layout_area.y0, - layout_area.x1, - layout_area.y1, - NAUTILUS_RGBA_COLOR_OPAQUE_RED, - NAUTILUS_OPACITY_FULLY_OPAQUE, - -1); - - nautilus_text_layout_paint (text_layout, - pixbuf, - layout_area.x0, - layout_area.y0, - GTK_JUSTIFY_CENTER, - NAUTILUS_RGBA_COLOR_OPAQUE_BLACK, - FALSE); - - layout_area.x0 += (max_text_width + 20); - layout_area.x1 += (max_text_width + 20); - - nautilus_debug_pixbuf_draw_rectangle_inset (pixbuf, - FALSE, - layout_area.x0, - layout_area.y0, - layout_area.x1, - layout_area.y1, - NAUTILUS_RGBA_COLOR_OPAQUE_RED, - NAUTILUS_OPACITY_FULLY_OPAQUE, - -1); - - nautilus_text_layout_paint (text_layout, - pixbuf, - layout_area.x0, - layout_area.y0, - GTK_JUSTIFY_RIGHT, - NAUTILUS_RGBA_COLOR_OPAQUE_BLACK, - FALSE); - - nautilus_text_layout_free (text_layout); - } - - /* - * Underlined text test. - */ - { - NautilusTextLayout *text_layout; - const guint max_text_width = pixbuf_width / 2; - const char *separators = "-"; - const char *text = "This is multi line-text (g) that should-be centered and-(q) underlined"; - const guint font_size = 30; - ArtIRect layout_area; - - text_layout = nautilus_text_layout_new (font, - font_size, - text, - separators, - max_text_width, - TRUE); - g_assert (text_layout != NULL); - - layout_area.x0 = (pixbuf_width - text_layout->width) / 2; - layout_area.y0 = 410; - layout_area.x1 = layout_area.x0 + text_layout->width; - layout_area.y1 = layout_area.y0 + text_layout->height; - - nautilus_debug_pixbuf_draw_rectangle_inset (pixbuf, - FALSE, - layout_area.x0, - layout_area.y0, - layout_area.x1, - layout_area.y1, - NAUTILUS_RGBA_COLOR_OPAQUE_RED, - NAUTILUS_OPACITY_FULLY_OPAQUE, - -1); - - nautilus_text_layout_paint (text_layout, - pixbuf, - layout_area.x0, - layout_area.y0, - GTK_JUSTIFY_CENTER, - NAUTILUS_RGBA_COLOR_OPAQUE_BLACK, - TRUE); - - nautilus_text_layout_free (text_layout); - } - nautilus_debug_show_pixbuf_in_eog (pixbuf); gdk_pixbuf_unref (pixbuf); |