Enlightenment CVS committal
Author : dj2
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/grid
Modified Files:
ewl_grid_test.c
Log Message:
- tabs are a tricky beast. looks like I missed some.
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/grid/ewl_grid_test.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- ewl_grid_test.c 6 May 2008 20:09:04 -0000 1.3
+++ ewl_grid_test.c 7 May 2008 13:38:16 -0000 1.4
@@ -30,21 +30,21 @@
static int orientation_set_get(char *buf, int len);
static Ewl_Unit_Test grid_unit_tests[] = {
- {"set and get dimensions", dimensions_set_get, NULL, -1, 0},
- {"set and get fixed column size", column_fixed_set_get, NULL,
-1, 0},
- {"set and get fixed row size", row_fixed_set_get, NULL, -1, 0},
- {"set and get relative column size", column_relative_set_get,
NULL, -1, 0},
- {"set and get relative row size", row_relative_set_get, NULL,
-1, 0},
- {"remove fixed column size", column_size_remove, NULL, -1, 0},
- {"remove row column size", row_size_remove, NULL, -1, 0},
- {"set and get vertiacal homogeneous", vhomogeneous_set_get,
NULL, -1, 0},
- {"set and get horizontal homogeneous", hhomogeneous_set_get,
NULL, -1, 0},
- {"set and get homogeneous", homogeneous_set_get, NULL, -1, 0},
- {"set and get position", position_set_get, NULL, -1, 0},
- {"get position of floating widgets", floating_position_get,
NULL, -1, 0},
- {"auto resize dimensions", dimensions_auto_resize, NULL, -1, 0},
- {"set and get the orientation", orientation_set_get, NULL, -1,
0},
- {NULL, NULL, NULL, -1, 0}
+ {"set and get dimensions", dimensions_set_get, NULL, -1, 0},
+ {"set and get fixed column size", column_fixed_set_get, NULL,
-1, 0},
+ {"set and get fixed row size", row_fixed_set_get, NULL, -1, 0},
+ {"set and get relative column size", column_relative_set_get,
NULL, -1, 0},
+ {"set and get relative row size", row_relative_set_get, NULL,
-1, 0},
+ {"remove fixed column size", column_size_remove, NULL, -1, 0},
+ {"remove row column size", row_size_remove, NULL, -1, 0},
+ {"set and get vertiacal homogeneous", vhomogeneous_set_get,
NULL, -1, 0},
+ {"set and get horizontal homogeneous", hhomogeneous_set_get,
NULL, -1, 0},
+ {"set and get homogeneous", homogeneous_set_get, NULL, -1, 0},
+ {"set and get position", position_set_get, NULL, -1, 0},
+ {"get position of floating widgets", floating_position_get,
NULL, -1, 0},
+ {"auto resize dimensions", dimensions_auto_resize, NULL, -1,
0},
+ {"set and get the orientation", orientation_set_get, NULL, -1,
0},
+ {NULL, NULL, NULL, -1, 0}
};
void
@@ -55,7 +55,7 @@
test->filename = __FILE__;
test->func = create_test;
test->type = EWL_TEST_TYPE_CONTAINER;
- test->unit_tests = grid_unit_tests;
+ test->unit_tests = grid_unit_tests;
}
static int
@@ -92,7 +92,7 @@
hbox = ewl_hbox_new();
ewl_container_child_append(EWL_CONTAINER(vbox), hbox);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL
- | EWL_FLAG_FILL_VSHRINK);
+ | EWL_FLAG_FILL_VSHRINK);
ewl_box_homogeneous_set(EWL_BOX(hbox), TRUE);
ewl_widget_show(hbox);
@@ -128,7 +128,7 @@
w = ewl_entry_new();
ewl_text_text_set(EWL_TEXT(w), "This row use the\n"
- "preferred height");
+ "preferred height");
ewl_container_child_append(EWL_CONTAINER(grid), w);
ewl_grid_child_position_set(EWL_GRID(grid), w, 3, 4, 2, 2);
ewl_widget_show(w);
@@ -145,7 +145,7 @@
ewl_button_label_set(EWL_BUTTON(button), "Append");
ewl_container_child_append(EWL_CONTAINER(d), button);
ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_clicked_cb,
- NULL);
+ NULL);
ewl_widget_show(button);
}
@@ -158,7 +158,7 @@
ewl_button_label_set(EWL_BUTTON(button), "Prepend");
ewl_container_child_prepend(EWL_CONTAINER(d), button);
ewl_callback_append(button, EWL_CALLBACK_CLICKED, button_clicked_cb,
- NULL);
+ NULL);
ewl_widget_show(button);
}
@@ -170,10 +170,10 @@
g = w->parent;
ewl_grid_child_position_get(EWL_GRID(g), w, &start_col, &end_col,
- &start_row, &end_row);
+ &start_row, &end_row);
printf("child position:\n\t\tstart\tend\n"
- " column:\t%i\t%i\n"
- " row:\t\t%i\t%i\n\n", start_col, end_col, start_row, end_row);
+ " column:\t%i\t%i\n"
+ " row:\t\t%i\t%i\n\n", start_col, end_col, start_row, end_row);
}
/* unit tests */
@@ -189,9 +189,9 @@
ewl_grid_dimensions_get(EWL_GRID(grid), &col, &row);
if (col != 5 || row != 6) {
- snprintf(buf, len, "dimensions are %dx%d, but should be 5x6",
- col, row);
- ret = 0;
+ snprintf(buf, len, "dimensions are %dx%d, but should be 5x6",
+ col, row);
+ ret = 0;
}
ewl_widget_destroy(grid);
@@ -209,20 +209,20 @@
grid = ewl_grid_new();
fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
if (fixed != 0) {
- snprintf(buf, len, "the column has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the column has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
}
/* now set a fixed size and see if we get it back */
ewl_grid_column_fixed_w_set(EWL_GRID(grid), 1, 123);
fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
if (fixed != 123) {
- snprintf(buf, len, "the column has a wrong fixed size (%d)!",
- fixed);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the column has a wrong fixed size (%d)!",
+ fixed);
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
@@ -241,20 +241,20 @@
grid = ewl_grid_new();
fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
if (fixed != 0) {
- snprintf(buf, len, "the row has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the row has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
}
/* now set a fixed size and see if we get it back */
ewl_grid_row_fixed_h_set(EWL_GRID(grid), 1, 123);
fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
if (fixed != 123) {
- snprintf(buf, len, "the row has a wrong fixed size (%d)!",
- fixed);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the row has a wrong fixed size (%d)!",
+ fixed);
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
@@ -274,20 +274,20 @@
grid = ewl_grid_new();
rel = ewl_grid_column_relative_w_get(EWL_GRID(grid), 1);
if (rel != 0.0) {
- snprintf(buf, len, "the column has a relative size (%f), where"
- " it shouldn't", rel);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the column has a relative size (%f), where"
+ " it shouldn't", rel);
+ ret = 0;
+ goto CLEANUP;
}
/* now set a relative size and see if we get it back */
ewl_grid_column_relative_w_set(EWL_GRID(grid), 1, 0.5);
rel = ewl_grid_column_relative_w_get(EWL_GRID(grid), 1);
if (rel != 0.5) {
- snprintf(buf, len, "the column has a wrong relative size (%f)!",
- rel);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the column has a wrong relative size
(%f)!",
+ rel);
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
@@ -306,20 +306,20 @@
grid = ewl_grid_new();
rel = ewl_grid_row_relative_h_get(EWL_GRID(grid), 1);
if (rel != 0) {
- snprintf(buf, len, "the row has a rel size (%f), where"
- " it shouldn't", rel);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the row has a rel size (%f), where"
+ " it shouldn't", rel);
+ ret = 0;
+ goto CLEANUP;
}
/* now set a rel size and see if we get it back */
ewl_grid_row_relative_h_set(EWL_GRID(grid), 1, 0.5);
rel = ewl_grid_row_relative_h_get(EWL_GRID(grid), 1);
if (rel != 0.5) {
- snprintf(buf, len, "the row has a wrong relative size (%f)!",
- rel);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the row has a wrong relative size (%f)!",
+ rel);
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
@@ -340,10 +340,10 @@
ewl_grid_column_w_remove(EWL_GRID(grid), 1);
fixed = ewl_grid_column_fixed_w_get(EWL_GRID(grid), 1);
if (fixed != 0) {
- snprintf(buf, len, "the column has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the column has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
@@ -364,10 +364,10 @@
ewl_grid_row_h_remove(EWL_GRID(grid), 1);
fixed = ewl_grid_row_fixed_h_get(EWL_GRID(grid), 1);
if (fixed != 0) {
- snprintf(buf, len, "the row has a fixed size (%d), where"
- " it shouldn't", fixed);
- ret = 0;
- goto CLEANUP;
+ snprintf(buf, len, "the row has a fixed size (%d), where"
+ " it shouldn't", fixed);
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
@@ -387,17 +387,17 @@
/* test true */
ewl_grid_vhomogeneous_set(EWL_GRID(grid), TRUE);
if (!ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is not vhomogeneous");
- ret = 0;
- goto CLEANUP;
+ LOG_FAILURE(buf, len, "grid is not vhomogeneous");
+ ret = 0;
+ goto CLEANUP;
}
/* test false */
ewl_grid_vhomogeneous_set(EWL_GRID(grid), FALSE);
if (ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is vhomogeneous");
- ret = 0;
- goto CLEANUP;
+ LOG_FAILURE(buf, len, "grid is vhomogeneous");
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
ewl_widget_destroy(grid);
@@ -416,17 +416,17 @@
/* test true */
ewl_grid_hhomogeneous_set(EWL_GRID(grid), TRUE);
if (!ewl_grid_hhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is not hhomogeneous");
- ret = 0;
- goto CLEANUP;
+ LOG_FAILURE(buf, len, "grid is not hhomogeneous");
+ ret = 0;
+ goto CLEANUP;
}
/* test false */
ewl_grid_hhomogeneous_set(EWL_GRID(grid), FALSE);
if (ewl_grid_hhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is hhomogeneous");
- ret = 0;
- goto CLEANUP;
+ LOG_FAILURE(buf, len, "grid is hhomogeneous");
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
ewl_widget_destroy(grid);
@@ -445,19 +445,19 @@
/* test true */
ewl_grid_homogeneous_set(EWL_GRID(grid), TRUE);
if (!(ewl_grid_hhomogeneous_get(EWL_GRID(grid))
- || ewl_grid_vhomogeneous_get(EWL_GRID(grid)))) {
- LOG_FAILURE(buf, len, "grid is not homogeneous");
- ret = 0;
- goto CLEANUP;
+ || ewl_grid_vhomogeneous_get(EWL_GRID(grid)))) {
+ LOG_FAILURE(buf, len, "grid is not homogeneous");
+ ret = 0;
+ goto CLEANUP;
}
/* test false */
ewl_grid_homogeneous_set(EWL_GRID(grid), FALSE);
if (ewl_grid_hhomogeneous_get(EWL_GRID(grid))
- || ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
- LOG_FAILURE(buf, len, "grid is homogeneous");
- ret = 0;
- goto CLEANUP;
+ || ewl_grid_vhomogeneous_get(EWL_GRID(grid))) {
+ LOG_FAILURE(buf, len, "grid is homogeneous");
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
@@ -484,11 +484,11 @@
ewl_widget_show(child);
ewl_grid_child_position_get(EWL_GRID(grid), child, &col_start,
&col_end,
- &row_start, &row_end);
+ &row_start, &row_end);
if (col_start != 0 || col_end != 2 || row_start != 1 || row_end != 3) {
- LOG_FAILURE(buf, len, "child has wrong position");
- ret = 0;
+ LOG_FAILURE(buf, len, "child has wrong position");
+ ret = 0;
}
ewl_widget_destroy(grid);
@@ -517,31 +517,31 @@
/* first add the children to the grid */
for (i = 0; i < 5; i++) {
- w[i] = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(grid), w[i]);
- ewl_widget_show(w[i]);
+ w[i] = ewl_cell_new();
+ ewl_container_child_append(EWL_CONTAINER(grid), w[i]);
+ ewl_widget_show(w[i]);
}
/* now check the positions */
for (i = 0; i < 5; i++) {
- int r, c;
-
- ewl_grid_child_position_get(EWL_GRID(grid), w[i], &c, NULL, &r,
- NULL);
- if (c != col || r != row) {
- LOG_FAILURE(buf, len, "child isn't placed right");
- ret = 0;
- break;
- }
- col++;
- if (col > 1) {
- col = 0;
- row++;
- }
- /* here is our placed widget we don't want to check this
- * position */
- if (col == 0 && row == 1)
- col = 1;
+ int r, c;
+
+ ewl_grid_child_position_get(EWL_GRID(grid), w[i], &c, NULL, &r,
+ NULL);
+ if (c != col || r != row) {
+ LOG_FAILURE(buf, len, "child isn't placed right");
+ ret = 0;
+ break;
+ }
+ col++;
+ if (col > 1) {
+ col = 0;
+ row++;
+ }
+ /* here is our placed widget we don't want to check this
+ * position */
+ if (col == 0 && row == 1)
+ col = 1;
}
ewl_widget_destroy(grid);
@@ -560,19 +560,19 @@
ewl_widget_show(grid);
for (i = 0; i < number; i++) {
- Ewl_Widget *child;
+ Ewl_Widget *child;
- child = ewl_cell_new();
- ewl_container_child_append(EWL_CONTAINER(grid), child);
- ewl_widget_show(child);
+ child = ewl_cell_new();
+ ewl_container_child_append(EWL_CONTAINER(grid), child);
+ ewl_widget_show(child);
}
i = 0;
ewl_grid_dimensions_get(EWL_GRID(grid), NULL, &i);
if (i != number / 2) {
- LOG_FAILURE(buf, len, "the grid doesn't have the expected
dimensions");
- ret = 0;
+ LOG_FAILURE(buf, len, "the grid doesn't have the expected
dimensions");
+ ret = 0;
}
ewl_widget_destroy(grid);
@@ -590,18 +590,18 @@
ewl_grid_orientation_set(EWL_GRID(grid), EWL_ORIENTATION_HORIZONTAL);
if (ewl_grid_orientation_get(EWL_GRID(grid))
- != EWL_ORIENTATION_HORIZONTAL) {
- LOG_FAILURE(buf, len, "orientation is not horizontal");
- ret = 0;
- goto CLEANUP;
+ != EWL_ORIENTATION_HORIZONTAL) {
+ LOG_FAILURE(buf, len, "orientation is not horizontal");
+ ret = 0;
+ goto CLEANUP;
}
ewl_grid_orientation_set(EWL_GRID(grid), EWL_ORIENTATION_VERTICAL);
if (ewl_grid_orientation_get(EWL_GRID(grid))
- != EWL_ORIENTATION_VERTICAL) {
- LOG_FAILURE(buf, len, "orientation is not vertiacal");
- ret = 0;
- goto CLEANUP;
+ != EWL_ORIENTATION_VERTICAL) {
+ LOG_FAILURE(buf, len, "orientation is not vertiacal");
+ ret = 0;
+ goto CLEANUP;
}
CLEANUP:
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs