Enlightenment CVS committal
Author : ningerso
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/border
Modified Files:
ewl_border_test.c
Log Message:
Complete basic test coverage for the border container.
===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/border/ewl_border_test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_border_test.c 3 Feb 2008 05:28:39 -0000 1.2
+++ ewl_border_test.c 3 Feb 2008 06:05:59 -0000 1.3
@@ -20,10 +20,14 @@
static int border_is_test(char *buf, int len);
static int label_set_get_test(char *buf, int len);
+static int label_position_set_get_test(char *buf, int len);
+static int label_alignment_set_get_test(char *buf, int len);
static Ewl_Unit_Test border_unit_tests[] = {
{"Border is", border_is_test, NULL, -1, 0},
{"Border label set/get", label_set_get_test, NULL, -1, 0},
+ {"Border label position set/get", label_position_set_get_test,
NULL, -1, 0},
+ {"Border label alignment set/get",
label_alignment_set_get_test, NULL, -1, 0},
};
void
@@ -275,6 +279,119 @@
LOG_FAILURE(buf, len, "border label doesn't match");
}
+ ewl_widget_destroy(border);
+
+ return ret;
+}
+
+static int label_position_set_get_test(char *buf, int len)
+{
+ Ewl_Widget *border;
+ unsigned int pos;
+ int ret = 0;
+
+ border = ewl_border_new();
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_TOP) {
+ LOG_FAILURE(buf, len, "default border label position wrong");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_LEFT);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_LEFT) {
+ LOG_FAILURE(buf, len, "border label position not left");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_RIGHT);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_RIGHT) {
+ LOG_FAILURE(buf, len, "border label position not right");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_BOTTOM);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_BOTTOM) {
+ LOG_FAILURE(buf, len, "border label position not bottom");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_position_set(EWL_BORDER(border), EWL_POSITION_TOP);
+ pos = ewl_border_label_position_get(EWL_BORDER(border));
+ if (pos != EWL_POSITION_TOP) {
+ LOG_FAILURE(buf, len, "border label position not top");
+ goto POSITION_ERROR;
+ }
+
+ ret = 1;
+
+POSITION_ERROR:
+ ewl_widget_destroy(border);
+
+ return ret;
+}
+
+static int label_alignment_set_get_test(char *buf, int len)
+{
+ Ewl_Widget *border;
+ int align;
+ int req_align;
+ int ret = 0;
+
+ border = ewl_border_new();
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_LEFT) {
+ LOG_FAILURE(buf, len, "default border label alignment wrong");
+ goto POSITION_ERROR;
+ }
+
+ req_align = (EWL_FLAG_ALIGN_LEFT | EWL_FLAG_ALIGN_RIGHT |
+ EWL_FLAG_ALIGN_BOTTOM | EWL_FLAG_ALIGN_TOP |
+ EWL_FLAG_ALIGN_CENTER);
+
+ while (req_align >= 0) {
+
+ ewl_border_label_alignment_set(EWL_BORDER(border), req_align);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != req_align) {
+ LOG_FAILURE(buf, len,
+ "border label alignment %x does not "
+ "match requested %x", align, req_align);
+ goto POSITION_ERROR;
+ }
+
+ --req_align;
+ }
+
+ ewl_border_label_alignment_set(EWL_BORDER(border),
+ EWL_FLAG_ALIGN_RIGHT);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_RIGHT) {
+ LOG_FAILURE(buf, len, "border label alignment not right");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_alignment_set(EWL_BORDER(border),
+ EWL_FLAG_ALIGN_BOTTOM);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_BOTTOM) {
+ LOG_FAILURE(buf, len, "border label alignment not bottom");
+ goto POSITION_ERROR;
+ }
+
+ ewl_border_label_alignment_set(EWL_BORDER(border),
+ EWL_FLAG_ALIGN_TOP);
+ align = ewl_border_label_alignment_get(EWL_BORDER(border));
+ if (align != EWL_FLAG_ALIGN_TOP) {
+ LOG_FAILURE(buf, len, "border label alignment not top");
+ goto POSITION_ERROR;
+ }
+
+ ret = 1;
+
+POSITION_ERROR:
ewl_widget_destroy(border);
return ret;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs