mirror of
https://github.com/google/pebble.git
synced 2025-07-12 17:32:18 -04:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
83
tests/fw/shell/test_system_theme.c
Normal file
83
tests/fw/shell/test_system_theme.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
#include "clar.h"
|
||||
|
||||
#include "applib/platform.h"
|
||||
#include "applib/preferred_content_size.h"
|
||||
|
||||
// Stubs
|
||||
///////////////
|
||||
|
||||
#include "stubs_analytics.h"
|
||||
#include "stubs_fonts.h"
|
||||
#include "stubs_logging.h"
|
||||
#include "stubs_passert.h"
|
||||
#include "stubs_process_manager.h"
|
||||
#include "stubs_shell_prefs.h"
|
||||
|
||||
// Tests
|
||||
///////////////
|
||||
|
||||
PreferredContentSize prv_convert_content_size_between_platforms(PreferredContentSize size,
|
||||
PlatformType from_platform,
|
||||
PlatformType to_platform);
|
||||
|
||||
void test_system_theme__convert_content_size_between_platforms(void) {
|
||||
// Converting between the same platform should be return the input
|
||||
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeMedium,
|
||||
PlatformTypeBasalt,
|
||||
PlatformTypeBasalt),
|
||||
PreferredContentSizeMedium);
|
||||
|
||||
// Converting between two platforms with the same default content size should return the input
|
||||
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeMedium,
|
||||
PlatformTypeDiorite,
|
||||
PlatformTypeBasalt),
|
||||
PreferredContentSizeMedium);
|
||||
|
||||
// Passing in an invalid from_platform or to_platform should assert
|
||||
cl_assert_passert(prv_convert_content_size_between_platforms(PreferredContentSizeSmall,
|
||||
PlatformTypeEmery + 1,
|
||||
PlatformTypeBasalt));
|
||||
cl_assert_passert(prv_convert_content_size_between_platforms(PreferredContentSizeSmall,
|
||||
PlatformTypeBasalt,
|
||||
PlatformTypeEmery + 1));
|
||||
|
||||
// Converting from Emery to Basalt should return one size smaller
|
||||
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeLarge,
|
||||
PlatformTypeEmery,
|
||||
PlatformTypeBasalt),
|
||||
PreferredContentSizeMedium);
|
||||
|
||||
// Converting from Aplite to Emery should return one size larger
|
||||
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeLarge,
|
||||
PlatformTypeAplite,
|
||||
PlatformTypeEmery),
|
||||
PreferredContentSizeExtraLarge);
|
||||
|
||||
// Converting from Diorite to Emery (one size up) with the maximum size should be clipped
|
||||
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeExtraLarge,
|
||||
PlatformTypeDiorite,
|
||||
PlatformTypeEmery),
|
||||
PreferredContentSizeExtraLarge);
|
||||
|
||||
// Converting from Emery to Chalk (one size down) with the minimum size should be clipped
|
||||
cl_assert_equal_i(prv_convert_content_size_between_platforms(PreferredContentSizeSmall,
|
||||
PlatformTypeEmery,
|
||||
PlatformTypeChalk),
|
||||
PreferredContentSizeSmall);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue