mirror of
https://github.com/zlgopen/awtk.git
synced 2025-05-08 19:44:45 +08:00
format code
This commit is contained in:
parent
fd2f41b5cc
commit
df8ae00455
@ -242,7 +242,7 @@ ret_t assets_init_default(void) {
|
||||
#endif /*WITH_VGCANVAS*/
|
||||
#ifdef WITH_TRUETYPE_FONT
|
||||
assets_manager_add(am, font_default);
|
||||
#else /*WITH_TRUETYPE_FONT*/
|
||||
#else /*WITH_TRUETYPE_FONT*/
|
||||
#endif /*WITH_TRUETYPE_FONT*/
|
||||
#endif
|
||||
|
||||
@ -366,7 +366,7 @@ extern TK_CONST_DATA_ALIGN(const unsigned char image_uiex_Windowclosed_p[]);
|
||||
#endif /*WITH_VGCANVAS*/
|
||||
#ifdef WITH_TRUETYPE_FONT
|
||||
extern TK_CONST_DATA_ALIGN(const unsigned char font_default[]);
|
||||
#else /*WITH_TRUETYPE_FONT*/
|
||||
#else /*WITH_TRUETYPE_FONT*/
|
||||
#endif /*WITH_TRUETYPE_FONT*/
|
||||
#endif /*WITH_FS_RES*/
|
||||
|
||||
@ -488,7 +488,7 @@ ret_t assets_init_dark(void) {
|
||||
#endif /*WITH_VGCANVAS*/
|
||||
#ifdef WITH_TRUETYPE_FONT
|
||||
assets_manager_add(am, font_default);
|
||||
#else /*WITH_TRUETYPE_FONT*/
|
||||
#else /*WITH_TRUETYPE_FONT*/
|
||||
#endif /*WITH_TRUETYPE_FONT*/
|
||||
#endif
|
||||
|
||||
@ -568,7 +568,7 @@ static ret_t widget_set_theme_without_file_system(widget_t* widget, const char*
|
||||
ret_t assets_set_global_theme(const char* name) {
|
||||
#ifdef WITH_FS_RES
|
||||
return widget_set_theme(window_manager(), name);
|
||||
#else /*WITH_FS_RES*/
|
||||
#else /*WITH_FS_RES*/
|
||||
return widget_set_theme_without_file_system(window_manager(), name);
|
||||
#endif /*WITH_FS_RES*/
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "awtk.h"
|
||||
#ifdef AWTK_WEB
|
||||
#include "assets.inc"
|
||||
#else /*AWTK_WEB*/
|
||||
#else /*AWTK_WEB*/
|
||||
#include "../res/assets.inc"
|
||||
#endif /*AWTK_WEB*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "awtk.h"
|
||||
#ifdef AWTK_WEB
|
||||
#include "assets.inc"
|
||||
#else /*AWTK_WEB*/
|
||||
#else /*AWTK_WEB*/
|
||||
#include "../res/assets_all.inc"
|
||||
#endif /*AWTK_WEB*/
|
||||
|
@ -320,7 +320,7 @@
|
||||
#endif /*WITH_VGCANVAS*/
|
||||
#if defined(WITH_STB_FONT) || defined(WITH_FT_FONT)
|
||||
#include "../res/assets/default/inc/fonts/default.res"
|
||||
#else /*WITH_STB_FONT or WITH_FT_FONT*/
|
||||
#else /*WITH_STB_FONT or WITH_FT_FONT*/
|
||||
#include "../res/assets/default/inc/fonts/default.data"
|
||||
#endif /*WITH_STB_FONT or WITH_FT_FONT*/
|
||||
#endif /*WITH_FS_RES*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "awtk.h"
|
||||
#ifdef AWTK_WEB
|
||||
#include "assets.inc"
|
||||
#else /*AWTK_WEB*/
|
||||
#else /*AWTK_WEB*/
|
||||
#include "../res/assets_old.inc"
|
||||
#endif /*AWTK_WEB*/
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define PAGE_NUM 18
|
||||
#if !defined(PAGE_NUM) || PAGE_NUM <= 0
|
||||
#error "PAGE_NUM not define or less than or equal to zero!"
|
||||
#endif /* PAGE_NUM */
|
||||
#endif /* PAGE_NUM */
|
||||
|
||||
#define LANDSCAPE_WIDTH_THRESHOLD 540 /* 横屏窗口阈值 */
|
||||
|
||||
|
@ -108,11 +108,13 @@
|
||||
static ret_t tk_add_font(const asset_info_t* res) {
|
||||
if (res->subtype == ASSET_TYPE_FONT_BMP) {
|
||||
#ifdef WITH_BITMAP_FONT
|
||||
font_manager_add_font(font_manager(), font_bitmap_create(asset_info_get_name(res), res->data, res->size));
|
||||
font_manager_add_font(font_manager(),
|
||||
font_bitmap_create(asset_info_get_name(res), res->data, res->size));
|
||||
#endif
|
||||
} else if (res->subtype == ASSET_TYPE_FONT_TTF) {
|
||||
#ifdef WITH_TRUETYPE_FONT
|
||||
font_manager_add_font(font_manager(), font_truetype_create(asset_info_get_name(res), res->data, res->size));
|
||||
font_manager_add_font(font_manager(),
|
||||
font_truetype_create(asset_info_get_name(res), res->data, res->size));
|
||||
#endif /*WITH_TRUETYPE_FONT*/
|
||||
} else {
|
||||
log_debug("not support font type:%d\n", res->subtype);
|
||||
|
@ -393,7 +393,8 @@ const key_type_value_t* input_type_find(const char* name) {
|
||||
}
|
||||
|
||||
const key_type_value_t* easing_type_find(const char* name) {
|
||||
const key_type_value_t* kv = find_item(easing_type_name_value, ARRAY_SIZE(easing_type_name_value), name);
|
||||
const key_type_value_t* kv =
|
||||
find_item(easing_type_name_value, ARRAY_SIZE(easing_type_name_value), name);
|
||||
if (kv != NULL) {
|
||||
return kv;
|
||||
} else {
|
||||
@ -407,11 +408,13 @@ const key_type_value_t* easing_type_find(const char* name) {
|
||||
}
|
||||
|
||||
const key_type_value_t* easing_type_find_by_value(uint32_t value) {
|
||||
const key_type_value_t* kv = find_item_by_value(easing_type_name_value, ARRAY_SIZE(easing_type_name_value), value);
|
||||
const key_type_value_t* kv =
|
||||
find_item_by_value(easing_type_name_value, ARRAY_SIZE(easing_type_name_value), value);
|
||||
if (kv != NULL) {
|
||||
return kv;
|
||||
} else {
|
||||
easing_name_func_t* easing_name_func = darray_get(easing_name_func_darray(), value - EASING_FUNC_NR - 1);
|
||||
easing_name_func_t* easing_name_func =
|
||||
darray_get(easing_name_func_darray(), value - EASING_FUNC_NR - 1);
|
||||
if (easing_name_func != NULL) {
|
||||
return easing_name_func->type_name_value;
|
||||
} else {
|
||||
|
@ -40,8 +40,7 @@ typedef struct _bitmap_header_t {
|
||||
uint8_t data[4];
|
||||
} bitmap_header_t;
|
||||
|
||||
typedef ret_t (*image_manager_get_bitmap_t)(void* ctx, const char* name,
|
||||
bitmap_t* image);
|
||||
typedef ret_t (*image_manager_get_bitmap_t)(void* ctx, const char* name, bitmap_t* image);
|
||||
|
||||
/**
|
||||
* @class image_manager_t
|
||||
|
@ -200,7 +200,8 @@ ret_t locale_info_set_fallback_tr(locale_info_t* locale_info, locale_info_tr_t t
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t locale_info_set_fallback_tr2(locale_info_t* locale_info, locale_info_tr_with_context_t tr, void* ctx);
|
||||
ret_t locale_info_set_fallback_tr2(locale_info_t* locale_info, locale_info_tr_with_context_t tr,
|
||||
void* ctx);
|
||||
|
||||
/**
|
||||
* @method locale_info_set_custom_tr
|
||||
@ -212,7 +213,8 @@ ret_t locale_info_set_fallback_tr2(locale_info_t* locale_info, locale_info_tr_wi
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t locale_info_set_custom_tr(locale_info_t* locale_info, locale_info_tr_with_context_t tr, void* ctx);
|
||||
ret_t locale_info_set_custom_tr(locale_info_t* locale_info, locale_info_tr_with_context_t tr,
|
||||
void* ctx);
|
||||
|
||||
/**
|
||||
* @method locale_info_destroy
|
||||
|
@ -207,8 +207,10 @@ ret_t vg_gradient_destroy(vg_gradient_t* gradient);
|
||||
|
||||
#define vg_gradient_add_stop(gradient, color, stop) \
|
||||
gradient_add_stop((gradient_t*)(gradient), color, stop)
|
||||
#define vg_gradient_get_stop(gradient, index) gradient_get_stop((const gradient_t*)(gradient), index)
|
||||
#define vg_gradient_get_first_color(gradient) gradient_get_first_color((const gradient_t*)(gradient))
|
||||
#define vg_gradient_get_stop(gradient, index) \
|
||||
gradient_get_stop((const gradient_t*)(gradient), index)
|
||||
#define vg_gradient_get_first_color(gradient) \
|
||||
gradient_get_first_color((const gradient_t*)(gradient))
|
||||
#define vg_gradient_get_last_color(gradient) gradient_get_last_color((const gradient_t*)(gradient))
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -2199,7 +2199,7 @@ ret_t widget_set_prop(widget_t* widget, const char* name, const value_t* v) {
|
||||
ret = RET_NOT_FOUND;
|
||||
} else if (tk_str_start_with(name, "style:") || tk_str_start_with(name, "style.")) {
|
||||
return widget_set_style(widget, name + 6, v);
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_DIRTY_RECT)) {
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_DIRTY_RECT)) {
|
||||
return RET_FAIL;
|
||||
} else {
|
||||
if (widget->custom_props == NULL) {
|
||||
@ -4408,8 +4408,8 @@ static bool_t match_left(const rect_t* widget, const rect_t* last_matched, const
|
||||
}
|
||||
} else if (is_same_row(widget, last_matched)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 只有在候选控件在当前控件上方才判断距离远近
|
||||
if (widget->y >= iter->y) {
|
||||
return last_matched ? distance2(widget, iter) < distance2(widget, last_matched) : TRUE;
|
||||
|
@ -1073,7 +1073,7 @@ BEGIN_C_DECLS
|
||||
* @const WIDGET_PROP_DIRTY_RECT
|
||||
* 控件脏矩形区域。
|
||||
*/
|
||||
#define WIDGET_PROP_DIRTY_RECT "dirty_rect"
|
||||
#define WIDGET_PROP_DIRTY_RECT "dirty_rect"
|
||||
|
||||
/**
|
||||
* @enum widget_type_t
|
||||
|
@ -135,7 +135,7 @@ typedef unsigned int pg_wchar;
|
||||
#define LC_ISO8859_2 0x82 /* ISO8859 Latin 2 */
|
||||
#define LC_ISO8859_3 0x83 /* ISO8859 Latin 3 */
|
||||
#define LC_ISO8859_4 0x84 /* ISO8859 Latin 4 */
|
||||
#define LC_TIS620 0x85 /* Thai (not supported yet) */
|
||||
#define LC_TIS620 0x85 /* Thai (not supported yet) */
|
||||
#define LC_ISO8859_7 0x86 /* Greek (not supported yet) */
|
||||
#define LC_ISO8859_6 0x87 /* Arabic (not supported yet) */
|
||||
#define LC_ISO8859_8 0x88 /* Hebrew (not supported yet) */
|
||||
@ -145,9 +145,9 @@ typedef unsigned int pg_wchar;
|
||||
* However, there might be a chance that 0x8b could be used
|
||||
* in later versions of Emacs.
|
||||
*/
|
||||
#define LC_KOI8_R 0x8b /* Cyrillic KOI8-R */
|
||||
#define LC_ISO8859_5 0x8c /* ISO8859 Cyrillic */
|
||||
#define LC_ISO8859_9 0x8d /* ISO8859 Latin 5 (not supported yet) */
|
||||
#define LC_KOI8_R 0x8b /* Cyrillic KOI8-R */
|
||||
#define LC_ISO8859_5 0x8c /* ISO8859 Cyrillic */
|
||||
#define LC_ISO8859_9 0x8d /* ISO8859 Latin 5 (not supported yet) */
|
||||
#define LC_ISO8859_15 0x8e /* ISO8859 Latin 15 (not supported yet) */
|
||||
/* #define CONTROL_1 0x8f control characters (unused) */
|
||||
|
||||
@ -159,17 +159,17 @@ typedef unsigned int pg_wchar;
|
||||
* 0x9a-0x9d are free. 0x9e and 0x9f are reserved.
|
||||
*/
|
||||
#define LC_JISX0208_1978 0x90 /* Japanese Kanji, old JIS (not supported) */
|
||||
#define LC_GB2312_80 0x91 /* Chinese */
|
||||
#define LC_JISX0208 0x92 /* Japanese Kanji (JIS X 0208) */
|
||||
#define LC_KS5601 0x93 /* Korean */
|
||||
#define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */
|
||||
#define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */
|
||||
#define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */
|
||||
#define LC_GB2312_80 0x91 /* Chinese */
|
||||
#define LC_JISX0208 0x92 /* Japanese Kanji (JIS X 0208) */
|
||||
#define LC_KS5601 0x93 /* Korean */
|
||||
#define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */
|
||||
#define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */
|
||||
#define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */
|
||||
#define LC_JISX0213_1 \
|
||||
0x97 /* Japanese Kanji (JIS X 0213 Plane 1) (not
|
||||
0x97 /* Japanese Kanji (JIS X 0213 Plane 1) (not
|
||||
* supported) */
|
||||
#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not supported) */
|
||||
#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not supported) */
|
||||
#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not supported) */
|
||||
#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not supported) */
|
||||
|
||||
/* Is a leading byte for "official" multibyte encodings? */
|
||||
#define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99)
|
||||
@ -198,25 +198,25 @@ typedef unsigned int pg_wchar;
|
||||
* Charset IDs for private single byte encodings (0xa0-0xef)
|
||||
*/
|
||||
#define LC_SISHENG \
|
||||
0xa0 /* Chinese SiSheng characters for
|
||||
0xa0 /* Chinese SiSheng characters for
|
||||
* PinYin/ZhuYin (not supported) */
|
||||
#define LC_IPA \
|
||||
0xa1 /* IPA (International Phonetic Association)
|
||||
0xa1 /* IPA (International Phonetic Association)
|
||||
* (not supported) */
|
||||
#define LC_VISCII_LOWER \
|
||||
0xa2 /* Vietnamese VISCII1.1 lower-case (not
|
||||
0xa2 /* Vietnamese VISCII1.1 lower-case (not
|
||||
* supported) */
|
||||
#define LC_VISCII_UPPER \
|
||||
0xa3 /* Vietnamese VISCII1.1 upper-case (not
|
||||
0xa3 /* Vietnamese VISCII1.1 upper-case (not
|
||||
* supported) */
|
||||
#define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */
|
||||
#define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */
|
||||
#define LC_ARABIC_1_COLUMN 0xa5 /* Arabic 1-column (not supported) */
|
||||
#define LC_ASCII_RIGHT_TO_LEFT \
|
||||
0xa6 /* ASCII (left half of ISO8859-1) with
|
||||
0xa6 /* ASCII (left half of ISO8859-1) with
|
||||
* right-to-left direction (not
|
||||
* supported) */
|
||||
#define LC_LAO \
|
||||
0xa7 /* Lao characters (ISO10646 0E80..0EDF) (not
|
||||
0xa7 /* Lao characters (ISO10646 0E80..0EDF) (not
|
||||
* supported) */
|
||||
#define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */
|
||||
|
||||
@ -224,30 +224,30 @@ typedef unsigned int pg_wchar;
|
||||
* Charset IDs for private multibyte encodings (0xf0-0xff)
|
||||
*/
|
||||
#define LC_INDIAN_1_COLUMN \
|
||||
0xf0 /* Indian charset for 1-column width glyphs
|
||||
0xf0 /* Indian charset for 1-column width glyphs
|
||||
* (not supported) */
|
||||
#define LC_TIBETAN_1_COLUMN \
|
||||
0xf1 /* Tibetan 1-column width glyphs (not
|
||||
0xf1 /* Tibetan 1-column width glyphs (not
|
||||
* supported) */
|
||||
#define LC_UNICODE_SUBSET_2 \
|
||||
0xf2 /* Unicode characters of the range
|
||||
0xf2 /* Unicode characters of the range
|
||||
* U+2500..U+33FF. (not supported) */
|
||||
#define LC_UNICODE_SUBSET_3 \
|
||||
0xf3 /* Unicode characters of the range
|
||||
0xf3 /* Unicode characters of the range
|
||||
* U+E000..U+FFFF. (not supported) */
|
||||
#define LC_UNICODE_SUBSET \
|
||||
0xf4 /* Unicode characters of the range
|
||||
0xf4 /* Unicode characters of the range
|
||||
* U+0100..U+24FF. (not supported) */
|
||||
#define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */
|
||||
#define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */
|
||||
#define LC_CNS11643_3 0xf6 /* CNS 11643-1992 Plane 3 */
|
||||
#define LC_CNS11643_4 0xf7 /* CNS 11643-1992 Plane 4 */
|
||||
#define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */
|
||||
#define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */
|
||||
#define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */
|
||||
#define LC_INDIAN_2_COLUMN \
|
||||
0xfb /* Indian charset for 2-column width glyphs
|
||||
0xfb /* Indian charset for 2-column width glyphs
|
||||
* (not supported) */
|
||||
#define LC_TIBETAN 0xfc /* Tibetan (not supported) */
|
||||
#define LC_TIBETAN 0xfc /* Tibetan (not supported) */
|
||||
/* #define FREE 0xfd free (unused) */
|
||||
/* #define FREE 0xfe free (unused) */
|
||||
/* #define FREE 0xff free (unused) */
|
||||
|
@ -68,13 +68,13 @@ static ret_t svg_image_draw_type_ex(widget_t* widget, void* ctx) {
|
||||
break;
|
||||
}
|
||||
case IMAGE_DRAW_SCALE: {
|
||||
bsvg_t *bsvg = (bsvg_t*)ctx;
|
||||
bsvg_t* bsvg = (bsvg_t*)ctx;
|
||||
svg_image->scale_x = (float_t)((widget->w * 1.0f) / (bsvg->header->w * 1.0f));
|
||||
svg_image->scale_y = (float_t)((widget->h * 1.0f) / (bsvg->header->h * 1.0f));
|
||||
break;
|
||||
}
|
||||
case IMAGE_DRAW_SCALE_AUTO: {
|
||||
bsvg_t *bsvg = (bsvg_t*)ctx;
|
||||
bsvg_t* bsvg = (bsvg_t*)ctx;
|
||||
if (widget->w < widget->h) {
|
||||
svg_image->scale_x = (float_t)((widget->w * 1.0f) / (bsvg->header->w * 1.0f));
|
||||
svg_image->scale_y = svg_image->scale_x;
|
||||
@ -101,7 +101,7 @@ static ret_t svg_image_paint_before_adjust(widget_t* widget) {
|
||||
const asset_info_t* asset = svg_image->bsvg_asset;
|
||||
return_value_if_fail(asset != NULL && asset->data != NULL, RET_BAD_PARAMS);
|
||||
return_value_if_fail(bsvg_init(&bsvg, (const uint32_t*)asset->data, asset->size) != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
RET_BAD_PARAMS);
|
||||
|
||||
if (widget->w <= 0 || widget->h <= 0 || bsvg.header->w <= 0 || bsvg.header->h <= 0) {
|
||||
return RET_OK;
|
||||
@ -140,7 +140,7 @@ static ret_t svg_image_paint_online_canvas(widget_t* widget, canvas_t* c) {
|
||||
const asset_info_t* asset = svg_image->bsvg_asset;
|
||||
return_value_if_fail(asset != NULL && asset->data != NULL, RET_BAD_PARAMS);
|
||||
return_value_if_fail(bsvg_init(&bsvg, (const uint32_t*)asset->data, asset->size) != NULL,
|
||||
RET_BAD_PARAMS);
|
||||
RET_BAD_PARAMS);
|
||||
if (bsvg.header->w > 0 && bsvg.header->h > 0) {
|
||||
x = (widget->w - ((int32_t)bsvg.header->w * svg_image->scale_x)) / 2;
|
||||
y = (widget->h - ((int32_t)bsvg.header->h * svg_image->scale_y)) / 2;
|
||||
@ -304,11 +304,11 @@ static ret_t svg_image_set_prop(widget_t* widget, const char* name, const value_
|
||||
}
|
||||
}
|
||||
|
||||
static const char* s_svg_image_properties[] = {
|
||||
WIDGET_PROP_IMAGE, WIDGET_PROP_SCALE_X, WIDGET_PROP_SCALE_Y,
|
||||
WIDGET_PROP_ANCHOR_X, WIDGET_PROP_ANCHOR_Y, WIDGET_PROP_ROTATION,
|
||||
WIDGET_PROP_CLICKABLE, WIDGET_PROP_SELECTABLE, WIDGET_PROP_DRAW_TYPE,
|
||||
NULL };
|
||||
static const char* s_svg_image_properties[] = {WIDGET_PROP_IMAGE, WIDGET_PROP_SCALE_X,
|
||||
WIDGET_PROP_SCALE_Y, WIDGET_PROP_ANCHOR_X,
|
||||
WIDGET_PROP_ANCHOR_Y, WIDGET_PROP_ROTATION,
|
||||
WIDGET_PROP_CLICKABLE, WIDGET_PROP_SELECTABLE,
|
||||
WIDGET_PROP_DRAW_TYPE, NULL};
|
||||
|
||||
TK_DECL_VTABLE(svg_image) = {.size = sizeof(svg_image_t),
|
||||
.type = WIDGET_TYPE_SVG_IMAGE,
|
||||
|
@ -160,8 +160,8 @@ ret_t svg_image_set_draw_type(widget_t* widget, image_draw_type_t draw_type);
|
||||
*/
|
||||
widget_t* svg_image_cast(widget_t* widget);
|
||||
|
||||
#define WIDGET_TYPE_SVG_IMAGE "svg"
|
||||
#define SVG_IMAGE_CACHE_MODE "cache_mode"
|
||||
#define WIDGET_TYPE_SVG_IMAGE "svg"
|
||||
#define SVG_IMAGE_CACHE_MODE "cache_mode"
|
||||
|
||||
#define SVG_IMAGE(widget) ((svg_image_t*)(svg_image_cast(WIDGET(widget))))
|
||||
|
||||
|
@ -787,8 +787,8 @@ static ret_t func_show_fps(fscript_t* fscript, fscript_args_t* args, value_t* re
|
||||
|
||||
static ret_t func_set_screen_saver_time(fscript_t* fscript, fscript_args_t* args, value_t* result) {
|
||||
FSCRIPT_FUNC_CHECK(args->size == 1, RET_BAD_PARAMS);
|
||||
value_set_bool(result,
|
||||
window_manager_set_screen_saver_time(window_manager(), value_uint32(args->args)) == RET_OK);
|
||||
value_set_bool(result, window_manager_set_screen_saver_time(window_manager(),
|
||||
value_uint32(args->args)) == RET_OK);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
@ -139,4 +139,4 @@ extern int aw_kprintf(const char* fmt, ...);
|
||||
#ifndef __BUILDING_AWTK_LIB__
|
||||
#endif // __BUILDING_AWTK_LIB__
|
||||
|
||||
#endif /*AWTK_CONFIG_H*/
|
||||
#endif /*AWTK_CONFIG_H*/
|
||||
|
@ -282,7 +282,7 @@ tryagain:
|
||||
}
|
||||
return RET_FAIL;
|
||||
}
|
||||
#else // HAVE_SEM_TIMEDWAIT
|
||||
#else // HAVE_SEM_TIMEDWAIT
|
||||
|
||||
uint32_t start = time_now_ms();
|
||||
return_value_if_fail(semaphore != NULL, RET_BAD_PARAMS);
|
||||
|
@ -452,7 +452,6 @@ bool_t asset_info_is_in_rom(const asset_info_t* info);
|
||||
*/
|
||||
ret_t asset_info_set_is_in_rom(asset_info_t* info, bool_t is_in_rom);
|
||||
|
||||
|
||||
/* internal */
|
||||
ret_t asset_info_set_name(asset_info_t* info, const char* name, bool_t is_alloc);
|
||||
|
||||
|
@ -244,9 +244,8 @@ int easing_name_func_compare(const void* a, const void* b) {
|
||||
}
|
||||
|
||||
ret_t easing_init(void) {
|
||||
s_easing_name_func_darray =
|
||||
darray_create(0, easing_name_func_destroy, easing_name_func_compare);
|
||||
|
||||
s_easing_name_func_darray = darray_create(0, easing_name_func_destroy, easing_name_func_compare);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -259,8 +258,10 @@ ret_t easing_deinit(void) {
|
||||
easing_func_t easing_get(easing_type_t type) {
|
||||
if ((int)type >= EASING_LINEAR && type < EASING_FUNC_NR) {
|
||||
return s_easing_funcs[type];
|
||||
} else if ((int)type > EASING_FUNC_NR && (int)type <= EASING_FUNC_NR + s_easing_name_func_darray->size) {
|
||||
easing_name_func_t* easing_name_func = darray_get(s_easing_name_func_darray, type - EASING_FUNC_NR - 1);
|
||||
} else if ((int)type > EASING_FUNC_NR &&
|
||||
(int)type <= EASING_FUNC_NR + s_easing_name_func_darray->size) {
|
||||
easing_name_func_t* easing_name_func =
|
||||
darray_get(s_easing_name_func_darray, type - EASING_FUNC_NR - 1);
|
||||
return easing_name_func->easing_func;
|
||||
} else {
|
||||
return s_easing_funcs[EASING_LINEAR];
|
||||
@ -271,7 +272,8 @@ uint32_t easing_register(const char* type_name, easing_func_t easing_func) {
|
||||
easing_name_func_t* easing_name_func = TKMEM_ZALLOC(easing_name_func_t);
|
||||
easing_name_func->type_name_value = TKMEM_ZALLOC(key_type_value_t);
|
||||
|
||||
easing_name_func->type_name_value->name = tk_str_copy(easing_name_func->type_name_value->name, type_name);
|
||||
easing_name_func->type_name_value->name =
|
||||
tk_str_copy(easing_name_func->type_name_value->name, type_name);
|
||||
easing_name_func->type_name_value->value = EASING_FUNC_NR + s_easing_name_func_darray->size + 1;
|
||||
easing_name_func->easing_func = easing_func;
|
||||
|
||||
|
@ -44,8 +44,7 @@ static uint64_t s_debugger_thread_id = 0;
|
||||
ret_t log_notify_debugger(const char* format, ...) {
|
||||
va_list va;
|
||||
|
||||
if (s_log_buff != NULL && s_debugger_log != NULL
|
||||
&& s_debugger_thread_id == tk_thread_self()) {
|
||||
if (s_log_buff != NULL && s_debugger_log != NULL && s_debugger_thread_id == tk_thread_self()) {
|
||||
va_start(va, format);
|
||||
*s_log_buff = '\0';
|
||||
tk_vsnprintf(s_log_buff, TK_LOG_BUFF_SIZE, format, va);
|
||||
@ -79,4 +78,4 @@ ret_t log_notify_debugger(const char* format, ...) {
|
||||
ret_t log_set_debugger_hook(tk_debugger_log_t log, void* ctx) {
|
||||
return RET_OK;
|
||||
}
|
||||
#endif/*WITHOUT_FSCRIPT*/
|
||||
#endif /*WITHOUT_FSCRIPT*/
|
||||
|
@ -170,44 +170,44 @@ ret_t log_set_debugger_hook(tk_debugger_log_t log, void* ctx);
|
||||
#include "android/log.h"
|
||||
#define log_debug(...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_DEBUG) { \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
__android_log_print(ANDROID_LOG_DEBUG, "AWTK", __VA_ARGS__); \
|
||||
}
|
||||
#define log_info(...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_INFO) { \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
__android_log_print(ANDROID_LOG_INFO, "AWTK", __VA_ARGS__); \
|
||||
}
|
||||
#define log_warn(...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_WARN) { \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
__android_log_print(ANDROID_LOG_WARN, "AWTK", __VA_ARGS__); \
|
||||
}
|
||||
#define log_error(...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_ERROR) { \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
log_notify_debugger("AWTK", __VA_ARGS__); \
|
||||
__android_log_print(ANDROID_LOG_ERROR, "AWTK", __VA_ARGS__); \
|
||||
}
|
||||
#elif defined(IOS)
|
||||
void awtk_ios_log(const char* message, ...);
|
||||
#define log_debug(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_DEBUG) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
awtk_ios_log(format, ##args); \
|
||||
}
|
||||
#define log_info(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_INFO) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
awtk_ios_log(format, ##args); \
|
||||
}
|
||||
#define log_warn(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_WARN) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
awtk_ios_log(format, ##args); \
|
||||
}
|
||||
#define log_error(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_ERROR) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
awtk_ios_log(format, ##args); \
|
||||
}
|
||||
#elif defined(WIN32)
|
||||
@ -216,93 +216,96 @@ void awtk_ios_log(const char* message, ...);
|
||||
/*MINGW*/
|
||||
#define log_debug(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_DEBUG) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
}
|
||||
#define log_info(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_INFO) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
}
|
||||
#define log_warn(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_WARN) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
}
|
||||
#define log_error(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_ERROR) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
}
|
||||
#else
|
||||
/*MSVC*/
|
||||
#define log_debug(format, ...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_DEBUG) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
#define log_debug(format, ...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_DEBUG) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
#define log_info(format, ...) if (log_get_log_level() <= LOG_LEVEL_INFO) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
#define log_info(format, ...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_INFO) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
#define log_warn(format, ...) if (log_get_log_level() <= LOG_LEVEL_WARN) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
#define log_error(format, ...) if (log_get_log_level() <= LOG_LEVEL_ERROR) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
#define log_warn(format, ...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_WARN) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
#define log_error(format, ...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_ERROR) { \
|
||||
log_notify_debugger(format, __VA_ARGS__); \
|
||||
printf(format, __VA_ARGS__); \
|
||||
fflush(stdout); \
|
||||
}
|
||||
#endif
|
||||
#elif defined(HAS_STDIO) || defined(AWTK_WEB)
|
||||
#include <stdio.h>
|
||||
#define log_debug(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_DEBUG) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
fflush(stdout);\
|
||||
fflush(stdout); \
|
||||
}
|
||||
#define log_info(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_INFO) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
fflush(stdout);\
|
||||
fflush(stdout); \
|
||||
}
|
||||
#define log_warn(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_WARN) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
fflush(stdout);\
|
||||
fflush(stdout); \
|
||||
}
|
||||
#define log_error(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_ERROR) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
printf(format, ##args); \
|
||||
fflush(stdout);\
|
||||
fflush(stdout); \
|
||||
}
|
||||
#elif defined(log_impl)
|
||||
#define log_debug(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_DEBUG) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_impl(format, ##args); \
|
||||
}
|
||||
#define log_info(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_INFO) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_impl(format, ##args); \
|
||||
}
|
||||
#define log_warn(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_WARN) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_impl(format, ##args); \
|
||||
}
|
||||
#define log_error(format, args...) \
|
||||
if (log_get_log_level() <= LOG_LEVEL_ERROR) { \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_notify_debugger(format, ##args); \
|
||||
log_impl(format, ##args); \
|
||||
}
|
||||
#else
|
||||
|
@ -24,11 +24,13 @@
|
||||
|
||||
#include "tkc/types_def.h"
|
||||
#ifdef WITH_WASM
|
||||
void * realloc(void *ptr, size_t size);
|
||||
void* realloc(void* ptr, size_t size);
|
||||
#define TKMEM_ALLOC(size) malloc(size)
|
||||
#define TKMEM_CALLOC(nmemb, size) calloc(nmemb, size)
|
||||
#define TKMEM_REALLOC(p, size) realloc(p, size)
|
||||
#define TKMEM_FREE(p) free((void*)p); p = NULL
|
||||
#define TKMEM_FREE(p) \
|
||||
free((void*)p); \
|
||||
p = NULL
|
||||
#define TKMEM_ZALLOC(type) (type*)TKMEM_CALLOC(1, sizeof(type))
|
||||
#define TKMEM_REALLOCT(type, p, n) (type*)realloc(p, (n) * sizeof(type))
|
||||
#define TKMEM_ZALLOCN(type, n) (type*)calloc(n, sizeof(type))
|
||||
@ -200,6 +202,6 @@ bool_t tk_mem_is_valid_addr(void* addr);
|
||||
#define TK_IS_VALID_ADDR(addr) tk_mem_is_valid_addr(addr)
|
||||
|
||||
END_C_DECLS
|
||||
#endif/*WITH_WASM*/
|
||||
#endif /*WITH_WASM*/
|
||||
|
||||
#endif /*TK_TKMEM_MANAGER_H*/
|
||||
|
@ -645,7 +645,7 @@ ret_t str_replace(str_t* str, const char* text, const char* new_text) {
|
||||
if (delta_len <= 0) {
|
||||
uint32_t size = str_replace_impl(str->str, str->str, text, new_text);
|
||||
str->size = size;
|
||||
} else if(str->extendable) {
|
||||
} else if (str->extendable) {
|
||||
char* temp_str = (char*)TKMEM_ALLOC(capacity);
|
||||
uint32_t size = str_replace_impl(temp_str, str->str, text, new_text);
|
||||
TKMEM_FREE(str->str);
|
||||
|
@ -49,7 +49,7 @@
|
||||
#endif
|
||||
#define PRIu64 __PRI64_PREFIX "u"
|
||||
#define PRId64 __PRI64_PREFIX "d"
|
||||
#endif/*PRIu64*/
|
||||
#endif /*PRIu64*/
|
||||
|
||||
#define INFINITY 3.40282347E+38f
|
||||
#define assert(__pp) wasm_assert(__pp, #__pp)
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef int wchar_t;
|
||||
#endif/*_cplusplus*/
|
||||
#endif /*_cplusplus*/
|
||||
|
||||
int iswspace(wchar_t ch);
|
||||
size_t wcslen(const wchar_t* s);
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "tkc/fs.h"
|
||||
#include "tkc/path.h"
|
||||
#include "tkc/thread.h"
|
||||
#endif/*WITH_WASM*/
|
||||
#endif /*WITH_WASM*/
|
||||
|
||||
#include "tkc/mem.h"
|
||||
#include "tkc/utf8.h"
|
||||
@ -1576,19 +1576,19 @@ ret_t tk_set_ui_thread(uint64_t ui_thread_id) {
|
||||
bool_t tk_is_ui_thread(void) {
|
||||
return s_ui_thread_id == tk_thread_self();
|
||||
}
|
||||
#endif/*WITH_WASM*/
|
||||
#endif /*WITH_WASM*/
|
||||
|
||||
char* file_read_as_unix_text(const char* filename, uint32_t* size) {
|
||||
str_t str;
|
||||
uint32_t s = 0;
|
||||
char* data = (char*)file_read(filename, &s);
|
||||
return_value_if_fail(data != NULL, NULL);
|
||||
str_t str;
|
||||
uint32_t s = 0;
|
||||
char* data = (char*)file_read(filename, &s);
|
||||
return_value_if_fail(data != NULL, NULL);
|
||||
|
||||
str_attach_with_size(&str, data, s, s+1);
|
||||
str_replace(&str, "\r\n", "\n");
|
||||
str_replace(&str, "\r", "\n");
|
||||
*size = str.size;
|
||||
str_reset(&str);
|
||||
str_attach_with_size(&str, data, s, s + 1);
|
||||
str_replace(&str, "\r\n", "\n");
|
||||
str_replace(&str, "\r", "\n");
|
||||
*size = str.size;
|
||||
str_reset(&str);
|
||||
|
||||
return data;
|
||||
return data;
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ wchar_t* wcs_dup(const wchar_t* s);
|
||||
#ifdef WITH_WCSXXX
|
||||
#ifndef WITH_WASM
|
||||
wchar_t* wcsdup(const wchar_t* s);
|
||||
#endif/*WITH_WASM*/
|
||||
#endif /*WITH_WASM*/
|
||||
#endif /*WITH_WCSXXX*/
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -156,7 +156,7 @@ static ret_t slider_update_dragger_rect(widget_t* widget, canvas_t* c) {
|
||||
dragger_size = slider_get_dragger_size(widget);
|
||||
max_gap = tk_roundi(dragger_size / 2);
|
||||
margin = margin > -max_gap ? margin : -max_gap;
|
||||
|
||||
|
||||
if (slider->vertical) {
|
||||
fvalue = 1.0f - fvalue;
|
||||
r->x = 0;
|
||||
@ -434,7 +434,7 @@ static ret_t slider_change_value_by_pointer_event(widget_t* widget, pointer_even
|
||||
|
||||
max_gap = tk_roundi(dragger_size / 2);
|
||||
margin = margin > -max_gap ? margin : -max_gap;
|
||||
|
||||
|
||||
widget_to_local(widget, &p);
|
||||
if (slider->vertical) {
|
||||
if (slider->no_dragger_icon) {
|
||||
@ -803,13 +803,13 @@ TK_DECL_VTABLE(slider) = {.size = sizeof(slider_t),
|
||||
.create = slider_create,
|
||||
.on_event = slider_on_event,
|
||||
.on_paint_self = slider_on_paint_self,
|
||||
.on_paint_border = widget_on_paint_null,
|
||||
.on_paint_border = widget_on_paint_null,
|
||||
.on_paint_background = widget_on_paint_null,
|
||||
.invalidate = slider_on_invalidate,
|
||||
.is_point_in = slider_on_is_point_in,
|
||||
.on_destroy = slider_on_destroy,
|
||||
.get_prop = slider_get_prop,
|
||||
.set_prop = slider_set_prop };
|
||||
.set_prop = slider_set_prop};
|
||||
|
||||
widget_t* slider_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
widget_t* widget = widget_create(parent, TK_REF_VTABLE(slider), x, y, w, h);
|
||||
|
@ -26,7 +26,8 @@
|
||||
#define SPIN_DEFAULT_REPEAT 300
|
||||
|
||||
const char* const s_spin_box_properties[] = {TK_EDIT_PROPS, WIDGET_PROP_REPEAT,
|
||||
WIDGET_PROP_EASY_TOUCH_MODE, WIDGET_PROP_BUTTON_POSITION, NULL};
|
||||
WIDGET_PROP_EASY_TOUCH_MODE,
|
||||
WIDGET_PROP_BUTTON_POSITION, NULL};
|
||||
|
||||
widget_t* spin_box_create_self(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
@ -35,7 +36,8 @@ static ret_t spin_box_on_copy(widget_t* widget, widget_t* other) {
|
||||
spin_box_t* spin_box_other = SPIN_BOX(other);
|
||||
return_value_if_fail(spin_box != NULL && spin_box_other != NULL, RET_BAD_PARAMS);
|
||||
spin_box->easy_touch_mode = spin_box_other->easy_touch_mode;
|
||||
spin_box->button_position = tk_str_copy(spin_box->button_position, spin_box_other->button_position);
|
||||
spin_box->button_position =
|
||||
tk_str_copy(spin_box->button_position, spin_box_other->button_position);
|
||||
|
||||
return edit_on_copy(widget, other);
|
||||
}
|
||||
@ -105,7 +107,8 @@ static ret_t spin_box_on_layout_children(widget_t* widget) {
|
||||
return_value_if_fail(inc != NULL && dec != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (tk_str_eq(spin_box->button_position, SPIN_BOX_BUTTON_POSITION_DEFAULT) ||
|
||||
(tk_str_eq(spin_box->button_position, SPIN_BOX_BUTTON_POSITION_NONE) && !(spin_box->easy_touch_mode))) {
|
||||
(tk_str_eq(spin_box->button_position, SPIN_BOX_BUTTON_POSITION_NONE) &&
|
||||
!(spin_box->easy_touch_mode))) {
|
||||
int32_t size = widget->h / 2;
|
||||
int32_t x = widget->w - size;
|
||||
edit->right_margin = size + 1;
|
||||
@ -116,7 +119,8 @@ static ret_t spin_box_on_layout_children(widget_t* widget) {
|
||||
} else {
|
||||
int32_t font_size = style_get_int(widget->astyle, STYLE_ID_FONT_SIZE, 18);
|
||||
if (tk_str_eq(spin_box->button_position, SPIN_BOX_BUTTON_POSITION_TOP_BOTTOM) ||
|
||||
(tk_str_eq(spin_box->button_position, SPIN_BOX_BUTTON_POSITION_NONE) && widget->h > font_size * 3)) {
|
||||
(tk_str_eq(spin_box->button_position, SPIN_BOX_BUTTON_POSITION_NONE) &&
|
||||
widget->h > font_size * 3)) {
|
||||
int32_t h = widget->h / 3;
|
||||
edit->top_margin = h;
|
||||
edit->bottom_margin = h;
|
||||
@ -196,12 +200,12 @@ ret_t spin_box_set_easy_touch_mode(widget_t* widget, bool_t easy_touch_mode) {
|
||||
return widget_invalidate_force(widget, NULL);
|
||||
}
|
||||
|
||||
ret_t spin_box_set_button_position(widget_t* widget,const char* button_position) {
|
||||
ret_t spin_box_set_button_position(widget_t* widget, const char* button_position) {
|
||||
spin_box_t* spin_box = SPIN_BOX(widget);
|
||||
return_value_if_fail(spin_box != NULL, RET_BAD_PARAMS);
|
||||
|
||||
spin_box->button_position = tk_str_copy(spin_box->button_position, button_position);
|
||||
|
||||
|
||||
return widget_invalidate_force(widget, NULL);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ ret_t spin_box_set_easy_touch_mode(widget_t* widget, bool_t easy_touch_mode);
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t spin_box_set_button_position(widget_t* widget,const char* button_position);
|
||||
ret_t spin_box_set_button_position(widget_t* widget, const char* button_position);
|
||||
|
||||
/**
|
||||
* @method spin_set_repeat
|
||||
|
@ -6,15 +6,15 @@
|
||||
#include <string>
|
||||
using std::string;
|
||||
|
||||
static char exe[MAX_PATH+1];
|
||||
static char exe[MAX_PATH + 1];
|
||||
|
||||
/*
|
||||
./bin/runTest "--gtest_filter=api_doc.*"
|
||||
*/
|
||||
|
||||
static void gen_path(const char* exe, const char* file, string& out) {
|
||||
char full[MAX_PATH+1] = {0};
|
||||
char normalized[MAX_PATH+1] = {0};
|
||||
char full[MAX_PATH + 1] = {0};
|
||||
char normalized[MAX_PATH + 1] = {0};
|
||||
tk_snprintf(full, sizeof(full), "%s%s", exe, file);
|
||||
path_normalize(full, normalized, MAX_PATH);
|
||||
out = normalized;
|
||||
@ -42,32 +42,30 @@ void log_to_str(void* ctx, log_level_t level, const char* s) {
|
||||
}
|
||||
|
||||
static const char* errs[] = {
|
||||
"(60): error: @property's name invalid: lang2 -- lang\n",
|
||||
"(67): error: @property's type invalid: char* -- const char*\n",
|
||||
"(172): error: @method name invalid, expect(code_edit_create) -- actual(code_edit_createx)\n",
|
||||
"(186): error: @method name invalid, expect(code_edit_cast) -- actual(code_edit_cast,)\n",
|
||||
"(310): error: @param_1's name invalid: size -- fold\n",
|
||||
"(616): error: @parem_2 slop missing comment\n",
|
||||
"(651): error: not enough @param (1 / 2)\nsuggest:\n * @param {int64_t} pos \n",
|
||||
"(656): error: unknown annotation \"scriptable1\"\n",
|
||||
"(657): error: @param_0's type invalid: widget_t -- widget_t*\n",
|
||||
"(677): error: @return type invalid ret_t -- char*\n",
|
||||
"(685): error: @param_0's name invalid: widget -- s\n",
|
||||
"(686): error: too much @param\n",
|
||||
"(829): error: nothing can be written between @param\n",
|
||||
"(934): error: unknown annotation \"string1\"\n",
|
||||
"(940): error: @const name invalid CODE_EDIT_PROP_LANG1 -- CODE_EDIT_PROP_LANG\n",
|
||||
"(1096): error: @prefix name missing\n"
|
||||
};
|
||||
"(60): error: @property's name invalid: lang2 -- lang\n",
|
||||
"(67): error: @property's type invalid: char* -- const char*\n",
|
||||
"(172): error: @method name invalid, expect(code_edit_create) -- actual(code_edit_createx)\n",
|
||||
"(186): error: @method name invalid, expect(code_edit_cast) -- actual(code_edit_cast,)\n",
|
||||
"(310): error: @param_1's name invalid: size -- fold\n",
|
||||
"(616): error: @parem_2 slop missing comment\n",
|
||||
"(651): error: not enough @param (1 / 2)\nsuggest:\n * @param {int64_t} pos \n",
|
||||
"(656): error: unknown annotation \"scriptable1\"\n",
|
||||
"(657): error: @param_0's type invalid: widget_t -- widget_t*\n",
|
||||
"(677): error: @return type invalid ret_t -- char*\n",
|
||||
"(685): error: @param_0's name invalid: widget -- s\n",
|
||||
"(686): error: too much @param\n",
|
||||
"(829): error: nothing can be written between @param\n",
|
||||
"(934): error: unknown annotation \"string1\"\n",
|
||||
"(940): error: @const name invalid CODE_EDIT_PROP_LANG1 -- CODE_EDIT_PROP_LANG\n",
|
||||
"(1096): error: @prefix name missing\n"};
|
||||
|
||||
static const char* warns[] = {
|
||||
"(1076): warning: @prefix missing\n",
|
||||
"(1076): warning: @prefix missing\n",
|
||||
};
|
||||
|
||||
void dummy_log(void* ctx, log_level_t level, const char* s) {
|
||||
}
|
||||
|
||||
|
||||
void auto_fix_hook(const char* path, const char* actual, uint32_t size) {
|
||||
//file_write("f:/foo.h", actual, size);
|
||||
|
||||
@ -92,19 +90,19 @@ TEST(api_doc, basic) {
|
||||
ca = code_assist_create();
|
||||
path_exe(exe);
|
||||
gen_path(exe, "/../../tests/testdata/apidoc_test.h", file1);
|
||||
|
||||
|
||||
check_api_doc(ca, file1.c_str(), log_to_str, &out, FALSE, NULL);
|
||||
|
||||
uint32_t i = 0;
|
||||
string expErr;
|
||||
for (i = 0; i < sizeof(errs)/sizeof(*errs); ++i) {
|
||||
for (i = 0; i < sizeof(errs) / sizeof(*errs); ++i) {
|
||||
const char* err = errs[i];
|
||||
expErr += file1 + err;
|
||||
}
|
||||
ASSERT_EQ(expErr, out.err.str);
|
||||
|
||||
string expWarn;
|
||||
for (i = 0; i < sizeof(warns)/sizeof(*warns); ++i) {
|
||||
for (i = 0; i < sizeof(warns) / sizeof(*warns); ++i) {
|
||||
const char* warn = warns[i];
|
||||
expWarn += file1 + warn;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ TEST(DataReaderFactory, basic) {
|
||||
#ifdef WIN32
|
||||
char cwd[MAX_PATH + 1] = {0};
|
||||
char path[MAX_PATH + 1] = {0};
|
||||
|
||||
|
||||
path_cwd(cwd);
|
||||
path_build(path, sizeof(path) - 1, cwd, "tests\\testdata\\main.xml", NULL);
|
||||
log_debug("%s\n", path);
|
||||
|
@ -7,14 +7,14 @@ static float_t easing_linear(float_t k) {
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
TEST(easing, basic) {
|
||||
ASSERT_EQ(easing_register("test1", easing_linear), EASING_FUNC_NR + 1);
|
||||
ASSERT_EQ(easing_register("test2", easing_linear), EASING_FUNC_NR + 2);
|
||||
|
||||
uint32_t easing_type = easing_register("test3", easing_linear);
|
||||
widget_t* button = button_create(NULL, 0, 0, 100, 30);
|
||||
widget_animator_t* wa = widget_animator_prop_create(button, 1000, 0, (easing_type_t)easing_type, "x");
|
||||
widget_animator_t* wa =
|
||||
widget_animator_prop_create(button, 1000, 0, (easing_type_t)easing_type, "x");
|
||||
|
||||
ASSERT_EQ(widget_animator_prop_set_params(wa, 0, 300), RET_OK);
|
||||
|
||||
|
@ -1258,7 +1258,7 @@ TEST(FExr, var_dollar) {
|
||||
value_reset(&v);
|
||||
|
||||
fscript_eval(obj, "$aaa+\"b\"", &v);
|
||||
ASSERT_STREQ(value_str(&v), TK_VALUE_UNDEFINED"b");
|
||||
ASSERT_STREQ(value_str(&v), TK_VALUE_UNDEFINED "b");
|
||||
value_reset(&v);
|
||||
|
||||
TK_OBJECT_UNREF(obj);
|
||||
@ -3198,36 +3198,34 @@ TEST(FScript, consts) {
|
||||
value_t s;
|
||||
tk_object_t* obj = object_default_create();
|
||||
|
||||
|
||||
fscript_eval(obj, "var t = fconsts.PI; t", &v);
|
||||
ASSERT_EQ(value_int(&v), 3);
|
||||
value_reset(&v);
|
||||
|
||||
|
||||
value_set_str(&s, "hello world");
|
||||
fscript_register_const_value("HELLO", &s);
|
||||
fscript_register_const_double("E", 2.718);
|
||||
fscript_register_const_int("FAIL", RET_FAIL);
|
||||
fscript_register_const_int("BAD_PARAMS", RET_BAD_PARAMS);
|
||||
|
||||
|
||||
fscript_eval(obj, "var t = fconsts.E; t", &v);
|
||||
ASSERT_EQ(tk_fequal(value_double(&v), 2.718), TRUE);
|
||||
value_reset(&v);
|
||||
|
||||
|
||||
fscript_eval(obj, "var t = fconsts.FAIL; t", &v);
|
||||
ASSERT_EQ(value_int(&v), RET_FAIL);
|
||||
value_reset(&v);
|
||||
|
||||
|
||||
fscript_eval(obj, "var t = fconsts.BAD_PARAMS; t", &v);
|
||||
ASSERT_EQ(value_int(&v), RET_BAD_PARAMS);
|
||||
value_reset(&v);
|
||||
|
||||
|
||||
fscript_eval(obj, "var t = RET_BAD_PARAMS; t", &v);
|
||||
ASSERT_EQ(value_int(&v), RET_BAD_PARAMS);
|
||||
|
||||
|
||||
fscript_eval(obj, "var t = fconsts.HELLO; t", &v);
|
||||
ASSERT_STREQ(value_str(&v), "hello world");
|
||||
value_reset(&v);
|
||||
|
||||
TK_OBJECT_UNREF(obj);
|
||||
}
|
||||
|
||||
|
@ -802,4 +802,3 @@ TEST(SelfLayoutDefault, set_self_layout_params2) {
|
||||
ASSERT_EQ(self_layouter_get_param_int(layouter, "w_attr", 0), W_ATTR_UNDEF);
|
||||
ASSERT_EQ(self_layouter_get_param_int(layouter, "h_attr", 0), W_ATTR_UNDEF);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,13 @@ TEST(SpinBox, to_xml) {
|
||||
|
||||
str_init(&str, 1024);
|
||||
ASSERT_EQ(widget_to_xml(w1, &str), RET_OK);
|
||||
ASSERT_STREQ(str.str, "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<spin_box x=\"10\" y=\"20\" w=\"30\" h=\"40\" focusable=\"true\" min=\"0\" max=\"1024\" step=\"1.000000\" input_type=\"1\" readonly=\"false\" cancelable=\"false\" auto_fix=\"false\" left_margin=\"2\" right_margin=\"2\" top_margin=\"2\" bottom_margin=\"2\" action_text=\"done\" password_visible=\"false\" repeat=\"300\" easy_touch_mode=\"false\" button_position=\"none\">\n</spin_box>\n");
|
||||
ASSERT_STREQ(str.str,
|
||||
"<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n<spin_box x=\"10\" "
|
||||
"y=\"20\" w=\"30\" h=\"40\" focusable=\"true\" min=\"0\" max=\"1024\" "
|
||||
"step=\"1.000000\" input_type=\"1\" readonly=\"false\" cancelable=\"false\" "
|
||||
"auto_fix=\"false\" left_margin=\"2\" right_margin=\"2\" top_margin=\"2\" "
|
||||
"bottom_margin=\"2\" action_text=\"done\" password_visible=\"false\" repeat=\"300\" "
|
||||
"easy_touch_mode=\"false\" button_position=\"none\">\n</spin_box>\n");
|
||||
|
||||
str_reset(&str);
|
||||
widget_destroy(w1);
|
||||
|
@ -685,13 +685,13 @@ TEST(Str, attach1) {
|
||||
ASSERT_EQ(s != NULL, true);
|
||||
|
||||
str_set(s, "T#");
|
||||
str_append_int(s, 1);
|
||||
str_append_int(s, 1);
|
||||
str_append(s, "d");
|
||||
|
||||
str_append_int(s, 2);
|
||||
|
||||
str_append_int(s, 2);
|
||||
str_append(s, "h");
|
||||
|
||||
str_append_int(s, 3);
|
||||
str_append_int(s, 3);
|
||||
str_append(s, "s");
|
||||
ASSERT_STREQ(buff, "T#1d2h3s");
|
||||
}
|
||||
@ -703,13 +703,13 @@ TEST(Str, attach2) {
|
||||
ASSERT_EQ(s != NULL, true);
|
||||
|
||||
str_set(s, "T#");
|
||||
str_append_int(s, 1);
|
||||
str_append_int(s, 1);
|
||||
str_append(s, "d");
|
||||
|
||||
str_append_int(s, 2);
|
||||
|
||||
str_append_int(s, 2);
|
||||
str_append(s, "h");
|
||||
|
||||
str_append_int(s, 3);
|
||||
str_append_int(s, 3);
|
||||
str_append(s, "s");
|
||||
|
||||
str_reset(s);
|
||||
@ -725,30 +725,30 @@ TEST(Str, replace1) {
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc", "a"), RET_OK);
|
||||
ASSERT_STREQ(buff, "aa123");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc", ""), RET_OK);
|
||||
ASSERT_STREQ(buff, "123");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc123", ""), RET_OK);
|
||||
ASSERT_STREQ(buff, "abc");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc123", "abc"), RET_OK);
|
||||
ASSERT_STREQ(buff, "abcabc");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abcabc123", "abc"), RET_OK);
|
||||
ASSERT_STREQ(buff, "abc");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abcabc123", ""), RET_OK);
|
||||
ASSERT_STREQ(buff, "");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "", "abc"), RET_BAD_PARAMS);
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc", "abcabc"), RET_FAIL);
|
||||
}
|
||||
@ -761,30 +761,30 @@ TEST(Str, replace2) {
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc", "a"), RET_OK);
|
||||
ASSERT_STREQ(s->str, "aa123");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc", ""), RET_OK);
|
||||
ASSERT_STREQ(s->str, "123");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc123", ""), RET_OK);
|
||||
ASSERT_STREQ(s->str, "abc");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc123", "abc"), RET_OK);
|
||||
ASSERT_STREQ(s->str, "abcabc");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abcabc123", ""), RET_OK);
|
||||
ASSERT_STREQ(s->str, "");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "a", ""), RET_OK);
|
||||
ASSERT_STREQ(s->str, "bcbc123");
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "", ""), RET_BAD_PARAMS);
|
||||
|
||||
|
||||
str_set(s, "abcabc123");
|
||||
ASSERT_EQ(str_replace(s, "abc", "abcabc"), RET_OK);
|
||||
ASSERT_STREQ(s->str, "abcabcabcabc123");
|
||||
|
16
tests/testdata/apidoc_test.h
vendored
16
tests/testdata/apidoc_test.h
vendored
@ -180,7 +180,7 @@ typedef struct _code_edit_t {
|
||||
*
|
||||
* @return {widget_t*} code_edit对象。
|
||||
*/
|
||||
static inline widget_t * code_edit_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
static inline widget_t* code_edit_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
/**
|
||||
* @method code_edit_cast,
|
||||
@ -662,8 +662,8 @@ int64_t code_edit_word_end(widget_t* widget, int64_t pos);
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t code_edit_get_text_range(widget_t* widget, int64_t start, int64_t end,
|
||||
char* buf, int32_t buf_capacity);
|
||||
ret_t code_edit_get_text_range(widget_t* widget, int64_t start, int64_t end, char* buf,
|
||||
int32_t buf_capacity);
|
||||
|
||||
/**
|
||||
* @method code_edit_get_text_bom
|
||||
@ -819,7 +819,7 @@ ret_t code_edit_goto_pos(widget_t* widget, int64_t pos);
|
||||
*
|
||||
* @return {int64_t} 返回获取指定位置所在的行。
|
||||
*/
|
||||
int64_t code_edit_get_line_from_position(widget_t* widget,int64_t pos);
|
||||
int64_t code_edit_get_line_from_position(widget_t* widget, int64_t pos);
|
||||
|
||||
/**
|
||||
* @method code_edit_get_line_start
|
||||
@ -1054,9 +1054,11 @@ bool_t code_edit_is_comment(widget_t* widget, int64_t pos);
|
||||
#define CODE_EDIT(widget) ((code_edit_t*)(code_edit_cast(WIDGET(widget))))
|
||||
|
||||
/**public for ScintillaAWTK*/
|
||||
#define PROP_CODE_EDITOR_FONT_SIZE "CODE_EDITOR_FONT_SIZE" // designer设置了代码编辑器的字体大小后,要设置值为字号的此属性到wm。
|
||||
#define EVT_GLOBAL_CODE_EDITOR_FONT_SIZE_CHANGED EVT_USER_START + 1 // designer设置了代码编辑器的字体大小后,要从wm派发这个事件。
|
||||
#define _SC_MARGE_LINENUMBER 0 // 第0条marge为行号
|
||||
#define PROP_CODE_EDITOR_FONT_SIZE \
|
||||
"CODE_EDITOR_FONT_SIZE" // designer设置了代码编辑器的字体大小后,要设置值为字号的此属性到wm。
|
||||
#define EVT_GLOBAL_CODE_EDITOR_FONT_SIZE_CHANGED \
|
||||
EVT_USER_START + 1 // designer设置了代码编辑器的字体大小后,要从wm派发这个事件。
|
||||
#define _SC_MARGE_LINENUMBER 0 // 第0条marge为行号
|
||||
#define _SC_MARGE_SYBOLE 1 // 第1条marge为断点等
|
||||
#define _SC_MARGE_FOLDER 2 // 第2条marge为折叠符号
|
||||
#define _CODE_EDIT_DEFAULT_LINE_NUMBER_WITH 32
|
||||
|
16
tests/testdata/fixed.h
vendored
16
tests/testdata/fixed.h
vendored
@ -180,7 +180,7 @@ typedef struct _code_edit_t {
|
||||
*
|
||||
* @return {widget_t*} code_edit对象。
|
||||
*/
|
||||
static inline widget_t * code_edit_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
static inline widget_t* code_edit_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
/**
|
||||
* @method code_edit_cast
|
||||
@ -662,8 +662,8 @@ int64_t code_edit_word_end(widget_t* widget, int64_t pos);
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t code_edit_get_text_range(widget_t* widget, int64_t start, int64_t end,
|
||||
char* buf, int32_t buf_capacity);
|
||||
ret_t code_edit_get_text_range(widget_t* widget, int64_t start, int64_t end, char* buf,
|
||||
int32_t buf_capacity);
|
||||
|
||||
/**
|
||||
* @method code_edit_get_text_bom
|
||||
@ -819,7 +819,7 @@ ret_t code_edit_goto_pos(widget_t* widget, int64_t pos);
|
||||
*
|
||||
* @return {int64_t} 返回获取指定位置所在的行。
|
||||
*/
|
||||
int64_t code_edit_get_line_from_position(widget_t* widget,int64_t pos);
|
||||
int64_t code_edit_get_line_from_position(widget_t* widget, int64_t pos);
|
||||
|
||||
/**
|
||||
* @method code_edit_get_line_start
|
||||
@ -1054,9 +1054,11 @@ bool_t code_edit_is_comment(widget_t* widget, int64_t pos);
|
||||
#define CODE_EDIT(widget) ((code_edit_t*)(code_edit_cast(WIDGET(widget))))
|
||||
|
||||
/**public for ScintillaAWTK*/
|
||||
#define PROP_CODE_EDITOR_FONT_SIZE "CODE_EDITOR_FONT_SIZE" // designer设置了代码编辑器的字体大小后,要设置值为字号的此属性到wm。
|
||||
#define EVT_GLOBAL_CODE_EDITOR_FONT_SIZE_CHANGED EVT_USER_START + 1 // designer设置了代码编辑器的字体大小后,要从wm派发这个事件。
|
||||
#define _SC_MARGE_LINENUMBER 0 // 第0条marge为行号
|
||||
#define PROP_CODE_EDITOR_FONT_SIZE \
|
||||
"CODE_EDITOR_FONT_SIZE" // designer设置了代码编辑器的字体大小后,要设置值为字号的此属性到wm。
|
||||
#define EVT_GLOBAL_CODE_EDITOR_FONT_SIZE_CHANGED \
|
||||
EVT_USER_START + 1 // designer设置了代码编辑器的字体大小后,要从wm派发这个事件。
|
||||
#define _SC_MARGE_LINENUMBER 0 // 第0条marge为行号
|
||||
#define _SC_MARGE_SYBOLE 1 // 第1条marge为断点等
|
||||
#define _SC_MARGE_FOLDER 2 // 第2条marge为折叠符号
|
||||
#define _CODE_EDIT_DEFAULT_LINE_NUMBER_WITH 32
|
||||
|
@ -788,7 +788,8 @@ TEST(Utils, file_read_as_unix_text) {
|
||||
uint32_t size = 0;
|
||||
char* data = file_read_as_unix_text("tests/testdata/test.txt", &size);
|
||||
|
||||
#define EXPECT_STR "\
|
||||
#define EXPECT_STR \
|
||||
"\
|
||||
abc\n\
|
||||
123\n\
|
||||
hello\n\
|
||||
@ -797,4 +798,3 @@ hello\n\
|
||||
|
||||
TKMEM_FREE(data);
|
||||
}
|
||||
|
||||
|
@ -1594,6 +1594,6 @@ TEST(Widget, dirty_rect_prop) {
|
||||
ASSERT_EQ(w->y, r2->y);
|
||||
ASSERT_EQ(w->w, r2->w);
|
||||
ASSERT_EQ(w->h, r2->h);
|
||||
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
@ -434,11 +434,11 @@ TEST(WStr, case_cmp) {
|
||||
}
|
||||
|
||||
TEST(WStr, attach0) {
|
||||
wstr_t s;
|
||||
wchar_t buff[32];
|
||||
wstr_attach(&s, buff, ARRAY_SIZE(buff));
|
||||
wstr_set(&s, L"abc");
|
||||
wstr_append(&s, L"123");
|
||||
wstr_t s;
|
||||
wchar_t buff[32];
|
||||
wstr_attach(&s, buff, ARRAY_SIZE(buff));
|
||||
wstr_set(&s, L"abc");
|
||||
wstr_append(&s, L"123");
|
||||
}
|
||||
|
||||
TEST(WStr, attach1) {
|
||||
@ -448,13 +448,13 @@ TEST(WStr, attach1) {
|
||||
ASSERT_EQ(s != NULL, true);
|
||||
|
||||
wstr_set(s, L"T#");
|
||||
wstr_append_int(s, 1);
|
||||
wstr_append_int(s, 1);
|
||||
wstr_append(s, L"d");
|
||||
|
||||
wstr_append_int(s, 2);
|
||||
|
||||
wstr_append_int(s, 2);
|
||||
wstr_append(s, L"h");
|
||||
|
||||
wstr_append_int(s, 3);
|
||||
wstr_append_int(s, 3);
|
||||
wstr_append(s, L"s");
|
||||
ASSERT_EQ(wcscmp(buff, L"T#1d2h3s"), 0);
|
||||
}
|
||||
@ -466,13 +466,13 @@ TEST(WStr, attach2) {
|
||||
ASSERT_EQ(s != NULL, true);
|
||||
|
||||
wstr_set(s, L"T#");
|
||||
wstr_append_int(s, 1);
|
||||
wstr_append_int(s, 1);
|
||||
wstr_append(s, L"d");
|
||||
|
||||
wstr_append_int(s, 2);
|
||||
|
||||
wstr_append_int(s, 2);
|
||||
wstr_append(s, L"h");
|
||||
|
||||
wstr_append_int(s, 3);
|
||||
wstr_append_int(s, 3);
|
||||
wstr_append(s, L"s");
|
||||
|
||||
wstr_reset(s);
|
||||
|
@ -84,7 +84,7 @@ ret_t gen_one(const char* input_file, const char* output_file, const char* theme
|
||||
|
||||
static ret_t gen_folder(const char* in_foldername, const char* out_foldername, const char* theme,
|
||||
image_format_t* image_format, lcd_orientation_t o) {
|
||||
fs_item_t item;
|
||||
fs_item_t item;
|
||||
ret_t ret = RET_OK;
|
||||
char in_name[MAX_PATH] = {0};
|
||||
char out_name[MAX_PATH] = {0};
|
||||
|
@ -93,9 +93,9 @@ static const char* s_fps = NULL;
|
||||
key[len] = '\0'; \
|
||||
\
|
||||
if (tk_str_icmp(key, "res_root") == 0) { \
|
||||
s_res_root = val + 1; \
|
||||
s_res_root = val + 1; \
|
||||
} else if (tk_str_icmp(key, "ui") == 0) { \
|
||||
s_ui = val + 1; \
|
||||
s_ui = val + 1; \
|
||||
} else if (tk_str_icmp(key, "system_bar") == 0) { \
|
||||
s_system_bar = val + 1; \
|
||||
} else if (tk_str_icmp(key, "bottom_system_bar") == 0) { \
|
||||
|
@ -102,7 +102,7 @@ static ret_t gen_one(const char* in_filename, const char* out_filename, const ch
|
||||
|
||||
static ret_t gen_folder(const char* in_foldername, const char* out_foldername, const char* theme,
|
||||
const char* extname, bool_t data_folder) {
|
||||
fs_item_t item;
|
||||
fs_item_t item;
|
||||
ret_t ret = RET_OK;
|
||||
char in_name[MAX_PATH] = {0};
|
||||
char out_name[MAX_PATH] = {0};
|
||||
|
@ -61,7 +61,7 @@ static ret_t gen_one(const char* input_file, const char* output_file, const char
|
||||
|
||||
static ret_t gen_folder(const char* in_foldername, const char* out_foldername, const char* theme,
|
||||
bool_t bin) {
|
||||
fs_item_t item;
|
||||
fs_item_t item;
|
||||
ret_t ret = RET_OK;
|
||||
char in_name[MAX_PATH] = {0};
|
||||
char out_name[MAX_PATH] = {0};
|
||||
|
Loading…
x
Reference in New Issue
Block a user