Index: uspace/lib/ui/test/window.c
===================================================================
--- uspace/lib/ui/test/window.c	(revision f7a90df6adfcf1a8e402e71eed9795cd4e9eabf6)
+++ uspace/lib/ui/test/window.c	(revision d284ce9c9580c7380258756c41f4a9b67073797c)
@@ -27,7 +27,11 @@
  */
 
+#include <gfx/context.h>
+#include <gfx/coord.h>
+#include <io/pos_event.h>
 #include <mem.h>
 #include <pcut/pcut.h>
 #include <stdbool.h>
+#include <ui/resource.h>
 #include <ui/ui.h>
 #include <ui/window.h>
@@ -38,4 +42,21 @@
 PCUT_TEST_SUITE(window);
 
+static void test_window_close(ui_window_t *, void *);
+static void test_window_pos(ui_window_t *, void *, pos_event_t *);
+
+static ui_window_cb_t test_window_cb = {
+	.close = test_window_close,
+	.pos = test_window_pos
+};
+
+static ui_window_cb_t dummy_window_cb = {
+};
+
+typedef struct {
+	bool close;
+	bool pos;
+	pos_event_t pos_event;
+} test_cb_resp_t;
+
 /** Create and destroy window */
 PCUT_TEST(create_destroy)
@@ -43,11 +64,11 @@
 	errno_t rc;
 	ui_t *ui = NULL;
-	ui_window_params_t params;
-	ui_window_t *window = NULL;
-
-	rc = ui_create_disp(NULL, &ui);
-	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
-
-	ui_window_params_init(&params);
+	ui_wnd_params_t params;
+	ui_window_t *window = NULL;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_wnd_params_init(&params);
 	params.caption = "Hello";
 
@@ -66,3 +87,136 @@
 }
 
+/** ui_window_get_res/gc/rect() return valid objects */
+PCUT_TEST(get_res_gc_rect)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_wnd_params_t params;
+	ui_window_t *window = NULL;
+	ui_resource_t *res;
+	gfx_context_t *gc;
+	gfx_rect_t rect;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_wnd_params_init(&params);
+	params.caption = "Hello";
+
+	rc = ui_window_create(ui, &params, &window);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(window);
+
+	res = ui_window_get_res(window);
+	PCUT_ASSERT_NOT_NULL(res);
+
+	gc = ui_window_get_gc(window);
+	PCUT_ASSERT_NOT_NULL(gc);
+
+	ui_window_get_app_rect(window, &rect);
+
+	ui_window_destroy(window);
+	ui_destroy(ui);
+}
+
+/** ui_window_close() calls close callback set via ui_window_set_cb() */
+PCUT_TEST(close)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_wnd_params_t params;
+	ui_window_t *window = NULL;
+	test_cb_resp_t resp;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_wnd_params_init(&params);
+	params.caption = "Hello";
+
+	rc = ui_window_create(ui, &params, &window);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(window);
+
+	/* Close callback with no callbacks set */
+	ui_window_close(window);
+
+	/* Close callback with close callback not implemented */
+	ui_window_set_cb(window, &dummy_window_cb, NULL);
+	ui_window_close(window);
+
+	/* Close callback with real callback set */
+	resp.close = false;
+	ui_window_set_cb(window, &test_window_cb, &resp);
+	ui_window_close(window);
+	PCUT_ASSERT_TRUE(resp.close);
+
+	ui_window_destroy(window);
+	ui_destroy(ui);
+}
+
+/** ui_window_pos() calls pos callback set via ui_window_set_cb() */
+PCUT_TEST(pos)
+{
+	errno_t rc;
+	ui_t *ui = NULL;
+	ui_wnd_params_t params;
+	ui_window_t *window = NULL;
+	pos_event_t pos_event;
+	test_cb_resp_t resp;
+
+	rc = ui_create_disp(NULL, &ui);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	ui_wnd_params_init(&params);
+	params.caption = "Hello";
+
+	rc = ui_window_create(ui, &params, &window);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(window);
+
+	pos_event.pos_id = 1;
+	pos_event.type = POS_PRESS;
+	pos_event.btn_num = 2;
+	pos_event.hpos = 3;
+	pos_event.vpos = 4;
+
+	/* Pos callback with no callbacks set */
+	ui_window_pos(window, &pos_event);
+
+	/* Pos callback with pos callback not implemented */
+	ui_window_set_cb(window, &dummy_window_cb, NULL);
+	ui_window_pos(window, &pos_event);
+
+	/* Pos callback with real callback set */
+	resp.pos = false;
+	ui_window_set_cb(window, &test_window_cb, &resp);
+	ui_window_pos(window, &pos_event);
+	PCUT_ASSERT_TRUE(resp.pos);
+	PCUT_ASSERT_INT_EQUALS(pos_event.pos_id, resp.pos_event.pos_id);
+	PCUT_ASSERT_EQUALS(pos_event.type, resp.pos_event.type);
+	PCUT_ASSERT_INT_EQUALS(pos_event.btn_num, resp.pos_event.btn_num);
+	PCUT_ASSERT_INT_EQUALS(pos_event.hpos, resp.pos_event.hpos);
+	PCUT_ASSERT_INT_EQUALS(pos_event.vpos, resp.pos_event.vpos);
+
+	ui_window_destroy(window);
+	ui_destroy(ui);
+}
+
+static void test_window_close(ui_window_t *window, void *arg)
+{
+	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
+
+	resp->close = true;
+}
+
+static void test_window_pos(ui_window_t *window, void *arg,
+    pos_event_t *event)
+{
+	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
+
+	resp->pos = true;
+	resp->pos_event = *event;
+}
+
 PCUT_EXPORT(window);
