Index: uspace/lib/ui/test/wdecor.c
===================================================================
--- uspace/lib/ui/test/wdecor.c	(revision d8ddf7a17eaf0cf4fee87a5efb1faca4bb6562b2)
+++ uspace/lib/ui/test/wdecor.c	(revision 2d879f7e702c10a9b3cc8fe266982c468d020f00)
@@ -60,8 +60,13 @@
 static void test_wdecor_close(ui_wdecor_t *, void *);
 static void test_wdecor_move(ui_wdecor_t *, void *, gfx_coord2_t *);
+static void test_wdecor_resize(ui_wdecor_t *, void *, ui_wdecor_rsztype_t,
+    gfx_coord2_t *);
+static void test_wdecor_set_cursor(ui_wdecor_t *, void *, ui_stock_cursor_t);
 
 static ui_wdecor_cb_t test_wdecor_cb = {
 	.close = test_wdecor_close,
-	.move = test_wdecor_move
+	.move = test_wdecor_move,
+	.resize = test_wdecor_resize,
+	.set_cursor = test_wdecor_set_cursor
 };
 
@@ -90,4 +95,8 @@
 	bool move;
 	gfx_coord2_t pos;
+	bool resize;
+	ui_wdecor_rsztype_t rsztype;
+	bool set_cursor;
+	ui_stock_cursor_t cursor;
 } test_cb_resp_t;
 
@@ -98,5 +107,5 @@
 	errno_t rc;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 	PCUT_ASSERT_NOT_NULL(wdecor);
@@ -118,5 +127,5 @@
 	errno_t rc;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -141,5 +150,5 @@
 	errno_t rc;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -172,5 +181,5 @@
 	PCUT_ASSERT_NOT_NULL(resource);
 
-	rc = ui_wdecor_create(resource, "Hello", &wdecor);
+	rc = ui_wdecor_create(resource, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -192,5 +201,5 @@
 	test_cb_resp_t resp;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -219,5 +228,5 @@
 	gfx_coord2_t pos;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -245,4 +254,73 @@
 }
 
+/** Test ui_wdecor_resize() */
+PCUT_TEST(resize)
+{
+	errno_t rc;
+	ui_wdecor_t *wdecor;
+	test_cb_resp_t resp;
+	ui_wdecor_rsztype_t rsztype;
+	gfx_coord2_t pos;
+
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rsztype = ui_wr_bottom;
+	pos.x = 3;
+	pos.y = 4;
+
+	/* Resize callback with no callbacks set */
+	ui_wdecor_resize(wdecor, rsztype, &pos);
+
+	/* Resize callback with move callback not implemented */
+	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
+	ui_wdecor_resize(wdecor, rsztype, &pos);
+
+	/* Resize callback with real callback set */
+	resp.resize = false;
+	resp.rsztype = ui_wr_none;
+	resp.pos.x = 0;
+	resp.pos.y = 0;
+	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
+	ui_wdecor_resize(wdecor, rsztype, &pos);
+	PCUT_ASSERT_TRUE(resp.resize);
+	PCUT_ASSERT_INT_EQUALS(rsztype, resp.rsztype);
+	PCUT_ASSERT_INT_EQUALS(pos.x, resp.pos.x);
+	PCUT_ASSERT_INT_EQUALS(pos.y, resp.pos.y);
+
+	ui_wdecor_destroy(wdecor);
+}
+
+/** Test ui_wdecor_set_cursor() */
+PCUT_TEST(set_cursor)
+{
+	errno_t rc;
+	ui_wdecor_t *wdecor;
+	test_cb_resp_t resp;
+	ui_stock_cursor_t cursor;
+
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	cursor = ui_curs_size_uldr;
+
+	/* Set cursor callback with no callbacks set */
+	ui_wdecor_set_cursor(wdecor, cursor);
+
+	/* Set cursor callback with move callback not implemented */
+	ui_wdecor_set_cb(wdecor, &dummy_wdecor_cb, NULL);
+	ui_wdecor_set_cursor(wdecor, cursor);
+
+	/* Set cursor callback with real callback set */
+	resp.set_cursor = false;
+	resp.cursor = ui_curs_arrow;
+	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
+	ui_wdecor_set_cursor(wdecor, cursor);
+	PCUT_ASSERT_TRUE(resp.set_cursor);
+	PCUT_ASSERT_INT_EQUALS(cursor, resp.cursor);
+
+	ui_wdecor_destroy(wdecor);
+}
+
 /** Clicking the close button generates close callback */
 PCUT_TEST(close_btn_clicked)
@@ -253,5 +331,5 @@
 	errno_t rc;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -282,5 +360,5 @@
 	errno_t rc;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -318,5 +396,5 @@
 	errno_t rc;
 
-	rc = ui_wdecor_create(NULL, "Hello", &wdecor);
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -369,4 +447,181 @@
 	PCUT_ASSERT_INT_EQUALS(100, rect.p1.x);
 	PCUT_ASSERT_INT_EQUALS(200, rect.p1.y);
