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... | {
return (PropertyAnimationPrivate *)animation_private_animation_find((Animation *)handle);
} |
// -----------------------------------------------------------------------------------------
void property_animation_update_int16(PropertyAnimation *property_animation_h,
const uint32_t distance_normalized) {
if (animation_private_using_legacy_2(NULL)) {
// We need to enabl... |
1_CONFIG = 0x12,
PmicRegisters_LDO2_CONFIG = 0x14,
PmicRegisters_LDO3_CONFIG = 0x16,
PmicRegisters_MON_CFG = 0x19,
PmicRegisters_PWR_CFG = 0x1F
} PmicRegisters;
//! The different power rails that our PMIC controls
typedef enum PmicRail {
PmicRail_BUCK1, //!< 1.2V
PmicRail_BUCK2, //!< 1.8V
PmicRail_LDO1, ... | (PmicRegisters_PWR_CFG, 0xB2) | ;
if (ret) {
// Goodbye cruel world. The PMIC should be removing our power at any time now.
while (1) {}
__builtin_unreachable();
}
return false;
}
static bool prv_set_mon_config_register(uint8_t value) {
return prv_write_register(PmicRegisters_MON_CFG, value);
}
static bool prv_set_mon_config(... |
cl_assert(*word_iter_state.current.end == '\n') | ;
cl_assert(word_iter_state.current.width_px == HORIZ_ADVANCE_PX * 0);
line_reset(&line, utf8_bounds.start);
cl_assert(line_add_words(&line, &word_iter, NULL));
cl_assert(line.height_px == 10);
cl_assert(line.width_px == HORIZ_ADVANCE_PX * 0);
cl_assert(line.origin.x == 0);
cl_assert(line.suffix_codepoin... | |
test_message_handler, test_dropped_handler);
cl_assert_equal_p(result, NULL);
}
void test_app_inbox__app_inbox_create_and_register_null_message_handler(void) {
void *result = app_inbox_create_and_register(BUFFER_SIZE, 1, NULL, test_dropped_handler);
cl_assert_equal_p(result, ... | fake_kernel_malloc_mark_assert_equal() | ;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// app_inbox_service_begin
static void *s_writer = (void *) 0xaabbccdd;
static void *s_inbox;
static void prv_create_test_inbox(void) {
s_inbox = app_inbox_create_and_register(BUFFER_SIZE, 1,
... |
l_activity_session(minute_raw_data, k_minute_data_len, &exp_session);
// Insert a 3 minute rest period in the middle
for (int i = 20; i < 23; i++) {
minute_raw_data[i] = (KAlgTestActivityMinute) { };
}
exp_session.steps -= 3 * 150;
exp_session.resting_calories -= 3 * 100;
exp_session.activ... | {
// Init algorithm state
s_kalg_state = kernel_zalloc(kalg_state_size());
// It's easier to understand the algorithm log messages if we start at 0 time
rtc_set_time(0);
memset(s_kalg_state, 0, kalg_state_size());
kalg_init(s_kalg_state, prv_stats_cb);
s_num_captured_sleep_sessions = 0;
// Get the sam... | |
XED_S16_3_PRECISION) /
offset_radius_sq) << FIXED_S16_3_PRECISION))
};
}
static GPointPrecise prv_get_rotated_precise_point(GPointPrecise center, uint16_t radius,
uint32_t angle) {
return GPointPrecise((center.x.raw_value + radius *... | graphics_private_set_pixel(ctx, GPoint(p.x - y, p.y - x)) | |
/*
* 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... | attribute_list_init_list(num_existing_attributes, &new_attr_list) | |
GBitmap icon_volume_up;
GBitmap icon_volume_down;
GBitmap image_cassette;
GBitmap image_pause;
GBitmap image_volume_up;
GBitmap image_volume_down;
Layer cassette_container;
BitmapLayer cassette_layer;
GBitmap *cassette_current_icon;
EventServiceInfo event_info;
ProgressLayer track_pos_bar;
ui... | prv_create_layer_bounceback_animation(&data->title_text_layer.layer, prv_title_rect()) | ,
prv_create_layer_bounceback_animation(&data->position_text_layer.layer, time_rect),
prv_create_layer_bounceback_animation(&data->length_text_layer.layer, time_rect),
NULL);
}
static void prv_update_track_progress(MusicAppData *data);
static void prv_flip_animated_text(Animation *animation, bool fi... |
ging.h"
#include "stubs_mutex.h"
#include "stubs_passert.h"
#include "stubs_rtc.h"
void bt_driver_reconnect_notify_platform_bitfield(uint32_t p) {}
static bool s_session_is_system;
bool comm_session_is_system(CommSession *session) {
return s_session_is_system;
}
static bool s_session_is_valid;
bool comm_session_is... | fake_event_get_count() | , 1);
PebbleEvent e = fake_event_get_last();
cl_assert_equal_i(e.type, PEBBLE_REMOTE_APP_INFO_EVENT);
cl_assert_equal_i(s_capability_flags, s_expected_capabilities);
}
void test_session_remote_version__app_session(void) {
s_session_is_system = false;
prv_receive_v3_response(3, 2, 1, s_expected_capabilities);... |
/*
* 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_remove(&session->node, (ListNode **) &s_session_head, NULL) | ;
kernel_free(session);
++s_session_close_call_count;
}
void comm_session_receive_router_write(CommSession *session,
const uint8_t *received_data,
size_t num_bytes_to_copy) {
PBL_LOG(LOG_LEVEL_DEBUG, "Received Data:");
PBL_HEXDUMP(LO... |
/*
* 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->data) | ;
// Incrementing open_count insures that no one else can do a dls_unlock_session(inactivate=true)
// on it and cause it to be freed before we grab the session->data->mutex below.
session->data->open_count++;
mutex_unlock_recursive(s_list_mutex);
mutex_lock(session->data->mutex);
return true;
}
// -----... |
AnimationPrivate* animation = (AnimationPrivate *)node;
ParentChildInfo *info = (ParentChildInfo *)data;
return animation->parent == info->parent && animation->child_idx == info->child_idx;
}
static AnimationPrivate* prv_find_animation_by_parent_child_idx(AnimationState *state,
AnimationPrivate *par... | for (child_idx = 0; child_idx < ANIMATION_MAX_CHILDREN; child_idx++) {
AnimationPrivate *child = prv_find_animation_by_parent_child_idx(state, animation, child_idx);
if (!child) {
break;
}
child_duration = prv_get_total_duration(state, child, true, true);
if (child_duration == PLAY... |
duration += max_child_duration;
} else {
PBL_ASSERTN(animation->type == AnimationTypePrimitive);
duration += animation->duration_ms;
}
if (include_play_count) {
// Factor in the play count of this animation now
if (animation->play_count == ANIMATION_PLAY_COUNT_INFINITE_STORED) {
durat... |
a_handler(DMARequest *request, void *context, bool is_complete);
//! Initialize power management for the microphone. Note that different boards have different
//! ways of configuring power to the mic.
static void prv_mic_power_init(void) {
if (BOARD_CONFIG.mic_config.mic_gpio_power.gpio) {
gpio_use(BOARD_CONFIG.... | {
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_initialized);
mutex_lock_recursive(s_mic_mutex);
bool success = false;
if (s_running) {
goto unlock;
}
prv_mic_power_enable();
circular_buff... |
ed_server_cleanup_by_connection(GAPLEConnection *connection) {
}
void launcher_task_add_callback(void (*callback)(void *data), void *data) {
callback(data);
}
// Tests
///////////////////////////////////////////////////////////
void test_bluetooth_persistent_storage__initialize(void) {
bonding_sync_init();
fak... | cl_assert_equal_i(fake_shared_prf_storage_get_ble_store_count(), 1) | ;
cl_assert_equal_b(bt_persistent_storage_has_pinned_ble_pairings(), false);
// Read it back
ret = bt_persistent_storage_get_ble_pairing_by_id(id_1, &irk_out, &device_out, NULL /* name */);
cl_assert(ret);
cl_assert_equal_m(&irk_out, &pairing_1.irk, sizeof(irk_out));
cl_assert_equal_m(&device_out, &pairing... |
nt_action = true;
return true;
}
static void prv_support_sms_replies(void) {
// Store the preference in our DB
char *key = "com.apple.MobileSMS";
int key_len = strlen(key);
const int flags = 0;
const int num_attributes = 0;
const int num_actions = 1;
const int action_id = 12;
const int reply_action_a... | cl_assert_equal_s(response_action->attr_list.attributes[0].cstring, "Reply") | ;
cl_assert_equal_i(response_action->attr_list.attributes[1].id, AttributeIdEmojiSupported);
cl_assert_equal_i(response_action->attr_list.attributes[1].uint8, 1);
ActionMenuItem menu_item = (ActionMenuItem) {
.action_data = ¬if->action_group.actions[1],
};
s_expected_send_data = s_sms_action_data;
t... |
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 in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIE... | attribute_list_add_cstring(&list, AttributeIdLocationName,
"SAN LOUIS OBISPO\n"
"CALIFORNIA, USA") | ;
attribute_list_add_cstring(&list, AttributeIdBody,
"Cloudy with rain and snow. High 1C. Winds light and variable. "
"Chance of precip 100%. 3-7cm of snow expected.");
attribute_list_add_uint32(&list, AttributeIdLastUpdated, now);
if (!has_timestamp) {
... |
EPTH_NAME}__filled_clipped_aa(void) {
GContext ctx;
Layer layer;
prv_reset();
test_graphics_context_init(&ctx, fb);
s_current_path = s_house_path;
ctx.draw_state.clip_box = GRect(0, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT / 2);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc... | GPoint(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2) | );
s_path_angle = 70;
test_graphics_context_init(&ctx, fb);
graphics_context_set_antialiased(&ctx, true);
prv_filled_update_proc(NULL, &ctx);
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "gpath_filled_infinite_70_aa.8bit.pbi"));
// House path - two edge cases for tipping points of the path
prv_reset();
s_... |
e received
const uint32_t data_length = mbuf_get_chain_length(mbuf_get_next(s_read_header_mbuf));
mbuf_free(s_read_header_mbuf);
s_read_header_mbuf = NULL;
SmartstrapResult result = SmartstrapResultOk;
if (!success) {
result = SmartstrapResultTimeOut;
} else if ((length < sizeof(FrameInfo)) ||
(he... | if (!s_has_done_service_discovery &&
(current_time > s_last_service_discovery_time + MIN_SERVICE_DISCOVERY_INTERVAL) &&
smartstrap_link_control_is_profile_supported(SmartstrapProfileGenericService)) {
prv_send_service_discovery(NULL);
s_last_service_discovery_time = current_time;
return true;
... |
return false;
}
static void prv_read_aborted(void) {
mbuf_free(s_read_header_mbuf);
s_read_header_mbuf = NULL;
mbuf_free(s_reserved_read_mbuf);
s_reserved_read_mbuf = NULL;
}
const SmartstrapProfileInfo *smartstrap_generic_service_get_info(void) {
static const SmartstrapProfileInfo s_generic_service_info... |
next(&iterator));
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[2].header.id));
// check fifth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(&state.pin.header.id, &s_items[1].header.id));
// check sixth
cl_assert(iter_next(&iterator));
cl_assert(uuid_equal(... | iter_next(&iterator) | |
tub_height) {
// Show the minimum stub bar if progress just began
bar_height = minimum_stub_height;
}
return bar_height;
}
static void prv_setup_day_bar_box(int weekday, GRect *box, int16_t bar_height) {
const int w = 23; // normal bar width;
#if PBL_RECT
// The center bars are slightly wider than the ... | (i, &box, last_bar_height) | ;
const GColor bar_color = prv_get_bar_color(graph_card, is_active, false /* wide bar */);
prv_draw_day_bar(ctx, i, &box, bar_color, false /* wide bar */);
}
// Draw the day bar
prv_setup_day_bar_box(i, &box, bar_height);
const bool is_wide = prv_bar_should_be_wide(i, graph_card->current_da... |
graphics_draw_pixel(ctx, GPoint(p.x + 1, p.y + 2)) | ;
graphics_draw_pixel(ctx, GPoint(p.x + 2, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 3, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 4, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 5, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 6, p.y + 2));
graphics_draw_pixel(ctx, GPoint(p.x + 7, p.y +... | |
ze);
iter = prv_read_ptr(iter, data + length, &value_bytes, value_size);
// If we read too many bytes or didn't read all the bytes (2nd test)
if (!iter || (iter != (data + length))) {
prv_send_response(session, token, BLOB_DB_INVALID_DATA);
return;
}
// perform action on database and return result
... | (data, length) | , BLOB_DB_TRY_LATER);
return;
}
prv_blob_db_msg_decode_and_handle(session, cmd, data, data_length);
}
void blob_db_set_accepting_messages(bool enabled) {
s_bdb_accepting_messages = enabled;
}
|
/*
* 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_erase_sector(state, 0) | ;
// Return a non-zero code to indicate the erase is still in process
return S_TRUE;
}
static status_t external_flash_domain_open(uint8_t *packet_data, size_t length, void **resp) {
return S_SUCCESS;
}
static status_t external_flash_domain_close(void *context) {
return S_SUCCESS;
}
PulseBulkIODomainHandler ... |
sizeof(Tuple))
////////////////////////////////////////////////////////////////////////////////
// API: "postmessageerror" event
////////////////////////////////////////////////////////////////////////////////
static void prv_free_json_buffer_associated_with_postmessageerror_event(const uintptr_t ptr) {
task_free((... | {
if (argc < 1) {
return rocky_error_arguments_missing();
}
const jerry_value_t js_msg = argv[0];
JS_VAR json_string = prv_json_stringify(js_msg);
if (jerry_value_has_error_flag(json_string)) {
return jerry_acquire_value(json_string);
}
if (jerry_value_is_undefined(json_string)) {
// ECMA v5... |
////////////////////////////////////////////////////////////////////////////////
// Rocky boilerplate
////////////////////////////////////////////////////////////////////////////////
static void prv_init_apis(void) {
memset(&s_state, 0, sizeof(s_state));
// Pebble comm session events to transition in & out of P... |
/*
* 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... | (dcache_line_size, 1) | |
e.w = DISP_COLS - TIMELINE_PEEK_ICON_BOX_WIDTH;
const size_t num_horizontal_nodes = 2;
GTextNodeHorizontal *horizontal_node =
graphics_text_node_create_horizontal(num_horizontal_nodes);
graphics_text_node_container_add_child(&horizontal_node->container,
&ve... | {
const bool render = true;
prv_render_view(layout, ctx, render, NULL);
} |
void timeline_layout_get_size(TimelineLayout *layout, GContext *ctx, GSize *size_out) {
const bool render = false;
prv_render_view(layout, ctx, render, size_out);
}
/////////////////////////
// Card View
/////////////////////////
GTextNodeCustom *timeline_layout_create_icon_node(const TimelineLayout *layout) {
... |
t) {.x = mid_pixel_minus_one + i, .y = pixel_max});
graphics_draw_line(ctx, (GPoint) {.x = pixel_min, .y = mid_pixel_minus_one + i},
(GPoint) {.x = pixel_min + TICK_LENGTH, .y = mid_pixel_minus_one + i});
graphics_draw_line(ctx, (GPoint) {.x = pixel_max - TICK_LENGTH, .y = mid_pixel_... | mfg_info_get_disp_offsets() | .y
};
app_state_set_user_data(data);
Window *window = &data->window;
window_init(window, "MfgDisplayCalibration");
window_set_fullscreen(window, true);
window_set_click_config_provider(window, prv_config_provider);
Layer *layer = window_get_root_layer(window);
layer_set_update_proc(layer, prv_layer_u... |
reen, false);
}
}
// Edge Case Tests
////////////////////////////////////
// Description:
// During the load handler of a window, we pop it.
void test_window_stack__pop_during_window_load(void) {
Window *window = window_create();
window_set_window_handlers(window, &(WindowHandlers){
.load = prv_pop_window_... | animation_is_scheduled(fake_animation_get_first_animation()) | , true);
cl_assert_equal_i(window_stack_count(stack), 1);
cl_assert_equal_i(prv_get_load_unload_count(), 1);
cl_assert_equal_i(prv_get_appear_disappear_count(), 1);
window_stack_remove(window, true);
cl_assert_equal_i(window_stack_count(stack), 0);
cl_assert_equal_i(prv_get_load_unload_count(), 0);
cl_a... |
/*
* 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... | {
int selected_idx = number_window_get_value(nw);
if (s_vibe_scores[selected_idx]) {
vibe_score_do_vibe(s_vibe_scores[selected_idx]);
}
} |
static void prv_load_scores(void) {
int num_scores = ARRAY_LENGTH(s_vibe_scores);
for (int i = 0; i < num_scores; i++) {
s_vibe_scores[i] = vibe_score_create_with_resource(s_vibe_score_resources[i]);
}
}
static void prv_unload_scores(void) {
int num_scores = ARRAY_LENGTH(s_vibe_scores);
for (int i = 0;... |
ion_type is supported, false if not.
static bool prv_sanitize_subscription_type(BLESubscription *subscription_type,
uint8_t supported_properties) {
if (*subscription_type == BLESubscriptionNone) {
// None is always supported
return true;
}
BLESubscription support... | prv_prevailing_subscription_type(subscription) | ;
if (next_prevailing_type != previous_prevailing_type) {
// The subscription type changed for this characteristic:
// Write to the Client Configuration Characteristic Descriptor on the
// remote to change the subscription:
const uint16_t value = subscription_type;
ret_val = gatt_client_op_write_... |
/*
* 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... | (&GPIO_InitStructure) | |
ogatt_reset_disconnect_counter(void) {
s_disconnect_counter = 0;
}
static bool prv_client_supports_enhanced_throughput_features(const PPoGATTClient *client) {
// In PPoGATT V1, two features were added to allow for enhanced throughput:
// 1) Negotiable RX/TX in-flight windows - This let's the phone put more dat... | (client, sn) | ;
}
return num_bytes;
}
static uint16_t prv_total_num_bytes_awaiting_ack(const PPoGATTClient *client) {
return prv_total_num_bytes_awaiting_ack_up_to(client, client->out.next_data_sn);
}
static void prv_set_payload_size_for_sn(PPoGATTClient *client, uint32_t sn, uint16_t payload_size) {
client->out.payload_si... |
ped_handler_calls, a), 1);
cl_assert_equal_i(prv_last_update_distance(a), ANIMATION_NORMALIZED_MAX);
// -------------------------------------------------------------------------------------
// Build up a sequence out of a + b
Animation *b = prv_create_test_animation();
animation_set_duration(b, duration_b);... | (prv_count_handler_entries(&s_started_handler_calls, b), 1) | ;
animation_schedule(c);
// Create the spawn using a, b, c, and d
prv_advance_to_ms_with_timers(start_ms + 680);
Animation *spawn = animation_spawn_create(a, b, c, d, NULL);
animation_set_delay(spawn, delay_spawn);
animation_set_handlers(spawn, handlers, spawn);
animation_schedule(spawn);
// Check th... |
ic const PropertyAnimationImplementation s_implementation = {
.base.update = (AnimationUpdateImplementation) property_animation_update_int16,
.accessors.setter.int16 = prv_sidebar_setter,
.accessors.getter.int16 = prv_sidebar_getter,
};
Animation *animation = (Animation *)property_animation_create(
... | (style->sidebar_arrow_size.w, 0) | ;
// layouts
layer->scroll_direction = scroll_direction;
layer->move_delta = prv_get_scroll_delta(layer);
if (scroll_direction == TimelineScrollDirectionUp) {
s_height_offsets[0] = (PAST_TOP_MARGIN_EXTRA + style->thin_pin_height +
(2 * style->fat_pin_height));
s_height_offsets... |
ce);
}
// --------------------------------------------------------------------------------------
static const AnimationImplementation s_custom_implementation = {
.setup = prv_setup_handler,
.update = prv_update_handler,
.teardown = prv_teardown_handler
};
// -----------------------------------------------------... | window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) click_handler) | |
te_history_values = (sys_activity_get_minute_history_values) {
.out[0] = {
.num_records = 2,
.result = true,
},
};
written = health_service_get_minute_history(data, ARRAY_LENGTH(data), &time_start, NULL);
cl_assert_equal_i(2, written);
}
void test_health__get_minute_history(void) {
const ti... | health_service_get_minute_history(data, ARRAY_LENGTH(data), &time_start, &time_end) | ;
cl_assert_equal_i(1, s_sys_activity_get_minute_history_values.in[0].num_records);
}
void test_health__get_yesterdays_sleep_activity(void) {
HealthValue start_sec;
HealthValue end_sec;
// our mock setup doesn't provide configurations for multiple calls
// as health_service_private_get_yesterdays_sleep_activ... |
_layer_deinit(ActionBarLayer *action_bar_layer) {
if (action_bar_layer->redraw_timer) {
app_timer_cancel(action_bar_layer->redraw_timer);
}
layer_deinit(&action_bar_layer->layer);
}
void action_bar_layer_destroy(ActionBarLayer *action_bar_layer) {
if (action_bar_layer == NULL) {
return;
}
action_ba... | {
if (button_id < BUTTON_ID_UP || button_id >= NUM_BUTTONS) {
return;
}
action_bar->animation[button_id - 1] = animation;
} | |
},
{ 832, 192, 72},
// 27 seconds
{ 856, 152, 56},
{ 832, 104, 64},
{ 880, 88, 64},
{ 1016, 88, 24},
{ 1072, 96, 8},
{ 1368, 16, 56},
{ 1400, 184, -136},
{ 1104, 304, -280},
{ 1296, 304, -280},
{ 1400, 376, -136},
{ 1256, 328, -16},
{ 904, 304, 8},
{ 776, 360,... | { 832, 184, 152},
{ 856, 112, 160},
{ 832, 136, 144},
{ 792, 136, 120},
{ 848, 120, 104},
{ 936, 72, 136},
{ 1032, 16, 160},
{ 1432, 112, 80},
// 33 seconds
{ 1496, 360, -376},
{ 1384, 288, -472},
{ 1544, 320, -272},
{ 1432, 176, 48},
{ 1032, 288, 24},
{ 736, ... |
{ 1056, 256, -64},
{ 840, 312, -8},
{ 656, 352, -32},
{ 600, 272, -8},
{ 672, 256, -40},
{ 792, 248, -16},
{ 952, 312, 8},
{ 1328, 408, -64},
{ 1464, 504, 72},
{ 1784, 592, 72},
{ 1392, 672, -48},
{ 1080, 424, 24},
{ 1264, 376, -24},
{ 1328, 352, -24},
// 36 ... |
r wakeup event
if ((entry.timestamp - WAKEUP_EVENT_WINDOW < check->wakeup_timestamp) &&
(check->wakeup_timestamp < (entry.timestamp + WAKEUP_EVENT_WINDOW))) {
check->wakeup_count = E_RANGE;
}
return true; // continue iterating
}
static StatusCode prv_wakeup_settings_add_entry(WakeupId wakeup_id, Wake... | time_utc_to_local(return_time) | ;
}
return return_time;
}
void wakeup_enable(bool enable) {
bool was_enabled = s_wakeup_enabled;
s_wakeup_enabled = enable;
if (enable && !was_enabled) {
prv_wakeup_timer_next_pending();
} else if (!enable && s_current_timer_id &&
new_timer_scheduled(s_current_timer_id, NULL)) {
new_ti... |
n_storage_find_ancs_notification_id(1, &u));
cl_assert(uuid_equal(&u, &e2.header.id));
cl_assert(notification_storage_find_ancs_notification_id(84, &u));
cl_assert(uuid_equal(&u, &e3.header.id));
// Add a new notification with the same ANCS UID as an existing notification to make sure we
// return the new no... | (notification_storage_get(&i2, &r), false) | ;
TimelineItem e3 = e1;
Uuid i3;
uuid_generate(&i3);
e3.header.id = i3;
e3.header.type = TimelineItemTypeOutOfRange;
notification_storage_store(&e3);
cl_assert_equal_b(notification_storage_get(&i3, &r), false);
Uuid i4;
uuid_generate(&i4);
TimelineItem e4 = e1;
e4.header.id = i4;
e4.header.lay... |
/////////
static const uint8_t *prv_build_push_message(uint32_t key, uint8_t value, uint32_t *size) {
// Using static buffer is OK because tests are single-threaded
static uint8_t buffer[sizeof(AppMessagePush) + sizeof(Tuple) + sizeof(uint8_t)];
AppMessagePush *push_message = (AppMessagePush *)buffer;
*push_m... | PBL_ASSERTN(DICT_OK == dict_serialize_tuplets_to_buffer(&tuplet, 1,
(uint8_t *)&push_message->dictionary,
&size)) | ;
fake_comm_session_process_send_next();
fake_transport_assert_sent(s_transport, 0, LAUNCHER_MESSAGE_ENDPOINT_ID, buffer, sizeof(buffer));
}
|
/*
* 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... | (TIMER_DURATION, prv_timer_callback, countdown_window) | ;
}
static void prv_window_unload_handler(Window *window) {
WorkoutCountdownWindow *countdown_window = window_get_user_data(window);
if (countdown_window) {
for (int i = 0; i < NUM_IMAGES; i++) {
kino_reel_destroy(countdown_window->images[i]);
}
app_timer_cancel(countdown_window->timer);
laye... |
{ 400, 1312, -440},
{ 296, 792, -320},
{ 408, 920, -248},
{ 384, 904, -168},
{ 376, 968, -120},
{ 320, 1000, -72},
{ 264, 1056, -40},
{ 224, 1104, -24},
{ 208, 1048, -32},
{ 192, 1024, -48},
{ 224, 1056, -32},
{ 256, 1032, -32},
{ 272, 992, -40},
{ 264, 992, -80},... |
{ 264, 1000, -96},
// 143 seconds
{ 272, 1040, -72},
{ 248, 1056, -88},
{ 288, 968, -80},
{ 360, 1000, -32},
{ 376, 944, -48},
{ 336, 1008, -80},
{ 280, 984, -72},
{ 264, 1056, -72},
{ 280, 1024, -72},
{ 312, 1024, -96},
{ 304, 1016, -120},
{ 312, 952, -128},
... | |
rc lock
mutex_lock_recursive(s_pfs_mutex);
// go to offset
pfs_seek(fd, offset, FSeekSet);
const unsigned int chunk_size = 128;
uint8_t buffer[chunk_size];
while (num_bytes > chunk_size) {
pfs_read(fd, buffer, chunk_size);
legacy_defective_checksum_update(&checksum, buffer, chunk_size);
num_by... | pfs_debug_dump(fd, num_bytes) | ;
pfs_close(fd);
}
void pfs_command_crc(const char *filename) {
int fd = pfs_open(filename, OP_FLAG_READ, 0, 0);
char buffer[32];
if (fd < 0) {
prompt_send_response_fmt(buffer, sizeof(buffer), "fd open err: %d", fd);
return;
}
size_t num_bytes = pfs_get_file_size(fd);
uint32_t crc = pfs_crc_calcu... |
/*
* 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 (reboot_reason_get_last_reboot_reason() != RebootReasonCode_DialogBootFault) {
enter_standby(RebootReasonCode_DialogBootFault);
} |
} else if (dialog_spi_bootloader_load_image() && host_transport_init()) {
hc_protocol_init();
bt_local_id_generate_address_from_serial(&config->identity_addr);
bool result = hc_endpoint_ctl_init_sync(config);
// Nothing good comes from a failure here. BT gets partially initialized and you won't even ... |
/*
* 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... | layer_get_data(base_layer) | ;
const uint32_t duration = gdraw_command_sequence_get_total_duration(data->pulsing_heart);
const uint32_t num_frames = gdraw_command_sequence_get_num_frames(data->pulsing_heart);
const uint32_t timer_duration = duration / num_frames;
const uint32_t max_heart_beats = PULSING_HEART_TIMEOUT / duration;
data->... |
/*
* 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_log_binary_format((char*)&msg->log_msg, sizeof(log_buffer) - log_msg_offset, log_level,
src_filename, src_line_number, fmt, args) | ;
sys_app_log(log_msg_offset + bin_msg_length, log_buffer);
}
void app_log(uint8_t log_level, const char* src_filename, int src_line_number, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
app_log_vargs(log_level, src_filename, src_line_number, fmt, args);
va_end(args);
}
|
int data_length) {
cl_assert(false);
}
static bool s_now_playing_requested;
static void prv_assert_now_playing_requested_cb(uint16_t endpoint_id,
const uint8_t* data, unsigned int data_length) {
cl_assert_equal_i(data_length, 1);
cl_assert_equal_i(data[0], 0x08); ... | prv_receive_and_assert_all(true /* expect_is_handled*/) | ;
cl_assert_equal_b(music_has_now_playing(), true);
uint8_t zero_length_now_playing[] = { 0x10, 0, 0, 0 };
prv_receive_pp_data(zero_length_now_playing, sizeof(zero_length_now_playing));
cl_assert_equal_b(music_has_now_playing(), false);
}
void test_music_endpoint__ignore_malformatted_messages(void) {
// And... |
/*
* 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... | click_recognizer_get_button_id(recognizer) | == BUTTON_ID_UP);
if (is_up) {
PBL_LOG(LOG_LEVEL_DEBUG, "Launching timeline in past mode.");
s_timeline_args.direction = TimelineIterDirectionPast;
} else {
PBL_LOG(LOG_LEVEL_DEBUG, "Launching timeline in future mode.");
s_timeline_args.direction = TimelineIterDirectionFuture;
}
app_manager_pu... |
/*
* 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... | SECTION(".rocky_bss") | T_STATIC size_t s_rocky_path_steps_num;
void rocky_api_graphics_path2d_reset_state(void) {
s_rocky_path_steps_num = 0;
task_free(s_rocky_path_steps);
s_rocky_path_steps = NULL;
s_rocky_path_steps_array_len = 0;
}
JERRY_FUNCTION(prv_begin_path) {
rocky_api_graphics_path2d_reset_state();
return jerry_crea... |
nce and Max. Available",
.in = { HealthMetricHeartRateBPM, now - 10, now, HealthAggregationMax,
HealthServiceTimeScopeOnce },
.out = { HealthServiceAccessibilityMaskAvailable }
},
{
.desc = "Valid time range with ScopeDaily and Max. NotSupported",
.in = { HealthMetricHea... | // range that ends after matches
cl_assert_equal_b(true, fun(&session, HealthActivityMaskAll, now - (1 * SECONDS_PER_MINUTE),
now + (10 * SECONDS_PER_MINUTE)));
} |
void test_health__any_activity_accessible(void) {
const time_t now = rtc_get_time();
HealthServiceAccessibilityMask accessible;
// empty mask => not available
accessible = health_service_any_activity_accessible(HealthActivityNone,
now - (10 * SECONDS_PER_... |
hange(from_area.size.h, to_area.size.h);
UnobstructedAreaHandlers handlers = {
.will_change = prv_will_change,
.change = prv_change,
};
app_unobstructed_area_service_subscribe(handlers, s_data.context);
cl_assert(fake_event_service_get_info(PEBBLE_UNOBSTRUCTED_AREA_EVENT)->handler);
cl_assert_equal_p... | (100, 100, 200, 200) | ,
};
GRect unobstructed_bounds;
layer_get_unobstructed_bounds(&root_layer, &unobstructed_bounds);
cl_assert_equal_grect(unobstructed_bounds, root_layer.bounds);
}
void test_unobstructed_area_service__layer_clip_x_y(void) {
app_state_get_unobstructed_area_state()->area = GRect(0, 0, 400, 400);
Layer root_l... |
left_text_inset));
#endif
if (option_menu->callbacks.draw_row) {
option_menu->callbacks.draw_row(option_menu, ctx, cell_layer, &remaining_rect, cell_index->row,
is_selected, option_menu->context);
}
}
static void prv_select... | option_menu_set_choice(option_menu, config->choice) | ;
option_menu_set_content_type(option_menu, config->content_type);
option_menu_set_status_colors(option_menu, config->status_colors.background,
config->status_colors.foreground);
option_menu_set_highlight_colors(option_menu, config->highlight_colors.background,
... |
/*
* 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... | clock_is_24h_style() | && (s_low_power_data->time_text[0] == '0')) {
text_layer_set_text(&s_low_power_data->low_power_time_layer,
s_low_power_data->time_text+1);
} else {
text_layer_set_text(&s_low_power_data->low_power_time_layer,
s_low_power_data->time_text);
}
}
static voi... |
p, TEST_NAMED_PBI_FILE("draw_line_clear")));
#else
cl_check(framebuffer_is_empty("clear_over_black", ctx.parent_framebuffer, GColorWhite));
#endif
}
#define MAX_NUM_ROWS 168
#define MAX_NUM_COLS 144
#define ORIGIN_RECT_NO_CLIP GRect(0, 0, MAX_NUM_COLS, MAX_NUM_ROWS)
#define ORIGIN_RECT_CLIP_EVEN GRect(1... | graphics_draw_horizontal_line_dotted(&ctx, GPoint(0, row), MAX_NUM_COLS) | ;
}
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap,
TEST_NAMED_PBI_FILE("draw_horiz_dotted_line_origin_odd_clip")));
}
#define OFFSET_RECT_EVEN GRect(14, 14, MAX_NUM_COLS, MAX_NUM_ROWS)
#define OFFSET_RECT_ODD GRect(15, 15, MAX_NUM_COLS, MAX_NUM_ROWS)
#define OFFSET_RECT_CLIP_EVEN GRect... |
/*
* 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... | graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT_NXNY, RADIUS_BIG) | ;
cl_check(gbitmap_pbi_eq(&ctx.dest_bitmap, "stroke_circle_origin_aa_r16_clip_nxny.${BIT_DEPTH_NAME}.pbi"));
// Medium circles
setup_test_aa_sw(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, true, STROKE_SMALL);
graphics_draw_circle(&ctx, CENTER_OF_ORIGIN_RECT, RADIUS_MEDIUM);
cl_check(gbitmap_pbi_eq(&c... |
/*
* 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... | alarm_create(&(AlarmInfo) { .hour = 3, .minute = 14, .kind = ALARM_KIND_EVERYDAY }) | ;
prv_assert_alarm_config(id, 3, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
id = alarm_create(&(AlarmInfo) { .hour = 4, .minute = 14, .kind = ALARM_KIND_EVERYDAY });
prv_assert_alarm_config(id, 4, 14, false, ALARM_KIND_EVERYDAY, s_every_day_schedule);
id = alarm_create(&(AlarmInfo) { .hour = 5, .min... |
/*
* 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... | cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "😀😂") == INVALID_RESOURCE) | ;
// LTR indicator is ignored
cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "\u200E😂") ==
RESOURCE_ID_EMOJI_LAUGHING_WITH_TEARS_LARGE);
// Zero-width-no-break at the end is ignored
cl_check(prv_get_emoji_icon_by_string(s_emoji_table, "😂\uFEFF") ==
RESOURCE_ID_EMOJI_LAUGHING_WITH... |
ached to window processed before layer recognizers
recognizer_add_to_list(recognizers[5], window_get_recognizer_list(&window));
cl_assert(prv_process_all_recognizers(&manager, prv_handle_dummy_touch_event, NULL));
prv_compare_recognizers_processed((int[]) {5, 4, 2, 3}, 4, &s_recognizers_handled);
// Recognizer... | {
for(int i = 0; i < count; i++) {
recognizers[i]->state = state;
}
} |
void test_recognizer_manager__cancel_layer_tree_recognizers(void) {
const int k_rec_count = 4;
Recognizer **recognizers = prv_create_recognizers(k_rec_count);
Window window = {};
layer_init(&window.layer, &GRectZero);
Layer *root = &window.layer;
RecognizerManager manager;
recognizer_manager_init(&mana... |
mfg_info_get_disp_offsets().y, 1);
cl_assert_equal_i(mfg_info_get_watch_color(), 3);
cl_assert_equal_i(mfg_info_get_rtc_freq(), 4);
mfg_info_get_model(buffer);
cl_assert_equal_s(buffer, "test_model");
}
void test_spalding_mfg_info__2_to_3_conversion(void) {
// Force in an old data version.
typedef st... | (memcmp(fpga_buffer + HEADER_SIZE, s_boot_fpga, sizeof(s_boot_fpga)) == 0) | |
hics_draw_text(ctx, i18n_get("Disable Airplane Mode to connect.", data), font,
box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL);
} else {
graphics_draw_text(ctx, i18n_get("Open the Pebble app on your phone to connect.", data),
... | prv_clear_remote_list(data) | ;
for (unsigned int idx = 0; idx < NumIcons; ++idx) {
gbitmap_deinit(&data->icon_heap_bitmap[idx]);
}
app_free(data);
}
static Window *prv_init(void) {
SettingsBluetoothData *data = app_malloc_check(sizeof(SettingsBluetoothData));
*data = (SettingsBluetoothData){};
for (unsigned int idx = 0; idx < Num... |
rigin.y;
return;
}
case GAlignTopRight: {
rect->origin.x = (inside_rect->size.w - rect->size.w) + inside_rect->origin.x;
rect->origin.y = + inside_rect->origin.y;
return;
}
case GAlignTop: {
rect->origin.x = ((inside_rect->size.w - rect->size.w) / 2) + inside_rect->origin.x... | {
// Mimic a "closest color" behaviour, since we do not have blending.
return (color.a <= 1);
} |
GColor8 gcolor_closest_opaque(GColor8 color) {
if (gcolor_is_transparent(color)) {
return GColorClear;
}
color.a = 3;
return color;
}
static int32_t prv_get_luminance_10000(GColor8 color) {
// fixed-point implementation (to base 10,000 decimal) of
// luminance = (0.2126*R + 0.7152*G + 0.0722*B)
// ... |
xt, true, 1, GColorBlack, GColorBlack, false);
graphics_draw_rect(&context, &GRect(10, 20, 40, 10));
ASSERT_CALLED(prv_draw_rect(&context, &GRect(10, 20, 40, 10)));
setup_test(&context, true, 1, GColorBlack, GColorBlack, false);
graphics_draw_circle(&context, GPoint(50, 50), 10);
#if PBL_COLOR
ASSERT_CALLED(... | (&context, false, SW_ODD, GColorBlack, GColorBlack, false) | |
/*
* 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_copy_points(path->points, path->num_points, s_offset) | |
cl_assert_equal_b(uuid, &expected_uuid) | ;
if (cmd == APP_RUN_STATE_STATUS_COMMAND) {
launcher_app_message_send_app_state_deprecated(uuid, RUNNING);
}
}
// Helpers
////////////////////////////////////
static const uint8_t *prv_build_push_message(uint32_t key, uint8_t value, uint32_t *size) {
// Using static buffer is OK because tests are single-th... | |
/*
* 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... | {
// Link Quality not implemented in Dialog SDK
*link_quality_out = 0;
return hc_endpoint_analytics_get_connection_quality(address, rssi_out);
} |
bool bt_driver_analytics_collect_ble_parameters(const BTDeviceInternal *addr,
LEChannelMap *le_chan_map_res) {
return hc_endpoint_analytics_collect_ble_parameters(le_chan_map_res);
}
void bt_driver_analytics_external_collect_chip_specific_parameters(void) {
}
void b... |
_hdl.conn_params_cccd) {
response_length = prv_handle_handle_cccd_read(evt->handle, evt->conn_idx, response);
} else if (!prv_get_value(evt->conn_idx, evt->handle, response, &response_length)) {
PBL_LOG(LOG_LEVEL_ERROR, "Reading unhandled handle: %u !", evt->handle);
response_status = ATT_ERROR_INVALID_HA... | {
return ATT_ERROR_INVALID_VALUE_LENGTH;
} |
bool has_param_set =
(length >= PEBBLE_PAIRING_SERVICE_REMOTE_PARAM_MGTM_SETTINGS_SIZE_WITH_PARAM_SETS);
if (has_param_set) {
for (int i = 0; i < NumResponseTimeState; ++i) {
if (settings->connection_parameter_sets[i].interval_min_1_25ms < LL_CONN_INTV_MIN_SLOTS) {
return (att_error_t)Pebbl... |
#include "pebble_asserts.h"
#include "util/uuid.h"
#include "applib/graphics/graphics_circle_private.h"
#include "stubs_compiled_with_legacy2_sdk.h"
#include "stubs_passert.h"
#include "stubs_heap.h"
#include "stubs_app_state.h"
#include "stubs_pebble_tasks.h"
#include "stubs_rand_ptr.h"
//! Welcome to the test fil... | prv_get_edc() | );
}
|
nd read the settings file from PFS
int fd = pfs_open(ACTIVITY_SETTINGS_FILE_NAME, OP_FLAG_READ, FILE_TYPE_STATIC,
ACTIVITY_SETTINGS_FILE_LEN);
cl_assert(fd >= S_SUCCESS);
size_t size = pfs_get_file_size(fd);
uint8_t *buf = malloc(size);
cl_assert(buf != NULL);
cl_assert(pfs_read(fd, buf,... | prv_feed_cannned_accel_data(1 * SECONDS_PER_MINUTE, 100, ActivitySleepStateAwake) | ;
uint32_t event_count = fake_event_get_count();
// Our fake algorithm generates a step update once a second
cl_assert_equal_i(event_count, 1 * SECONDS_PER_MINUTE);
PebbleEvent event = fake_event_get_last();
cl_assert_equal_i(event.type, PEBBLE_HEALTH_SERVICE_EVENT);
cl_assert_equal_i(event.health_event.t... |
/*
* 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... | (direction, HEALTH_SHUTTER_COLOR) | ,
compositor_port_hole_transition_app_get(direction));
}
static const CompositorTransition *prv_get_action_compositor_animation(
CompositorTransitionDirection direction) {
return PBL_IF_RECT_ELSE(compositor_shutter_transition_get(direction, ACTION_SHUTTER_COLOR),
... |
nfigured_window = window;
}
// Helpers
////////////////////////////////////
static int16_t prv_get_load_unload_count(void) {
return s_load_count - s_unload_count;
}
static int16_t prv_get_appear_disappear_count(void) {
return s_appear_count - s_disappear_count;
}
static void prv_reset_counts(void) {
s_load_cou... | window_create() | ;
// Switch to app state to push windows to the Application window stack
stub_pebble_tasks_set_current(PebbleTask_App);
cl_check(app_state_get_window_stack());
cl_check(!app_state_get_window_stack()->list_head);
app_window_stack_push(window1, true);
cl_assert_equal_i(app_window_stack_count(), 1);
cl_a... |
/*
* 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... | (bitmap, TEST_PBI_FILE) | );
}
// Tests 4-bit palettized PBI loading into gbitmap
// Result:
// - gbitmap matches platform loaded PBI
void test_pbi__color_4_bit(void) {
GBitmap *bitmap = setup_pbi_test(TEST_PBI_FILE);
cl_assert(gbitmap_pbi_eq(bitmap, TEST_PBI_FILE));
}
// Tests 8-bit color PBI loading into gbitmap
// Result:
// - gbit... |
long double s16;
long double s32;
long double s64;
double d;
char *expected_error_msg;
} NumbersTestCase;
enum {
WithinLowerBounds,
WithinUpperBounds,
UnderLowerBounds,
OverUpperBounds,
};
// FIXME: fix limits.h / stdint.h / float.h so we can use the standard defines for t... | jerry_create_object() | ,
};
for (int i = 0; i < ARRAY_LENGTH(mismatch_args); ++i) {
jerry_value_t arg = mismatch_args[i];
JERRY_ARGS_MAKE(arg);
for (RockyArgType type = RockyArgTypeUInt8; type <= RockyArgTypeDouble; ++type) {
uint8_t buffer_untouched[8]; // The type check fails, so nothing is supposed to be written.
... |
{ 1160, 224, -248},
{ 1184, 200, -288},
{ 1064, 80, -328},
{ 616, -232, -344},
{ 608, -168, -272},
{ 448, -208, -528},
{ 616, -48, -448},
{ 1352, 88, -560},
// 44 seconds
{ 1376, 64, -392},
{ 1272, 248, -384},
{ 1104, 464, -456},
{ 1112, 496, -432},
{ 1144, 544, -48... | { 1432, 0, -536},
{ 1184, 32, -472},
{ 1104, 232, -456},
{ 1160, 328, -400},
{ 1304, 528, -456},
{ 1304, 640, -520},
{ 952, 800, -656},
{ 784, 952, -648},
{ 760, 904, -472},
{ 1128, 912, -408},
{ 1160, 760, -312},
{ 1408, 680, -312},
{ 1424, 552, -376},
{ 1160, 41... |
{ 1272, 96, -160},
{ 1248, 224, -96},
{ 1232, 200, -152},
{ 1136, 152, -168},
{ 1040, 56, -168},
{ 824, 32, -240},
{ 616, -192, -200},
// 52 seconds
{ 256, -400, -568},
{ 592, -288, -448},
{ 640, -304, -440},
{ 1080, -176, -472},
{ 1480, 40, -512},
{ 1832, 272, -... |
utes = &item->attr_list,
.mode = LayoutLayerModeCard,
.app_id = &data->notification_app_id,
.context = &layout_info
};
NotificationLayout *notification_layout = (NotificationLayout *)layout_create(layout_id, &config);
return ¬ification_layout->layout;
cleanup:
timeline_item_destroy(item);
retu... | {
return;
} |
data->reminder_watchdog_timer_id = (const RegularTimerInfo) {
.cb = prv_clear_stale_reminders_timer_cb,
.cb_data = data,
};
regular_timer_add_minutes_callback(&data->reminder_watchdog_timer_id);
}
///////////////////////
// Clicks
///////////////////////
static bool prv_should_show_action_in_action_m... |
inner_right, right, bottom_starting_edge,
bottom_ending_edge, ignore_close_angles);
}
} else {
// If theres nothing in the middle, draw top and bottom parts of the circle
if (draw_top) {
prv_draw_scanline_collision_point... | for (int i=1; i <= QUADRANTS_NUM; i++) {
if (quadrant & radius_quadrants[i % 4]) {
angle_start = i * (TRIG_MAX_ANGLE / 4);
break;
}
} |
}
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 (!(q... |
/*
* 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... | cl_assert(num.fraction == 3) | ;
test_num = (int32_t)((float)-0.500 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.integer == -1);
cl_assert(num.fraction == 4);
test_num = (int32_t)((float)-0.375 * (1 << FIXED_S16_3_PRECISION));
num = (Fixed_S16_3){ .raw_value = test_num };
cl_assert(num.... |
/*
* 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... | (action_bar) | |
x_buffer_full(void) {
prv_lock();
bool is_rx_buffer_full = (0 == circular_buffer_get_write_space_remaining(&s_spi_transport.rx));
if (is_rx_buffer_full) {
s_spi_transport.should_transact_after_consuming_rx = true;
}
prv_unlock();
return is_rx_buffer_full;
}
static void prv_handle_rx_buffer_has_space_av... | while (true) {
xSemaphoreTake(s_spi_transport.semph, portMAX_DELAY);
if (s_spi_transport.task_should_deinit) {
break;
}
if (s_spi_transport.state == SPITransportState_CoreDump) {
PBL_LOG(LOG_LEVEL_ALWAYS, "Bluetooth Host Transport Crash -- Dumping Core");
core_dump_and_reset_or_reboot... | |
0x7c, 0x75, 0x8a, 0x35, 0x44, 0x87,
0x90, 0xa4, 0x91, 0x3f, 0x1f, 0xa6, 0x76, 0x01},
.timestamp = 100,
.duration = 0,
.type = TimelineItemTypeReminder,
}
};
static TimelineItem item3 = {
.header = {
.id = {0x7c, 0x65, 0x2e, 0xb9, 0x26, 0xd6, 0x44, 0x2c,
0x98, 0x68, 0xa4, ... | {
cl_assert_equal_i(reminders_init(), 0);
test_reminders__timer_test();
} |
static TimelineItem s_stale_reminder = {
.header = {
.id = {0x3C, 0xAF, 0x17, 0xD5, 0xBE, 0x15, 0x4B, 0xFD, 0xAE, 0x2A,
0xAE, 0x44, 0xC0, 0x96, 0xCB, 0x7D},
.timestamp = 60 * 60,
.duration = 0,
.type = TimelineItemTypeReminder,
}
};
void test_reminders__stale_item_insert(void) {
now = 3 *... |
&p->framebuffer_offset);
}
} else {
// Original SVGs use Red for the stroke, replace it here
const GColor8 key_stroke_color = GColorRed;
gdraw_command_replace_color(processed_command, key_stroke_color, p->stroke_color);
// replace surrounding color
gdraw_command_replace_color(process... | if (width > 0) {
#if CAPABILITY_HAS_MASKING
const GDrawMask *mask = ctx->draw_state.draw_mask;
for (int x = x1.integer; x < x1.integer + width; x++) {
graphics_private_raw_mask_apply(output, mask, data_row_offset, x1.integer, 1, *input);
input++;
output++;
}
#else
memcpy((uint8_t *)out... |
// Last pixel with blending (don't render first AND last pixel if line length is 1)
if (x2.fraction != 0) {
graphics_private_raw_blend_color_factor(ctx, output, data_row_offset, *input, x2.integer,
(uint8_t)x2.fraction);
}
}
//! Copy vertical lines from the app f... |
{ 1216, 176, 96},
{ 1056, 248, -56},
{ 896, 240, -168},
{ 792, 184, -184},
{ 792, 64, -80},
{ 856, 0, 16},
{ 888, 56, 64},
{ 912, 88, 56},
{ 896, 152, 8},
{ 896, 160, -48},
{ 896, 88, -64},
{ 880, 152, -104},
{ 856, 120, -88},
{ 896, 144, -80},
{ 984, 160, -32},
... | { 1040, 112, 80},
{ 1000, 72, 32},
{ 992, 88, 40},
{ 936, 192, 56},
{ 928, 216, 88},
{ 872, 272, 64},
{ 824, 168, 104},
{ 784, 88, 144},
{ 784, 48, 144},
{ 752, 48, 120},
{ 848, 48, 120},
{ 920, 80, 104},
{ 984, 112, 64},
{ 1112, 120, 40},
{ 1304, 152, 136},
... |
{ 784, 64, 112},
{ 784, 80, 80},
{ 848, 96, 80},
{ 872, 136, 88},
{ 920, 144, 80},
{ 888, 168, -56},
{ 1400, 200, 104},
{ 1192, 224, 80},
{ 960, 240, -136},
{ 864, 184, -176},
{ 840, 120, -112},
{ 896, 32, -8},
{ 936, 48, 56},
{ 888, 120, 32},
{ 848, 160, -16... |
* 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 "i2c_timingr.h"
#include "util/attributes.h"
#include "util/math.h"
#include "util/units.h"
static const struct {
uint32_t... | (
(rise_time_ns * PS_PER_NS) + s_timing_data[bus_mode].min_sda_setup_ps,
base_period_ps) | ;
// Check if the computed values are valid. If they aren't valid, we'll increase the prescaler
// try again with a higher prescaler.
// NOTE: We could end up in a situation where it is not valid, but could be if we split up the
// extra cycles differently. We're not going to worry about this because i... |
seInOut);
return anim;
}
static const PropertyAnimationImplementation s_animated_dot_impl = {
.base = {
.update = (AnimationUpdateImplementation) property_animation_update_int16,
},
.accessors = {
.setter = { .int16 = prv_set_dot_width, },
},
};
static Animation *prv_create_pulse... | kino_layer_play(&data->mic_window.icon_layer) | ;
}
}
static void prv_hide_unfold_animation(VoiceUiData *data) {
kino_layer_pause(&data->mic_window.icon_layer);
layer_set_hidden((Layer *) &data->mic_window.icon_layer, true);
}
static void prv_show_mic_dot_pulse(VoiceUiData *data) {
// Dot is already animating
if (animation_is_scheduled(data->mic_window.m... |
Create 1 property animations
Animation *a = prv_create_test_animation();
const AnimationHandlers handlers = {
.started = prv_started_handler,
.stopped = prv_stopped_handler_check_finished
};
animation_set_handlers(a, handlers, animation_get_context(a));
animation_set_duration(a, duration_a);
prv_... | prv_count_handler_entries(&s_started_handler_calls, b) | , 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, b), 0);
cl_assert_equal_i(prv_count_handler_entries(&s_started_handler_calls, seq), 1);
cl_assert_equal_i(prv_count_handler_entries(&s_stopped_handler_calls, seq), 0);
cl_assert(prv_last_handler_entry(&s_stopped_handler_calls, a)->fir... |
/*
* 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... | (prompt_handle_character) | ;
dbgserial_set_rx_dma_enabled(false);
break;
#endif
case SERIAL_CONSOLE_STATE_LOGGING:
dbgserial_register_character_callback(logging_handle_character);
dbgserial_set_rx_dma_enabled(false);
break;
#ifdef UI_DEBUG
case SERIAL_CONSOLE_STATE_LAYER_NUDGING:
dbgserial_register_cha... |
r_temp_text);
snprintf(data->temp_range_text, sizeof(data->temp_range_text),
"%d - %d", data->min_temp, data->max_temp);
text_layer_set_text(data->temp_range_layer, data->temp_range_text);
layer_mark_dirty(window_get_root_layer(data->window));
}
// ---------------------------------------------------... | (data->temp_range_layer) | );
// Update UI
cur_temp_update_text(data);
// Subscribe to second tick for updates
tick_timer_service_subscribe(SECOND_UNIT, handle_second_tick);
}
// -------------------------------------------------------------------------------
static void prv_window_unload(Window *window) {
TemperatureDemoAppData *da... |
rt(i >= TransportID1 && i <= TransportID3);
return s_transport_uuid[i];
}
static CommSessionTransportType prv_get_type(struct Transport *transport) {
return CommSessionTransportType_QEMU;
}
static const TransportImplementation s_transport_imp = {
.send_next = prv_send_next,
.close = prv_close,
.reset = prv_... | cl_assert_equal_p(comm_session_get_by_type(CommSessionTypeApp), session) | ;
comm_session_close(session, CommSessionCloseReason_UnderlyingDisconnection);
fake_system_task_callbacks_invoke_pending(); // get dls called
cl_assert_equal_b(s_dls_private_handle_disconnect_called, false);
cl_assert_equal_b(s_comm_session_event_put, false);
}
void test_session__last_system_session_wins(void)... |
ase FullStyleCapital12h:
if (with_fulltime) {
time_fmt = i18n_noop("Yesterday, %l:%M %p");
} else {
time_fmt = i18n_noop("Yesterday");
}
break;
case FullStyleLower24h:
case FullStyleCapital24h:
if (with_fulltime) {
time_fmt = i18n_noop("Y... | ("IN %lu H") | ;
} else if (num_hrs == 1) {
str_fmt = i18n_noop("In %lu hour");
} else {
str_fmt = i18n_noop("In %lu hours");
}
snprintf(buffer, buf_size, i18n_get(str_fmt, buffer), num_hrs);
} else {
prv_clock_get_full_relative_time(buffer, buf_size, timestamp, capitalized, with_fulltime);
}
i1... |
h_size, settings_file_get_len(file, &m_info.settings_key,
sizeof(m_info.settings_key)));
settings_file_get(file, &m_info.settings_key, sizeof(m_info.settings_key), &old_history,
fetch_size);
uint16_t day = time_util_get_day(old_history.utc_sec);
int old_... | if (history_len > 1) {
// Read from the history stored in settings
ActivitySettingsValueHistory setting_history = {};
SettingsFile *file = activity_private_settings_open();
if (!file) {
PBL_LOG(LOG_LEVEL_ERROR, "Settings file DNE. No need to continue getting metric");
success = f... | |
be(BUTTON_ID_DOWN, SCROLL_REPEAT_MS,
prv_single_click_handler);
window_multi_click_subscribe(BUTTON_ID_DOWN, 2, 2, 100, false, prv_down_multi_click_handler);
SwapLayer *swap_layer = context;
if (swap_layer->callbacks.click_config_provider) {
swap_layer->callbacks.cli... | {
// Note: Not yet exported for 3rd party apps so no padding is necessary
SwapLayer *layer = applib_malloc(sizeof(SwapLayer));
if (layer) {
swap_layer_init(layer, &frame);
}
return layer;
} | |
mon/i18n/i18n.h"
#include "services/common/regular_timer.h"
#include "services/normal/alarms/alarm.h"
#include "services/normal/timezone_database.h"
#include "services/normal/wakeup.h"
#include "shell/prefs.h"
#include "syscall/syscall.h"
#include "syscall/syscall_internal.h"
#include "system/logging.h"
#include "util/... | { // Standard time (not wall time)
time_tm.tm_gmtoff = tz_info->tm_gmtoff;
time_tm.tm_isdst = 0;
} | |
te.current_command = cmd;
switch (cmd) {
case PutBytesInit:
prv_do_init();
break;
case PutBytesPut:
WTF; // Put Requests have their own handler
break;
case PutBytesCommit:
prv_do_commit();
break;
case PutBytesAbort:
prv_do_abort();
break;
case PutBy... | PBL_LOG(LOG_LEVEL_ERROR, "Failed to acquire the put-bytes semaphore, retry") | ;
return false;
}
return true;
}
static bool prv_prepare(size_t total_payload_length) {
if (total_payload_length > PUT_BYTES_PP_BUFFER_SIZE) {
PBL_LOG(LOG_LEVEL_ERROR, "Put Bytes message too big");
return false;
}
if (!s_pb_state.receiver.buffer) {
if (!prv_init_put_job_queue_if_necessary())... |
rigin.y += icon_space;
box->size.h -= icon_space;
}
// hack: compensate for text placement inside a rect
box->origin.y -= 4;
if (subtitle) {
box->size.h -= prv_draw_centered_text_line_in(ctx, subtitle_font, box, subtitle,
GAlignBottom);
}
i... | (menu_layer) | ;
bool is_selected = menu_index_compare(cell_index, &selected_index) == 0;
if (is_selected) {
return MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT;
}
#endif
const PreferredContentSize runtime_platform_content_size =
system_theme_get_default_content_size_for_runtime_platform();
return ((int16_t[NumPreferr... |
/*
* 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_assert_alarm_config(id, 10, 30, false, ALARM_KIND_EVERYDAY, s_every_day_schedule) | |
{
.update = property_animation_update_mark_dirty,
},
};
PropertyAnimation *property_animation_create_mark_dirty(struct Layer *layer) {
// no legacy2 support as this was never exposed on 2.x
PropertyAnimation *result = property_animation_create(&s_dirty_layer_implementation,
... | if (!property_animation) {
return false;
} |
if (size > MEMBER_SIZE(PropertyAnimationPrivate, values.to)) {
APP_LOG(APP_LOG_LEVEL_WARNING, "invalid size");
return false;
}
if (set) {
memcpy(&property_animation->values.to, value, size);
} else {
memcpy(value, &property_animation->values.to, size);
}
return true;
}
|
{ -1248, 96, -80},
{ -1352, 48, -16},
{ -1448, 48, 24},
{ -1392, 56, 24},
{ -1352, 80, 16},
{ -1504, -120, 112},
{ -1112, -288, 64},
{ -1264, -32, 80},
{ -1040, 696, -360},
{ -944, 1072, -368},
{ -856, 720, -232},
{ -560, 768, -224},
{ -120, 752, -288},
{ -48, 544,... | { -1384, -56, 80},
{ -1216, 32, -208},
{ -1416, 200, -336},
{ -1488, -16, -248},
{ -1152, -232, -128},
{ -1008, 32, -288},
{ -1016, 120, -288},
{ -1088, 272, -312},
{ -1120, 200, -288},
{ -1280, 360, -392},
{ -1536, 336, -184},
// 52 seconds
{ -1304, 768, -384},
{... |
{ 272, 1568, 0},
{ 88, 1816, -56},
{ 104, 1192, -80},
{ 136, 888, -120},
{ 112, 568, -112},
{ 0, 560, -264},
{ -32, 360, -296},
{ -48, 128, -200},
{ -152, 8, -120},
{ -256, -112, -96},
{ -464, -56, -128},
{ -1040, 8, -192},
{ -1704, 96, -8},
{ -2688, -24, 368},
... |
id) {
#if SCREEN_COLOR_DEPTH_BITS == 1
cl_check(get_bitmap_bit(test_image_bw, 8, 16) == 1);
cl_check(get_bitmap_bit(test_image_bw, 8, 24) == 0);
cl_check(get_bitmap_bit(test_image_color, 30, 2) == 0);
cl_check(get_bitmap_bit(test_image_color, 30, 10) == 0);
cl_check(get_bitmap_bit(test_image_color, 30, 30) ==... | (&ctx.dest_bitmap, "draw_rotated_bitmap_offset_bw_corner_45.Xbit.pbi") | );
// Top-left center rotation point, Angle 45
setup_test_rotate_bitmap(&ctx, fb, ORIGIN_RECT_NO_CLIP, ORIGIN_RECT_NO_CLIP, GCompOpAssign);
graphics_draw_rotated_bitmap(&ctx, test_image_bw,
GPoint(27, 40), DEG_TO_TRIGANGLE(45), GPoint(20, 20));
cl_check(gbitmap_pbi_eq(&ctx.dest_... |
100
}, // setting a page height != enables positioning
},
};
render_steps(&layout, RenderMoveTextBox, DELTA, 1000, NULL);
cl_check(gbitmap_pbi_eq(s_dest_bitmap, TEST_PBI_FILE));
}
void test_graphics_draw_text_flow__avoid_repeat_text_to_avoid_orphans(void) {
TextLayoutExtended layout = {
.flow_da... | grect_center_point(&disp_180_frame) | ;
const int32_t radius = grect_shortest_side(disp_180_frame) / 2 - inset;
return perimeter_for_circle(vertical_range, center, radius);
}
void test_graphics_draw_text_flow__draw_text_doom(void) {
// text and configuration we see in text_flow demo app
cl_assert(text_resources_init_font(0, RESOURCE_ID_GOTHIC_24_... |
/*
* 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... | cl_assert_equal_i(BITS_BETWEEN(0, 7), erased_sector) | ;
cl_assert(flash_locked);
}
void test_system_flash__erase_sector_0(void) {
cl_assert(system_flash_erase(FLASH_BASE, 16 KiB, NULL, NULL));
cl_assert_equal_i(BITS_BETWEEN(0, 0), erased_sector);
cl_assert(flash_locked);
}
void test_system_flash__erase_16KB_sectors(void) {
cl_assert(system_flash_erase(FLASH_BA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.