2018-12-15 17:22:05 +08:00
|
|
|
|
#include "tkc/mem.h"
|
2018-06-12 16:02:24 +08:00
|
|
|
|
#include "base/events.h"
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
|
|
TEST(Events, pointer_event_rotate) {
|
|
|
|
|
system_info_t info;
|
|
|
|
|
info.lcd_w = 320;
|
|
|
|
|
info.lcd_h = 480;
|
|
|
|
|
pointer_event_t e;
|
|
|
|
|
|
|
|
|
|
e.x = 10;
|
|
|
|
|
e.y = 20;
|
|
|
|
|
info.lcd_orientation = LCD_ORIENTATION_0;
|
|
|
|
|
ASSERT_EQ(pointer_event_rotate(&e, &info), RET_OK);
|
|
|
|
|
ASSERT_EQ(e.x, 10);
|
|
|
|
|
ASSERT_EQ(e.y, 20);
|
|
|
|
|
|
|
|
|
|
e.x = 10;
|
|
|
|
|
e.y = 20;
|
|
|
|
|
info.lcd_orientation = LCD_ORIENTATION_90;
|
|
|
|
|
ASSERT_EQ(pointer_event_rotate(&e, &info), RET_OK);
|
|
|
|
|
ASSERT_EQ(e.y, 10);
|
2018-06-13 10:27:14 +08:00
|
|
|
|
ASSERT_EQ(e.x, info.lcd_h - 20 - 1);
|
2018-06-12 16:02:24 +08:00
|
|
|
|
}
|