+}
+
+/** Test ui_wdecor_get_rsztype() */
+PCUT_TEST(get_rsztype)
+{
+	ui_wdecor_t *wdecor;
+	gfx_rect_t rect;
+	ui_wdecor_rsztype_t rsztype;
+	gfx_coord2_t pos;
+	errno_t rc;
+
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_resizable, &wdecor);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rect.p0.x = 10;
+	rect.p0.y = 20;
+	rect.p1.x = 100;
+	rect.p1.y = 200;
+
+	ui_wdecor_set_rect(wdecor, &rect);
+
+	/* Outside of the window */
+	pos.x = 0;
+	pos.y = -1;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
+
+	/* Middle of the window */
+	pos.x = 50;
+	pos.y = 100;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
+
+	/* Top-left corner, but not on edge */
+	pos.x = 20;
+	pos.y = 30;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
+
+	/* Top-left corner on top edge */
+	pos.x = 20;
+	pos.y = 20;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_top_left, rsztype);
+
+	/* Top-left corner on left edge */
+	pos.x = 10;
+	pos.y = 30;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_top_left, rsztype);
+
+	/* Top-right corner on top edge */
+	pos.x = 90;
+	pos.y = 20;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_top_right, rsztype);
+
+	/* Top-right corner on right edge */
+	pos.x = 99;
+	pos.y = 30;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_top_right, rsztype);
+
+	/* Top edge */
+	pos.x = 50;
+	pos.y = 20;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_top, rsztype);
+
+	/* Bottom edge */
+	pos.x = 50;
+	pos.y = 199;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_bottom, rsztype);
+
+	/* Left edge */
+	pos.x = 10;
+	pos.y = 100;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_left, rsztype);
+
+	/* Right edge */
+	pos.x = 99;
+	pos.y = 100;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_right, rsztype);
+
+	ui_wdecor_destroy(wdecor);
+
+	/* Non-resizable window */
+
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_none, &wdecor);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rect.p0.x = 10;
+	rect.p0.y = 20;
+	rect.p1.x = 100;
+	rect.p1.y = 200;
+
+	ui_wdecor_set_rect(wdecor, &rect);
+
+	pos.x = 10;
+	pos.y = 20;
+	rsztype = ui_wdecor_get_rsztype(wdecor, &pos);
+	PCUT_ASSERT_EQUALS(ui_wr_none, rsztype);
+
+	ui_wdecor_destroy(wdecor);
+}
+
+/** Test ui_wdecor_cursor_from_rsztype() */
+PCUT_TEST(cursor_from_rsztype)
+{
+	PCUT_ASSERT_EQUALS(ui_curs_arrow,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_none));
+	PCUT_ASSERT_EQUALS(ui_curs_size_ud,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_top));
+	PCUT_ASSERT_EQUALS(ui_curs_size_ud,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_bottom));
+	PCUT_ASSERT_EQUALS(ui_curs_size_lr,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_left));
+	PCUT_ASSERT_EQUALS(ui_curs_size_lr,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_right));
+	PCUT_ASSERT_EQUALS(ui_curs_size_uldr,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_top_left));
+	PCUT_ASSERT_EQUALS(ui_curs_size_uldr,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_bottom_right));
+	PCUT_ASSERT_EQUALS(ui_curs_size_urdl,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_top_right));
+	PCUT_ASSERT_EQUALS(ui_curs_size_urdl,
+	    ui_wdecor_cursor_from_rsztype(ui_wr_bottom_left));
+}
+
+/** Test ui_wdecor_frame_pos_event() */
+PCUT_TEST(frame_pos_event)
+{
+	ui_wdecor_t *wdecor;
+	gfx_rect_t rect;
+	test_cb_resp_t resp;
+	pos_event_t event;
+	errno_t rc;
+
+	rc = ui_wdecor_create(NULL, "Hello", ui_wds_resizable, &wdecor);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rect.p0.x = 10;
+	rect.p0.y = 20;
+	rect.p1.x = 100;
+	rect.p1.y = 200;
+
+	ui_wdecor_set_rect(wdecor, &rect);
+	ui_wdecor_set_cb(wdecor, &test_wdecor_cb, &resp);
+
+	/* Release on window border should do nothing */
+	resp.resize = false;
+	event.type = POS_RELEASE;
+	event.hpos = 10;
+	event.vpos = 10;
+	ui_wdecor_frame_pos_event(wdecor, &event);
+	PCUT_ASSERT_FALSE(resp.resize);
+
+	/* Press in the middle of the window should do nothing */
+	resp.resize = false;
+	event.type = POS_PRESS;
+	event.hpos = 50;
+	event.vpos = 100;
+	ui_wdecor_frame_pos_event(wdecor, &event);
+	PCUT_ASSERT_FALSE(resp.resize);
+
+	/* Press on window border should cause resize to be called */
+	resp.resize = false;
+	event.type = POS_PRESS;
+	event.hpos = 10;
+	event.vpos = 20;
+	ui_wdecor_frame_pos_event(wdecor, &event);
+	PCUT_ASSERT_TRUE(resp.resize);
+
+	ui_wdecor_destroy(wdecor);
 }
 
@@ -462,3 +717,22 @@
 }
 
+static void test_wdecor_resize(ui_wdecor_t *wdecor, void *arg,
+    ui_wdecor_rsztype_t rsztype, gfx_coord2_t *pos)
+{
+	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
+
+	resp->resize = true;
+	resp->rsztype = rsztype;
+	resp->pos = *pos;
+}
+
+static void test_wdecor_set_cursor(ui_wdecor_t *wdecor, void *arg,
+    ui_stock_cursor_t cursor)
+{
+	test_cb_resp_t *resp = (test_cb_resp_t *) arg;
+
+	resp->set_cursor = true;
+	resp->cursor = cursor;
+}
+
 PCUT_EXPORT(wdecor);
