prefix
stringlengths
0
918k
middle
stringlengths
0
812k
suffix
stringlengths
0
962k
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(animation)
}; compositor_app_slide_transition_animation_update(ctx, distance_normalized, config.direction); } //! The transition direction here is the direction of the visual elements, not the motion static void prv_config...
stack. WindowStack *window_stack = modal_manager_get_window_stack(ModalPriorityAlert); simple_dialog_push(crash_dialog, window_stack); #if PBL_ROUND // For circular display, reduce app name length until message fits on the screen // This has to occur after the dialog window load has been called to provide /...
(s_next_app.md)
); } PBL_LOG(LOG_LEVEL_WARNING, "Failed to start app <%s>! Restarting launcher", process_metadata_get_name(s_next_app.md)); prv_app_start(system_app_state_machine_system_start(), NULL, APP_LAUNCH_SYSTEM); } compositor_transition(s_next_app.common.transition); // Check if we've exited gr...
command_hwver_write(written_hw_version5); hw_version = mfg_get_hw_version(); cl_assert_equal_s(written_hw_version5, hw_version); #endif // BOARD_SILK || BOARD_CALCULUS } void test_mfg_serials__serial_number_console(void) { const char* serial; // Initially, bunch of XXs: serial = mfg_get_serial_number(); c...
cl_assert_equal_i(r, MfgSerialsResultSuccess)
; cl_assert_equal_s(sn, fourth_sn); cl_assert_equal_i(index, 5); // SERIAL4 lives at index 5 // Fifth time: const char *fifth_sn = "7ujn8ikm9olm"; r = mfg_write_serial_number(fifth_sn, strlen(fifth_sn), &index); sn = mfg_get_serial_number(); cl_assert_equal_i(r, MfgSerialsResultSuccess); cl_assert_equa...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
grect_clip(&f->dirty_rect, &clip_rect)
; f->is_dirty = true; }
line_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter...
cl_assert_equal_i(timeline_model_get_num_items(), 0)
; cl_assert(!timeline_model_iter_next(NULL, NULL)); cl_assert(!timeline_model_iter_prev(NULL, NULL)); } void test_timeline_model__is_empty(void) { TimelineModel model = {0}; model.direction = TimelineIterDirectionFuture; time_t first_time = 1421178000; // Note: 1421178000 = Tue Jan 13 11:40:00 PST 2015 t...
struct Subscriber { MicDataHandlerCB callback; int16_t *buffer; void *context; size_t size; size_t idx; } s_subscriber; static bool prv_dma_handler(DMARequest *request, void *context, bool is_complete); //! Initialize power management for the microphone. Note that different boards have different //! ways of...
prv_mic_power_init()
; s_mic_mutex = mutex_create_recursive(); s_initialized = true; } void mic_set_volume(MicDevice *this, uint16_t volume) { s_volume = volume; } bool mic_start(MicDevice *mic, MicDataHandlerCB data_handler, void *context, int16_t *audio_buffer, size_t audio_buffer_len) { PBL_ASSERTN(s_initializ...
log_file_id = hdr.log_file_id; } } return (first_used_region); } //! @param log_file_id - the id of the log file to find //! @param[out] start_page_addr - the address of the page the log starts on //! @return the number of pages in the log file requested or 0 if no //! file is found static int prv_get_start_...
(prev_log_id, &s_curr_state.page_start_addr)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(ctx, GCompOpSet)
; } } graphics_draw_bitmap_in_rect(ctx, icon, icon_frame); } static void prv_menu_cell_basic_draw_custom_rect( GContext *ctx, const Layer *cell_layer, const MenuCellLayerConfig *config) { const GRect *bounds = &cell_layer->bounds; const bool is_legacy2 = process_manager_compiled_with_legacy2_sdk(); ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ snprintf(file_small, sizeof(file_small), "file%d", i); uint8_t buf[PFS_SECTOR_SIZE * 2]; memset(&buf[0], i, sizeof(buf)); int fd = pfs_open(file_small, OP_FLAG_WRITE, FILE_TYPE_STATIC, sizeof(buf)); printf("fd=%d\n", fd); cl_assert(fd >= 0); cl_assert_equal_i(pfs_write(fd, &buf[0], sizeof...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
floor(-0.0001)
== -1.0); cl_assert(isnan(floor(NAN))); cl_assert(isinf(floor(INFINITY))); }
t RockyAPISystemFontDefinition s_font_definitions[] = { {.js_name = "18px bold Gothic", .res_key = FONT_KEY_GOTHIC_18_BOLD}, {.js_name = "14px Gothic", .res_key = FONT_KEY_GOTHIC_14}, {.js_name = "14px bold Gothic", .res_key = FONT_KEY_GOTHIC_14_BOLD}, {.js_name = "18px Gothic", .res_key = FONT_KEY_GOTHIC_18}, ...
rocky_add_function(obj, ROCKY_CONTEXT2D_FILLTEXT, prv_fill_text)
; rocky_add_function(obj, ROCKY_CONTEXT2D_MEASURETEXT, prv_measure_text); rocky_define_property(obj, ROCKY_CONTEXT2D_TEXTALIGN, prv_get_text_align, prv_set_text_align); rocky_define_property(obj, ROCKY_CONTEXT2D_FONT, prv_get_font, prv_set_font); } static void prv_text_state_deinit(void) { if (s_rocky_text_sta...
ytes) { void *ptr = task_zalloc(bytes); if (!ptr) { wtf(); } return ptr; } void *task_realloc(void *ptr, size_t bytes) { return realloc(ptr, bytes); } void task_free(void *ptr) { free(ptr); } void app_log(uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt, ...
printf(">>>> WTF\n")
; EM_ASM_INT_V({ abort(); }); while (1) ; } PebbleTask pebble_task_get_current(void) { return PebbleTask_App; } void app_event_loop(void) { // FIXME: PBL-43469 will need to remove this init from here when multiple // platform support is implemented. rocky_api_watchface_init(); emx_app_event_loop(); }
uld keep this activity time_t end_time = sessions[i].start_utc + (sessions[i].length_min * SECONDS_PER_MINUTE); if ((end_time >= end_utc) && (end_time <= utc_sec) && (!remove_ongoing || !sessions[i].ongoing)) { // Keep it continue; } // This one needs to be removed uint32_t rema...
if (activity_sessions_prv_is_sleep_activity(session->type)) { state->sleep_sessions_modified = true; }
// If this is an existing activity, update it ActivitySession *stored_session = state->activity_sessions; for (uint16_t i = 0; i < state->activity_sessions_count; i++, stored_session++) { if (prv_activity_sessions_equal(session, stored_session, true /*any_sleep*/)) { state->activity_sessions...
ls, h), 1); cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, h), 1); cl_assert_equal_i(prv_count_handler_entries(&s_teardown_handler_calls, h), 1); // Make sure the frame reached the "to" state cl_assert_equal_i(prv_last_update_distance(h), ANIMATION_NORMALIZED_MAX); // This should return...
prv_now_ms()
; prv_advance_to_ms_with_timers(start_ms + test_duration); // Should still be running cl_assert_equal_i(prv_count_handler_entries(&s_setup_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls,...
assert_equal_point(GPoint(2, 3), lc->path.points[1]); cl_assert_equal_point(GPoint(4, 5), lc->path.points[2]); cl_assert_equal_point(GPoint(6, 7), lc->path.points[3]); } void test_rocky_api_graphics_path2d__fill(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.mo...
cl_assert_equal_i(TRIG_MAX_ANGLE * 5 / 4, lc->draw_arc.angle_end)
; } void test_rocky_api_graphics_path2d__unsupported(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.arcTo"); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.bezierCurveTo"); EXECUTE_SCRIPT_EXPECT_UNDEFINED("ctx.quadraticCurveTo"); } extern size_t s_rocky_path...
ode_App); s_app_state_get_graphics_context = &s_ctx; // Setup resources fake_spi_flash_init(0 /* offset */, 0x1000000 /* length */); pfs_init(false /* run filesystem check */); pfs_format(true /* write erase headers */); load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, ...
(&s_data.window, &s_ctx)
; cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_kickstart__render_PBL_43717(void) { prv_set_data(&s_data, 7, 0, 7, 0); window_set_on_screen(&s_data.window, true, true); window_render(&s_data.window, &s_ctx); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); }
l_radial_precise_internal.call_count); cl_assert_equal_point_precise((PP(29.5, 39.5)), lc->fill_radial_precise.center); cl_assert_equal_i(0, lc->fill_radial_precise.radius_inner.raw_value); cl_assert_equal_i(0, lc->fill_radial_precise.radius_outer.raw_value); } void test_rocky_api_graphics__line_styles(void) { ...
cl_assert_equal_s("more text", s_graphics_draw_text.last_call.draw_text.text)
; cl_assert_equal_i(GColorBlueARGB8, s_graphics_draw_text.last_call.draw_text.color.argb); cl_assert_equal_rect((GRect(-11, 5000, 60, large_int)), s_graphics_draw_text.last_call.draw_text.box); } void test_rocky_api_graphics__fill_text_coordinates(void) { prv_global_init_and_set_ctx(); E...
ry_marks_cell_width; SystemCertificationMenuItem *menu_items; uint16_t menu_count; Window kcc_window; BitmapLayer bmp_layer; TextLayer title_text; TextLayer info_text; StatusBarLayer status_layer; } SystemCertificationData; typedef struct SystemInformationData { FirmwareMetadata recovery_fw_metadata;...
(seconds_since_reboot, &days, &hours, &minutes, &seconds)
; sniprintf(data->uptime_string, sizeof(data->uptime_string), "%"PRIu32"d %"PRIu32"h %"PRIu32"m %"PRIu32"s", days, hours, minutes, seconds); } static void prv_information_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *...
set_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_reset(&ctx, fb); layer_set_update_proc(&layer, &outside_nx_layer_update_callback); layer_render_tree(&layer, &ctx); cl_check(framebuffer_is_empty("outside_nx_offset_layer", ctx.parent_framebuffer, GColorWhite)); test_graphics_context_r...
(ctx, GPoint(p.x + 3, p.y + 2))
_entries(&s_stopped_handler_calls, b), 0); cl_assert_equal_i(prv_count_handler_entries(&s_update_handler_calls, b), 0); // A should start out low distance = prv_last_update_distance(a); cl_assert(distance < TEST_ANIMATION_NORMALIZED_LOW); // Execute to the start of B prv_advance_to_ms_with_timers(start_m...
prv_advance_to_ms_with_timers(start_ms + duration_a + 2 * MIN_FRAME_INTERVAL_MS)
; cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, NULL), 3); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, NULL), 1); // Execute to the end of B & C prv_advance_to_ms_with_timers(start_ms + duration_total + 1 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_...
8_t *end) { SerializedAttributeHeader *attribute = (SerializedAttributeHeader *)*cursor; *cursor += sizeof(SerializedAttributeHeader); if ((*cursor + attribute->length) > end) { return -1; } int32_t string_alloc_size = 0; switch (prv_attribute_type(attribute->id)) { case AttributeTypeString: i...
(buffer, &attr_list->attributes[i].uint8, attribute->length)
; break; case AttributeTypeStringList: attribute->length = attr_list->attributes[i].string_list->serialized_byte_length; memcpy(buffer, attr_list->attributes[i].string_list->data, attribute->length); break; case AttributeTypeUint32List: attribute->lengt...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ PBL_ASSERT(0, "Not expected to be called when compiling to applib-emscripten..."); return NULL; }
// FIXME: Emscripten is cannot deal with two files with the same name // (even if the path is different) The framebuffer.c files end up not // getting linked in. A longer term fix would be to rename the object // file in WAF volatile const int FrameBuffer_MaxX = DISP_COLS; volatile const int FrameBuffer_MaxY = DISP_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ ProfilerNode* node = (ProfilerNode*)list_node; return (node == data); }
ProfilerNode *prv_find_node(ProfilerNode *find_node) { ListNode* node = list_find(g_profiler.nodes, prv_ptr_list_filter, (void*)find_node); return (ProfilerNode *)node; } DEFINE_SYSCALL(void, sys_profiler_init, void) { profiler_init(); } DEFINE_SYSCALL(void, sys_profiler_start, void) { profiler_start(); }...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ NVIC_SetPriority(bus->hal->ev_irq_channel, I2C_IRQ_PRIORITY); NVIC_SetPriority(bus->hal->er_irq_channel, I2C_IRQ_PRIORITY); NVIC_EnableIRQ(bus->hal->ev_irq_channel); NVIC_EnableIRQ(bus->hal->er_irq_channel); I2C_DeInit(bus->hal->i2c); }
992, 752, -664}, { 1280, 896, -640}, { 888, 568, -488}, { 1064, 560, -440}, { 1392, 472, -424}, { 1280, 264, -320}, { 1032, 248, -280}, { 1064, 184, -272}, { 1176, 152, -232}, { 1240, 152, -280}, { 1240, 88, -272}, { 1088, 40, -256}, { 872, -96, -160}, // 56 seconds ...
{ -360, 784, 384}, { -368, 808, 312}, { -360, 824, 312}, { -376, 816, 360}, { -384, 816, 328}, { -360, 816, 288}, { -368, 800, 312}, { -336, 808, 296}, { -304, 848, 224}, { -328, 776, 200}, { -376, 1056, 208}, // 62 seconds { -408, 832, 328}, { -440, 824, 352}, ...
// ---------------------------------------------------------------- // Sample captured: 2015-10-05 16:01:45 local AccelRawData *activity_sample_walk_100_pbl_25663_6(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_pbl_25663_6 //> TEST_EXPECTED 100 //> T...
ual_i(s_data.last_change_progress, progress); } void test_unobstructed_area_service__change_after_subscribe(void) { const GRect from_area = GRect(0, 0, DISP_COLS, 400); const GRect to_area = GRect(0, 0, DISP_COLS, 200); unobstructed_area_service_will_change(from_area.size.h, to_area.size.h); UnobstructedAreaH...
(s_data.num_will_change_calls, 1)
; cl_assert_equal_i(s_data.num_did_change_calls, 1); } void test_unobstructed_area_service__layer_no_clip(void) { app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400); Layer root_layer = { .bounds = GRect(100, 100, 200, 200), }; GRect unobstructed_bounds; layer_get_unobstructed_bounds...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
{ persist_write_int(42, value++); }
} static void trigger_loop_log_spam(int index, void *context) { while (true) { APP_LOG(APP_LOG_LEVEL_ERROR, "Crash Demo Looping Log Spam! WarbleGarbleWarbleGarbleWarble"); } } static void accel_data_handler(AccelData *data, uint32_t num_samples) { } static void trigger_to_app_event_flood(int index, void *c...
{ APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"T\": %s", buf); } r = strftime(buf, buf_size, "%u", &good_data); if (r == 0 || strncmp(buf, "2", buf_size) != 0) { APP_LOG(APP_LOG_LEVEL_DEBUG, "Error with \"u\": %s", buf); } r = strftime(buf, buf_size, "%U", &good_data); if (r == 0 || strncmp(buf, "18...
layer_add_child(window_layer, text_layer_get_layer(result_layer))
_num_timeline_adds, 12); cl_assert_equal_i(s_num_timeline_removes, 9); AlarmId invalid_id = 7; alarm_set_enabled(invalid_id, false); cl_assert_equal_i(s_num_timeline_adds, 12); cl_assert_equal_i(s_num_timeline_removes, 9); } void test_alarm__alarm_delete(void) { AlarmId id1, id2, id3, id4, id5, id6, id7; ...
(pin_attr_list, AttributeIdTitle, NULL)
; cl_assert_equal_s(pin_title, "Alarm"); const char *pin_subtitle = attribute_get_string(pin_attr_list, AttributeIdSubtitle, NULL); cl_assert_equal_s(pin_subtitle, alarm_get_string_for_kind(alarm_kind, false /* all_caps */)); const AlarmKind pin_alarm_kind = (AlarmKind)attribute_get_uint8(pin_attr_list, ...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
pfs_format(true /* write erase headers */)
; load_resource_fixture_in_flash(RESOURCES_FIXTURE_PATH, SYSTEM_RESOURCES_FIXTURE_NAME, false /* is_next */); resource_init(); memset(&s_font_info, 0, sizeof(s_font_info)); cl_assert(text_resources_init_font(0, RESOURCE_ID_GOTHIC_18_BOLD, 0, &s_font_info)); test_graphics_context_init(&ctx, fb); setup_t...
t i = 0; i < num_items; i++) { if (s_num_dls_activity_records >= 100) { cl_assert(false); } cl_assert(s_num_dls_activity_records < ARRAY_LENGTH(s_dls_activity_records)); s_dls_activity_records[s_num_dls_activity_records++] = records[i]; } } else { return DATA_LOGGING_INVALID_P...
{ ActivitySession sessions[ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT]; uint32_t num_sessions = ACTIVITY_MAX_ACTIVITY_SESSIONS_COUNT; activity_get_sessions(&num_sessions, sessions); if (num_sessions != num_expected) { printf("Expected %"PRIu32" activities, but found %"PRIu32".\n", num_expected, num_sessions); }...
koutMetricType_Speed: #if PBL_RECT /// Speed Label return i18n_noop("SPEED"); #else /// Speed Label with units return active_window->workout_controller->get_distance_string(i18n_noop("SPEED (MPH)"), i18n_noop("SPEED (KM/H)")); #...
graphics_text_node_container_add_child(container, &heart_node->node)
; break; } case WorkoutMetricType_Steps: { const size_t buffer_size = sizeof("000000"); GTextNodeText *number_text_node = health_util_create_text_node(buffer_size, number_font, TEXT_COLOR, container); active_window->wor...
--------- // Sample captured: 2015-09-28 17:11:50 local AccelRawData *activity_sample_100_steps_heather_19(int *len) { // The unit tests parse the //> TEST_.* lines below for test values //> TEST_NAME walk_100_heather_19 //> TEST_EXPECTED 100 //> TEST_EXPECTED_MIN 85 //> TEST_EXPECTED_MAX 105 //> TEST_WEIGH...
{ 1176, 272, -240}, { 1096, 272, -208}, // 5 seconds { 1152, 336, -24}, { 1192, 368, -8}, { 1192, 416, -136}, { 1336, 512, -24}, { 1280, 928, 56}, { 912, 1408, -216}, { 1448, 552, -16}, { 1080, 520, -168}, { 1216, 496, -72}, { 1608, 672, 64}, { 1800, 520, 88}, ...
{ 1216, 96, 64}, { 1112, 160, 8}, { 936, 232, -56}, { 936, 128, 24}, { 896, 48, -8}, { 704, 24, -144}, { 960, 40, 24}, { 1232, 176, -8}, { 1552, 240, -160}, // 8 seconds { 2096, 328, -200}, { 1824, 408, -288}, { 1096, 376, -320}, { 936, 320, -264}, { 1080, 11...
e_stroked) {.ctx = ctx}; } MockCallRecordings s_graphics_draw_arc_precise; void graphics_draw_arc_precise_internal(GContext *ctx, GPointPrecise center, Fixed_S16_3 radius, int32_t angle_start, int32_t angle_end) { record_mock_call(s_graphics_draw_arc_precise) { .draw_arc.c...
( "ctx.fill();\n" )
; cl_assert_equal_i(0, s_gpath_draw_filled.call_count); } void test_rocky_api_graphics_path2d__more_lines(void) { rocky_global_init(s_graphics_api); prv_create_global_ctx(); EXECUTE_SCRIPT( "ctx.beginPath();\n" "ctx.moveTo(1, 2);\n" "ctx.lineTo(3, 4);\n" "ctx.lineTo(5, 6);\n" "ctx.lineTo...
nt rv = pfs_read(-1, NULL, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_read(0, NULL, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); int fd = pfs_open("newfile", OP_FLAG_WRITE, FILE_TYPE_STATIC, rd_len); cl_assert(fd >= 0); uint8_t buf[rd_len]; rv = pfs_read(fd, buf, rd_len); cl_assert(rv == ...
(file_large, sizeof(file_large), "large%d", i)
_example; size_t test_size = sizeof(s_test_transcription_example); result = transcription_validate(validate_test, test_size); cl_assert_equal_p(result, true); result = transcription_validate(NULL, test_size); cl_assert_equal_p(result, false); result = transcription_validate(validate_test, test_size - 1); ...
{ uint8_t words_test[] = { 0, 0x04, 0x00, 't', 'e', 's', 't', 51, 0x05, 0x00, 'h', 'e', 'l', 'l', 'o', 101, 0x03, 0x00, 't', 'h', 'e' }; uint8_t *end = words_test + sizeof(words_test); uint8_t *result; result = transcription_iterate_words((TranscriptionWord *)words_test,...
void test_transcription__iterate_sentences(void) { uint8_t sentence_test[] = { // Sentence #1 0x02, 0x00, // Word count // Word #1 85, // Confidence 0x05, 0x00, // Word length 'H', 'e', 'l', 'l', 'o', // Word #2 74, // Confidence 0x08, 0x00, // Word le...
8}, { 1000, 728, -104}, { 1168, 696, -96}, { 1488, 664, -80}, { 1520, 448, -56}, // 63 seconds { 1296, 184, -88}, { 1256, 184, -120}, { 1208, 368, -96}, { 1168, 200, -32}, { 1072, 208, -96}, { 1000, 152, -64}, { 952, 232, -128}, { 752, -48, -144}, { 696, 24, -216}...
{ 1240, 312, -64}, { 1264, 328, -16}, { 1264, 288, -8}, { 1248, 200, 24}, { 1280, 184, -32}, { 1216, 232, -96}, { 1056, -136, -232}, { 680, -424, 0}, { 448, -192, -480}, { 984, -152, -560}, { 1120, -80, -256}, { 1192, 288, -352}, { 1072, 200, -392}, { 1176, 296, -...
n s_send_queue_length; } void fake_session_send_queue_set_length(uint32_t length) { s_send_queue_length = length; } static bool s_dls_private_handle_disconnect_called; void dls_private_handle_disconnect(void *data) { s_dls_private_handle_disconnect_called = true; } static bool s_comm_session_event_put; void even...
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection)
; cl_assert_equal_b(comm_session_is_valid(session), false); } void test_session__get_type_system(void) { Transport *transport = (Transport *) TransportID1; CommSession *session = comm_session_open(transport, &s_transport_imp, TransportDestinationSystem); cl_assert_equ...
app_id) { return NULL; } void watchface_launch_default(const CompositorTransition *animation) { } void process_heap_set_exception_handlers(Heap *heap, const PebbleProcessMd *app_md) { } // Tests /////////////////////////////////////////////////////////// void test_app_manager__initialize(void) { process_manager...
(s_last_to_app_event.type, PEBBLE_PROCESS_DEINIT_EVENT)
; cl_assert(app_manager_get_current_app_md() == (PebbleProcessMd*) &s_launch_app); // However, the poor app is going to crash on the way out. app_manager_get_task_context()->safe_to_kill = true; app_manager_close_current_app(false /* gracefully */); // Make sure we correctly launch the root app with the rig...
DEPTH_BITS == 8 cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_aa_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); #endif // TODO: Fix offset calculation and reenable this: - PBL-16509 #if SCREEN_COLOR_DEPTH_BITS == 8 setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, 11); ...
(&ctx.dest_bitmap, "draw_round_rect_origin_r3_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")
); setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 11); graphics_draw_round_rect(&ctx, &ORIGIN_DRAW_RECT_NO_CLIP, ((MIN(RECT_WIDTH, RECT_HEIGHT)) / 2) - 1); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_round_rect_origin_rmax_sw11_no_clip.${BIT_DEPTH_NAME}.pbi")); // Should not d...
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License....
{ return; }
} const char *window_name = window_get_debug_name(window); if (window_name) { dbgserial_putstr(window_name); } layer_dump_tree(window_get_root_layer(window)); } #endif /* UI_DEBUG */
a_out; \ const size_t data_length = strlen(ad_data_cstring) + 1; \ cl_assert_equal_i(gap_le_get_advertising_data(&ad_data_out), data_length); \ cl_assert_equal_s((const char *) &ad_data_out, ad_data_cstring); \ } //! Helper to create BLEAdData from C strings. //! In reality, people will use ble_ad_create() and t...
cl_assert(job)
; // First term: cl_assert(gap_le_is_advertising_enabled()); assert_ad_data("yo"); gap_le_assert_advertising_interval(advert_terms[0].min_interval_slots, advert_terms[0].max_interval_slots); regular_timer_fire_seconds(1); // Second term: cl_assert(gap_le_is_advertis...
g_box.origin.y += cursor->y; ctx->draw_state.drawing_box.size.h = cursor->h; // Use the drawing_box as a clipper to force the content to only use // the space available to it and remove overflow const GRect *const rect_clipper = (const GRect *const)&ctx->draw_state.drawing_box; grect_clip((GRect *const)&ctx-...
if (it->cursor_in_frame) { it->it.should_continue = false; }
er.bounds.origin.y = -TITLE_BOUNDS_OFFSET; data->artist_text_layer.layer.bounds.origin.y = -ARTIST_BOUNDS_OFFSET; data->position_text_layer.layer.bounds.origin.y = -TIME_BOUNDS_OFFSET; data->length_text_layer.layer.bounds.origin.y = -TIME_BOUNDS_OFFSET; } static inline bool prv_should_animate_casssette(void) { ...
animation_set_curve(disappear_animation, AnimationCurveEaseIn)
; GRect origin = cassette_rect; origin.origin.y -= BOUNCEBACK_OFFSET; Animation *bounceback_animation = property_animation_get_animation( property_animation_create(&s_frame_layer_implementation, &data->cassette_layer.layer, &origin, &cassette_rect)); animation_set_duratio...
0); } } // Attempts to check that the Dialog chip sleep mode is working correctly by forcing wakeups at // different times. (See PBL-39777). The timeouts delays may seem a little random but I found with // this combo of values I was able to hit the issue on both failing units I have pretty quickly. extern bool bt_te...
(ctx, fb, GContextInitializationMode_App)
; return ctx; } void watchdog_feed(void); void command_perftest_line(const char *do_aa, const char *width) { watchdog_feed(); GContext *ctx = prv_perftest_get_context(); GColor color = { .argb = (uint8_t)0x33 }; graphics_context_set_stroke_color(ctx, color); bool aa_enable = false; if (strcmp(do_aa, "a...
L_LOG(LOG_LEVEL_ERROR, "Failed to get entry for id %"PRId32, id); } else if (app_install_entry_is_watchface(&entry)) { // If the watchface is for an unsupported SDK version, we need to switch the default // watchface back to tictoc. Otherwise, we will be stuck in the launcher forever. watc...
(LOG_LEVEL_DEBUG, "make %s process safe to kill: state %u", pebble_task_get_name(task), context->closing_state)
d int original_idx; if (!revert) { original_idx = s_next_region_idx; s_next_region_idx = TOTAL_NUM_FLASH_REGIONS; } else { s_next_region_idx = original_idx; } s_ftl_size = 0; for (unsigned int i = 0; i < s_next_region_idx; i++) { s_ftl_size += prv_region_size(i); } PBL_LOG(LOG_LEVEL_DE...
{ uint32_t bytes = MIN(curr_virt_offset_end - offset, size); if (operation == FTLRead) { flash_read_bytes( buffer, s_region_list[idx].start + offset - curr_virt_offset_begin, bytes); } else if (operation == FTLWrite ) { flash_write_bytes( buffer, s_region_list[...
curr_virt_offset_begin = curr_virt_offset_end; } } void ftl_read(void *buffer, size_t size, uint32_t offset) { prv_ftl_operation(buffer, size, offset, FTLRead); } void ftl_write(const void *buffer, size_t size, uint32_t offset) { prv_ftl_operation((void *)buffer, size, offset, FTLWrite); } void ftl_erase_...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
sys_app_worker_is_running()
cense is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "app_inbox_service.h" #include "kernel/pbl_malloc.h" #include "kernel/pebble_tasks...
DEFINE_SYSCALL(bool, sys_app_inbox_service_register, uint8_t *storage, size_t storage_size, AppInboxMessageHandler message_handler, AppInboxDroppedHandler dropped_handler)
{ if (PRIVILEGE_WAS_ELEVATED) { syscall_assert_userspace_buffer(storage, storage_size); } const AppInboxServiceTag service_tag = prv_tag_for_event_handlers(message_handler, dropped_handler); if (AppInboxServiceTagInvalid == service_tag) { ...
_with_timers(start_ms + duration_total + 1 * MIN_FRAME_INTERVAL_MS); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, a), 1); cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, b), 1); cl_asser...
prv_count_handler_entries(&s_started_handler_calls, b)
, 1); cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0); // A should end high distance = prv_last_update_distance(a); cl_assert(distance > TEST_ANIMATION_NORMALIZED_HIGH); // B should start high distance = prv_last_update_distance(b); cl_assert(distance > TEST_ANIMATION_NORMAL...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
if (device1_int == NULL || device2_int == NULL) { return false; }
return (device1_int->is_classic == device2_int->is_classic && device1_int->is_random_address == device2_int->is_random_address && bt_device_address_equal(&device1_int->address, &device2_int->address)); } bool bt_device_equal(const BTDevice *device1, const BTDevice *device2) { const BTDeviceInt...
state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_get_iter_state(2) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_iter_prev(&new_idx, NULL)); cl_assert_equal_i(new_idx, 0); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_asse...
cl_assert(timeline_model_is_empty())
; }
${clar_categories} static const struct clar_suite _clar_suites[] = { ${clar_suites} }; static size_t _clar_suite_count = ${clar_suite_count}; static size_t _clar_callback_count = ${clar_callback_count}; /* Core test functions */ static void clar_report_errors(void) { int i = 1; struct clar_error *error, *next...
(argument, _clar_suites[j].name, len)
== 0) clar_run_suite(&_clar_suites[j]); } else { for (j = 0; j < (int)_clar_suite_count; ++j) if (strcmp(argument, _clar_suites[j].name) == 0) { clar_run_suite(&_clar_suites[j]); break; } } if (_clar.active_suite == NULL) { ...
sk_lookup[0b00aaddss] // or s_blending_mask_lookup[(aa << 4) | (dd << 2) | ss] const GColor8Component g_bitblt_private_blending_mask_lookup[LOOKUP_TABLE_SIZE] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 0, 0, 1, 1, 1, 1, 1, 2, 1, 2, 2, 2, 2, 2, 3, 3, 0, 1, 1, 2, 0, 1, 2, 2, 1, 1, 2, 3, 1, 2, 2, 3,...
gcolor_alpha_blend(actual_color, dest_color)
.argb; break; } case GCompOpTintLuminance: { const GColor actual_color = gcolor_perform_lookup_using_color_luminance_and_multiply_alpha( src_color, tint_luminance_lookup_table); dest[dest_x] = gcolor_alpha_blend(actual_color, dest_color).argb; ...
void framebuffer_set_line(FrameBuffer* f, uint8_t y, const uint8_t* buffer) { } GDrawState graphics_context_get_drawing_state(GContext* ctx) { return (GDrawState) { }; } void graphics_context_set_drawing_state(GContext* ctx, GDrawState draw_state) { } AnimationPrivate *animation_private_animation_find(Animation *...
compositor_transition(&s_transition_b)
; cl_assert_equal_i(s_count_animation_create, 3); cl_assert_equal_i(s_count_animation_schedule, 3); cl_assert_equal_i(s_count_compositor_init_func_a, 1); cl_assert_equal_i(s_count_compositor_init_func_b, 2); } void test_compositor__app_render_busy(void) { // Set the display as busy and then render the app. N...
v_update_handler(Animation *animation, const AnimationProgress distance) { // always ensure that animation state gives access to the current animation cl_assert_equal_p(animation_private_animation_find(animation), prv_animation_get_current()); prv_add_handler_entry(&s_update_handler_calls, animation, false, ...
prv_advance_by_ms_no_timers(10)
; // Clear handler histories prv_clear_handler_histories(); } // ------------------------------------------------------------------------------------- // Cleanup, called after each test executes void test_animation__cleanup(void) { // Make sure no animations were left over cl_assert_equal_i(prv_count_animati...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(buffer, "Woooooooo", size)
; } void good_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); syscall_assert_userspace_buffer(buffer, size); do_stuff(buffer, size); } void bad_syscall(void * buffer, int size) { syscall_internal_elevate_privilege(); do_stuff(buffer, size); } void stupid_syscall(void * buffer, in...
pandable_dialog); *expandable_dialog = (ExpandableDialog) { .header_font = fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD), }; dialog_init(&expandable_dialog->dialog, dialog_name); Window *window = &expandable_dialog->dialog.window; window_set_window_handlers(window, &(WindowHandlers) { .load = prv_ex...
{ dialog_pop(&expandable_dialog->dialog); }
oints(ctx, center.y.integer - i - special_line_offset_top, left, right, top_starting_edge, top_ending_edge, ignore_close_angles); } if (draw_bottom) { prv_draw_scanline_collision_points(ctx, center.y.integer + i +...
if (!(quadrant & radius_quadrants[0])) { for (int i=QUADRANTS_NUM - 1; i >= 0; i--) { if (quadrant & radius_quadrants[i]) { angle_end = ((i + 1) % 4) * (TRIG_MAX_ANGLE / 4); break; } } } else { for (int i=1; i <= QUADRANTS_NUM; i++) { if (!(quadrant & ra...
complete = true; result = (bus->state->transfer_event == I2CTransferEvent_TransferComplete); } else if (bus->state->transfer_nack_count < I2C_NACK_COUNT_MAX) { // NACK received after start condition sent: the MFI chip NACKs start conditions whilst it // is busy // Retry start con...
{ bus->state->transfer_event = event; return prv_semaphore_give_from_isr(bus->state); }
/*------------------------ANALYTICS----------------------------------*/ static void prv_analytics_track_i2c_error(void) { analytics_inc(ANALYTICS_DEVICE_METRIC_I2C_ERROR_COUNT, AnalyticsClient_System); } void analytics_external_collect_i2c_stats(void) { analytics_set(ANALYTICS_DEVICE_METRIC_I2C_MAX_TRANSFER_DUR...
FILE_TYPE_STATIC, 0); cl_assert(fd >= 0); for (int i = 0; i < num_regions; i++) { cl_assert_equal_i(pfs_seek(fd, i * sizeof(buf), FSeekSet), i * sizeof(buf)); uint8_t read_byte; for (int j = 0; j < 16; j++) { cl_assert_equal_i(pfs_read(fd, &read_byte, sizeof(read_byte)), sizeof(read_byte)); ...
pfs_read(fd, buf, rd_len)
; cl_assert(rv == rd_len); rv = pfs_read(fd, buf, 1); cl_assert(rv == E_RANGE); rv = pfs_seek(fd, 0, FSeekSet); cl_assert(rv == 0); rv = pfs_read(fd, NULL, rd_len); cl_assert(rv == E_INVALID_ARGUMENT); rv = pfs_read(fd, buf, rd_len + 1); cl_assert(rv == E_RANGE); } void test_pfs__close(void) { // s...
.timestamp = 1421183642, // Tue Jan 13 13:14:02 2015 PST .duration = 2, .type = TimelineItemTypePin, .flags = 0, .layout = LayoutIdTest, }, .attr_list = { .num_attributes = 0, .attributes = NULL, }, .action_group = { .num_actions = 0, ...
cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_state_with_timeline_idx(1))
; cl_assert(timeline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(2)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 3); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_or...
ate_text(data); // Subscribe to health update events health_service_events_subscribe(prv_health_event_handler, data); // Set a heart rate alert HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 80); APP_LOG(APP_LOG_LEVEL_INFO, "health metric alert: %p", alert); if (...
window_stack_pop(true)
; window_stack_push(data->steps_window, true /* Animated */); } // ------------------------------------------------------------------------------- static void prv_hr_down_click_handler(ClickRecognizerRef recognizer, void *context) { HealthAPITestAppData *data = (HealthAPITestAppData *)context; window_stack_pop(...
value + nf->step_size; if (new_val <= nf->max_val && new_val > nf->value) { nf->value = new_val; is_increased = true; } if (is_increased) { if (nf->callbacks.incremented != NULL) { nf->callbacks.incremented(nf, nf->callback_context); } update_output_value(nf); } } static void down_cli...
if (nf->max_val < min) { nf->max_val = min; }
} void number_window_set_value(NumberWindow *nf, int32_t value) { nf->value = value; if (nf->value > nf->max_val) { nf->value = nf->max_val; } if (nf->value < nf->min_val) { nf->value = nf->min_val; } update_output_value(nf); } void number_window_set_step_size(NumberWindow *nf, int32_t step) { ...
context, GPoint(50, 50), 10)); setup_test(&context, false, 5, GColorBlack, GColorBlack, false); graphics_fill_round_rect(&context, &GRect(20, 80, 40, 10), 4, GCornersAll); ASSERT_CALLED(prv_fill_rect_non_aa(&context, &GRect(20, 80, 40, 10), 4, GCornersAll, GColorBlack)); } void test_graphics_context_${BIT_DEPTH...
GRect(20, 80, 40, 10)
, 4)); setup_test(&context, true, SW_EVEN, GColorBlack, GColorBlack, true); ASSERT_NO_CHANGE(graphics_draw_line(&context, GPoint(5, 5), GPoint(45, 10))); ASSERT_NO_CHANGE(graphics_draw_rect(&context, &GRect(10, 20, 40, 10))); ASSERT_NO_CHANGE(graphics_draw_circle(&context, GPoint(50, 50), 10)); ASSERT_NO_CHA...
{ scroll_layer->shadow_sublayer.frame = internal_rect; scroll_layer->shadow_sublayer.bounds = internal_rect; }
layer_set_frame(&scroll_layer->content_sublayer, &internal_rect); } void scroll_layer_init(ScrollLayer *scroll_layer, const GRect *frame) { *scroll_layer = (ScrollLayer){}; layer_init(&scroll_layer->layer, frame); const GRect *bounds = &scroll_layer->layer.bounds; scroll_layer->layer.property_changed_proc...
accel_manager_mutex); PBL_ASSERTN(s_double_tap_subscribers_count > 0); if (--s_double_tap_subscribers_count == 0) { PBL_LOG(LOG_LEVEL_DEBUG, "Stopping accel double tap service"); accel_enable_double_tap_detection(false); prv_setup_subsampling(accel_get_sampling_interval()); } mutex_unlock_recursiv...
prv_setup_subsampling(interval_us)
PeekLayer *peek_layer = &data->peek_layer; peek_layer_play(peek_layer); layer_add_child(root_layer, (Layer *)peek_layer); const int standing_ms = 1 * MS_PER_SECOND; data->peek_layer_timer = evented_timer_register(PEEK_LAYER_UNFOLD_DURATION + standing_ms, ...
(animation, AnimationCurveEaseOut)
is_button_down = true; prv_cancel_timer(&recognizer->multi_click_timer); const bool needs_reset = false; prv_dispatch_event(recognizer, ClickHandlerOffsetRawDown, needs_reset); if (prv_is_long_click_enabled(recognizer)) { const uint32_t long_click_delay = prv_long_click_get_delay(recognizer); recogni...
prv_click_reset(&click_manager->recognizers[button_id])
; click_manager->recognizers[button_id].config = (ClickConfig){}; } } void click_manager_reset(ClickManager* click_manager) { for (unsigned int button_id = 0; button_id < NUM_BUTTONS; button_id++) { prv_click_reset(&click_manager->recognizers[button_id]); } }
pache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and...
(msg_text_layer, GTextAlignmentCenter)
; text_layer_set_background_color(msg_text_layer, GColorBlack); text_layer_set_text_color(msg_text_layer, GColorWhite); text_layer_set_font(msg_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); layer_add_child(&window->layer, &msg_text_layer->layer); msg_text_layer = &data->msg_text_layer[1]; te...
0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01}, .app_version = { .major = 1, .minor = 1, }, .sdk_version = { .major = 1, .minor = 1, }, .info_flags = 0, .icon_resource_id = 0, }; static const AppDBEntry app3 = { .name = "Application 3", .uuid = {0x7c, 0x65, 0x2e, 0xb9, 0x26, ...
(true, uuid_equal(&app3.uuid, &temp.uuid))
; } void test_app_db__retrieve_app_db_entries_by_uuid(void) { AppDBEntry temp; // check app_db_get_install_id_for_uuid for app 1 memset(&temp, 0, sizeof(AppDBEntry)); cl_assert_equal_i(S_SUCCESS, app_db_get_app_entry_for_uuid(&app1.uuid, &temp)); cl_assert_equal_b(true, uuid_equal(&app1.uuid, &temp.uuid)); ...
------------ // Test a basic gpoint property animation void test_animation__property_gpoint(void) { #ifdef TEST_INCLUDE_BASIC PropertyAnimation *prop_h; GPoint value; GPoint start_value, end_value; const int duration = 200; const int delay = 25; const AnimationHandlers handlers = { .started = prv_start...
cl_assert_equal_gtransform(test_value, start_value)
; property_animation_get_to_gtransform(prop_h, &test_value); cl_assert_equal_gtransform(test_value, end_value); GTransform set_value; set_value = GTransformIdentity(); property_animation_set_from_gtransform(prop_h, &set_value); property_animation_get_from_gtransform(prop_h, &test_value); cl_assert_equal...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(session_id == s_session_id)
; } Transport *s_transport; void test_audio_endpoint__initialize(void) { fake_comm_session_init(); s_setup_complete_call_count = 0; s_transport = fake_transport_create(TransportDestinationSystem, NULL, NULL); s_session = fake_transport_set_connected(s_transport, true); s_session_id = audio_endpoint_setup_t...
ic); if (client && is_data) { *is_data = (client->characteristics.data == characteristic); } return client; } // ------------------------------------------------------------------------------------------------- static bool prv_uuid_filter_callback(ListNode *found_node, void *data) { const PPoGATTClient *c...
MIN(PPOGATT_V1_DESIRED_RX_WINDOW_SIZE, PPOGATT_SN_MOD_DIV - 1)
; client->out.rx_window_size = desired_rx_window; } else { client->out.tx_window_size = client->out.rx_window_size = PPOGATT_V0_WINDOW_SIZE; } if (self_initiated) { client->out.reset_packet_to_send.type = PPoGATTPacketTypeResetRequest; client->state = StateConnectedClosedAwaitingResetCompleteSelf...
// and make sure that the contents of the settings_file are not corrupted // in any way. // Simulate a reboot by clearing out PFS's state. fake_spi_flash_force_future_failure(0, NULL); extern void pfs_reset_all_state(void); pfs_reset_all_state(); pfs_init(false); // Reopen the file we were...
(key_i, val_i)
ed int *major, unsigned int *minor, const char **patch_ptr) { *major = GIT_TAG_V_MAJOR; *minor = GIT_TAG_V_MINOR; *patch_ptr = GIT_TAG_V_PATCH; } // --------------------------------------------------------------------------------------------- // The transport callback we pass t...
uuid_to_string(&s_parsed_msg.msrmt.uuid, uuid_str)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(LOG_LEVEL_DEBUG, "Advert Enable: %"PRIu8, msg->payload[0])
; break; case HcMessageID_Advert_SetAdvData: PBL_LOG(LOG_LEVEL_DEBUG, "Advert SetAdvData: %"PRIu8, msg->payload[0]); break; case HcMessageID_Advert_Disable: // NYI break; default: PBL_LOG(LOG_LEVEL_DEBUG, "HcAdvert Response: unhandled message id: %d", msg->command_id); ...
ceId " \ "attribute"); } prv_add_attribute(list, id)->uint32 = resource_id; } void attribute_list_add_uint8(AttributeList *list, AttributeId id, uint8_t uint8) { if (prv_attribute_type(id) != AttributeTypeUint8) { PBL_LOG(LOG_LEVEL_WARNING, "Adding attribute with type uint8 for non-uint8_t attrib...
attribute_find(attr_list, id)
; return attribute ? attribute->uint32 : default_value; } Uint32List *attribute_get_uint32_list(const AttributeList *attr_list, AttributeId id) { PBL_ASSERTN(attr_list != NULL); PBL_ASSERTN(prv_attribute_type(id) == AttributeTypeUint32List); Attribute *attribute = attribute_find(attr_list, id); return attrib...
platform loaded PNG void test_png__color_1_bit_transparent(void) { GBitmap *bitmap = setup_png_test(TEST_PNG_FILE_FMT(1bitpalette)); cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE_FMT(1bitpalette))); cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat1BitPalette); } // Tests 2-bit transparent palettized ...
TEST_PBI_FILE_FMT(8bit)
)); // Make sure bpp detection doesn't fail in the future cl_assert_equal_i(gbitmap_get_format(bitmap), GBitmapFormat8Bit); } // Tests 8-bit transparent color PNG with 256 Colors // loading into gbitmap // Checks for bug fixed for PBL-16549, where uint8_t limit was 255 // causing failure to load palette // Result:...
static void prv_send_subscriber_event(Recognizer *recognizer) { RecognizerEvent event; switch (recognizer->state) { case RecognizerState_Started: event = RecognizerEvent_Started; break; case RecognizerState_Updated: event = RecognizerEvent_Updated; break; case RecognizerState_C...
{ PBL_ASSERTN(recognizer); PBL_ASSERTN(recognizer->state == RecognizerState_Possible); prv_set_state(recognizer, RecognizerState_Failed); if (recognizer->impl->on_fail) { recognizer->impl->on_fail(recognizer); } }
void recognizer_set_manager(Recognizer *recognizer, RecognizerManager *manager) { PBL_ASSERTN(recognizer); recognizer->manager = manager; } RecognizerManager *recognizer_get_manager(Recognizer *recognizer) { PBL_ASSERTN(recognizer); return recognizer->manager; } /////////////////////////////////////////////...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
time_util_get_midnight_of(timestamp)
) { const char *starts = i18n_get("STARTS ", layout); // Freed by `timeline_layout_deinit` starts_len = strlen(starts); strncpy(buffer, starts, buffer_size); } clock_get_until_time_capitalized(buffer + starts_len, buffer_size - starts_len, timestamp, max_relative_hrs);...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&s_ctx.dest_bitmap, TEST_PBI_FILE)
); } void test_workout_selection__render_walk_selected(void) { prv_create_window_and_render(1); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE)); } void test_workout_selection__render_workout_selected(void) { prv_create_window_and_render(2); cl_check(gbitmap_pbi_eq(&s_ctx.dest_bitmap, TEST_PBI_FILE...
}, { -280, 1016, -384}, { -392, 1048, -264}, { -560, 1024, -312}, // 39 seconds { -528, 904, -272}, { -440, 560, -384}, { -352, 688, -728}, { -272, 624, -480}, { -208, 880, -640}, { -512, 896, -600}, { -464, 1072, -800}, { -504, 1088, -816}, { -608, 1208, -696}, {...
{ 296, -272, -912}, { 280, -256, -896}, { 288, -272, -912}, { 272, -272, -920}, { 264, -240, -952}, { 248, -224, -928}, { 232, -200, -968}, { 224, -176, -952}, { 216, -168, -968}, { 200, -168, -960}, { 208, -184, -984}, { 200, -136, -1000}, { 208, -88, -992}, { 20...
{ -136, 808, -416}, { -168, 872, -408}, { -184, 920, -352}, // 47 seconds { -184, 984, -464}, { -160, 784, -496}, { -64, 808, -600}, { -152, 872, -272}, { -248, 840, -88}, { -264, 848, -176}, { -256, 840, -240}, { -216, 888, -288}, { -176, 888, -336}, { -144, 880...
eline_model_get_iter_state(1) == timeline_model_get_iter_state_with_timeline_idx(3)); cl_assert(timeline_model_iter_next(&new_idx, &has_next)); cl_assert(has_next); cl_assert_equal_i(new_idx, 4); cl_assert_equal_i(timeline_model_get_num_items(), 2); cl_assert(uuid_equal(&s_items[s_correct_order[2]].header.id...
uuid_equal(&s_items[s_correct_order[2]].header.id, &timeline_model_get_iter_state(0)->pin.header.id)
); cl_assert(uuid_equal(&s_items[s_correct_order[3]].header.id, &timeline_model_get_iter_state(1)->pin.header.id)); cl_assert(uuid_equal(&s_items[s_correct_order[4]].header.id, &timeline_model_get_iter_state(2)->pin.header.id)); cl_assert(timeline_model_get_iter_state(0) == timeline_model_get_iter_sta...
t_timeline__extra_case_none_forwards(void) { prv_insert_extra_case_items(); Iterator iterator = {0}; TimelineIterState state = {0}; TimelineNode *head = NULL; timeline_init(&head); cl_assert_equal_i(timeline_iter_init(&iterator, &state, &head, TimelineIterDirectionFuture, s_feb_5_midnight + 11 * 60 * ...
(&state.pin.header.id, &s_items[3].header.id)
ven cols of different lengths setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, false, 1); graphics_draw_vertical_line_dotted(&ctx, GPoint(0, 0), MAX_NUM_ROWS); graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4); graphics_draw_vertical_line_dotted(&ctx, GPoint(4, 0), 0);...
graphics_draw_vertical_line_dotted(&ctx, GPoint(2, 0), MAX_NUM_ROWS + 4)
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
prv_get_dimensions_for_runtime_platform_default_size()
->title_subtitle_left_margin; } static ALWAYS_INLINE GFont prv_get_cell_title_font(const MenuCellLayerConfig *config) { return config->title_font ?: system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle); } static ALWAYS_INLINE GFont prv_get_cell_subtitle_font(const MenuCellLayerConfig *config) { ret...
&func); if (jerry_value_has_error_flag(arg_result)) { return jerry_acquire_value(arg_result); } bool is_relevant = false; API_REFS_FOREACH(api_ref) { if ((*api_ref)->add_handler) { is_relevant = (*api_ref)->add_handler(event_name, func); if (is_relevant) { brea...
task_free(event_name)
; jerry_release_value(args.this_arg); } static void prv_call_event_handlers_async_cb(void *ctx) { jerry_value_t event = (jerry_value_t)(uintptr_t) ctx; rocky_global_call_event_handlers(event); jerry_release_value(event); // was acquired in rocky_global_call_event_handlers_async() call } void rocky_global_cal...
------------------ static void prv_gpoint_setter(GPoint *p, GPoint value) { *p = value; } static GPoint prv_gpoint_getter(GPoint *p) { return *p; } // -------------------------------------------------------------------------------------- static void prv_gtransform_setter(GTransform *p, GTransform value) { *p =...
animation_schedule(h)
; int max_loops = 20; uint64_t start_ms = prv_now_ms(); uint64_t time_ms; while (s_stopped_handler_calls.num_calls == 0) { prv_fire_animation_timer(); time_ms = prv_now_ms(); DPRINTF("%"PRIu64": frame at: %d, %d, %d %d\n", time_ms - start_ms, layer.frame.origin.x, layer.frame.origin.y,...
uchEvent_PositionUpdate }; // No active recognizers because manager is waiting for a touchdown event recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed(NULL, 0, &s_recognizers_handled); // Touchdown event occurs, active layer is found and all applicable recognizers receive ...
cl_assert_equal_i(recognizers[3]->state, RecognizerState_Updated)
; // Layer A recognizer's gesture completes and all recognizers are reset e.type = TouchEvent_Liftoff; s_next_state = RecognizerState_Completed; s_idx_to_change = 3; recognizer_manager_handle_touch_event(&e, &manager); prv_compare_recognizers_processed((int[]) {3}, 1, &s_recognizers_handled); prv_compare...
RIGIN_RECT_NO_CLIP, true, RADIUS_BIG * 2); graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_end, angle_start); cl_check(framebuffer_is_empty(NULL, ctx.parent_framebuffer, GColorWhite)); // table with most popular angles to test typedef struct { char *filename_part; uint32_t ang...
(&ctx, GColorRed)
; graphics_context_set_stroke_color(&ctx, GColorGreen); graphics_draw_arc_internal(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_BIG, angle_start, angle_end); cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "draw_arc_origin_aa_letter_c_color_4px.8bit.pbi")); } #define DRAWING_SPACING 40 char *mode_names[] = { "_90_degrees", ...
nager.h" #include "stubs_new_timer.h" #include "stubs_passert.h" #include "stubs_pbl_malloc.h" #include "stubs_pebble_process_md.h" #include "stubs_pebble_tasks.h" #include "stubs_persist.h" #include "stubs_queue.h" #include "stubs_resources.h" #include "stubs_syscalls.h" #include "stubs_task.h" #include "stubs_tick.h"...
{ return s_rocky_app_validate_resources__result; }
static PebbleEvent* s_event_put__event; void event_put(PebbleEvent* event) { s_event_put__event = event; cl_assert(event != NULL); } void event_put_from_app(PebbleEvent* event) { cl_fail("unexpected"); } void event_put_from_process(PebbleTask task, PebbleEvent* event) { cl_fail("unexpected"); } void event_reset_...
84889600,"29","07"}, {1184976000,"29","07"},{1185062400,"29","07"},{1185148800,"30","07"},{1185235200,"30","07"},{1185321600,"30","07"},{1185408000,"30","07"},{1185494400,"30","07"}, {1185580800,"30","07"},{1185667200,"30","07"},{1185753600,"31","07"},{1185840000,"31","07"},{1185926400,"31","07"},{1186012800,"31","...
("%d: %ld(%d,%d,%d,%d), ", i, s_iso8601_data[i].stamp, wrk.tm_yday,wrk.tm_year,wrk.tm_mon,wrk.tm_mday)
; tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%V", &wrk); cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_V); printf("%s, ", tmbuf); tmbuf[0] = '\0'; strftime(tmbuf, sizeof(tmbuf), "%g", &wrk); cl_assert_equal_s(tmbuf, s_iso8601_data[i].str_g); printf("%s\n", tmbuf); } } #endif #i...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&francois_birthday)
, 612528240); struct tm rons_birthday = { .tm_sec = 17, .tm_min = 1, .tm_hour = 9, .tm_mday = 10, .tm_mon = 4, .tm_year = 63, }; cl_assert_equal_i(mktime(&rons_birthday), -1); struct tm alex_marianetti_birthday = { .tm_sec = 29, .tm_min = 4, .tm_hour = 17, .tm_mday = 2,...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
list_find(list, prv_service_filter, (void*)(uintptr_t)service_index)
period of high-rate advertising will be used. When this short //! period is completed, an indefinite, low-rate job will be scheduled. static void prv_schedule_ad_job(void) { BLEAdData *ad = ble_ad_create(); // Advertisement part: // Centrals will be filtering on Service UUID first. Assuming that the // central...
( ad, &advert_term, sizeof(advert_term)/sizeof(GAPLEAdvertisingJobTerm), prv_job_unschedule_callback, NULL, GAPLEAdvertisingJobTagDiscovery)
; #endif ble_ad_destroy(ad); } // ----------------------------------------------------------------------------- bool gap_le_slave_is_discoverable(void) { bool is_discoverable = false; bt_lock(); { is_discoverable = (s_discovery_advert_job != NULL); } bt_unlock(); return is_discoverable; } // -----...
/* * Copyright 2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to i...
(&tim_config)
; tim_config.TIM_Period = resolution - 1; tim_config.TIM_Prescaler = timer_find_prescaler(&pwm->timer, frequency); tim_config.TIM_CounterMode = TIM_CounterMode_Up; tim_config.TIM_ClockDivision = 0; TIM_TimeBaseInit(pwm->timer.peripheral, &tim_config); // PWM Mode configuration TIM_OCInitTypeDef tim_oc_in...
te, additional_crumbs); } } void prv_prepare_canvas_and_render_action_menus_static(const ActionMenuLevel *root_level, unsigned int selected_index, unsigned int additiona...
(root_level, thin_values[i], prv_noop_action_callback, NULL)
; } const unsigned int selected_index = 1; prv_prepare_canvas_and_render_action_menus_static(root_level, selected_index, 0); cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE)); } void test_action_menu_window__thin_display_mode_one_item(void) { static const char* thin_values[] = { "Y" }; ActionMenuLeve...
This is the message we should get back if we try and use floating point const char* fp_msg = "floating point not supported in snprintf"; //---------------------------------------------------- pbl_snprintf(str, STR_SIZE, "%", 1); // Make sure we don't barf if no type cl_assert_equal_s(str, ""); pbl_snprint...
pbl_override_difftime(1, 0)
, 1); cl_assert_equal_i(pbl_override_difftime(2147483647, 0), 2147483647); }
attribute_get_uint32_list(attributes, AttributeIdMetricIcons); if (!icons) { return NULL; } // String list access is out-of-bounds safe, so use the Uint32List num_values const size_t num_metrics = icons->num_values; if (!num_metrics) { return NULL; } if (num_metrics > 1) { layout->num_metric...
( layout, (LayoutNodeVerticalConfig *)config)