diff --git a/modules/core_geocaching/tests/CMakeLists.txt b/modules/core_geocaching/tests/CMakeLists.txt index 584d38e8..422f1928 100644 --- a/modules/core_geocaching/tests/CMakeLists.txt +++ b/modules/core_geocaching/tests/CMakeLists.txt @@ -404,6 +404,15 @@ target_link_libraries(geocaching_browse_runtime_test PRIVATE geocaching_native_h add_test(NAME geocaching_browse_runtime COMMAND geocaching_browse_runtime_test ${CMAKE_CURRENT_SOURCE_DIR}/fixtures) add_executable(geocaching_local_map_test test_local_map_overlay.cpp) +set(GPS_RUNTIME "${CMAKE_CURRENT_SOURCE_DIR}/../../ui_shared/src/ui/screens/gps/gps_page_runtime.cpp") +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${GPS_RUNTIME}") +file(READ "${GPS_RUNTIME}" GPS_RUNTIME_SOURCE) +string(FIND "${GPS_RUNTIME_SOURCE}" "void keep_only_current_position_overlay(" FILTER_START) +string(SUBSTRING "${GPS_RUNTIME_SOURCE}" ${FILTER_START} -1 FILTER_TAIL) +string(FIND "${FILTER_TAIL}" "bool load_map_track_file_impl(" FILTER_LENGTH) +string(SUBSTRING "${FILTER_TAIL}" 0 ${FILTER_LENGTH} MAP_FILTER) +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/geocaching_map_filter.inc" "${MAP_FILTER}") +target_include_directories(geocaching_local_map_test PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") target_include_directories(geocaching_local_map_test PRIVATE ../../ui_presentation/include) target_compile_features(geocaching_local_map_test PRIVATE cxx_std_17) if(MSVC) diff --git a/modules/core_geocaching/tests/test_browse_runtime.cpp b/modules/core_geocaching/tests/test_browse_runtime.cpp index ee779c22..6bec335f 100644 --- a/modules/core_geocaching/tests/test_browse_runtime.cpp +++ b/modules/core_geocaching/tests/test_browse_runtime.cpp @@ -498,6 +498,25 @@ int main(int argc, char** argv) // Cold offline startup has no dispatch destination or QueryClient yet. // Saved rows and full details must not wait for either to become available. router.ready = false; + // Open the main map directly, without warming either Geocaching list. + { + test::source->activate(true); + auto overlays = std::make_unique(); + auto map = std::make_unique(); + for (unsigned frame = 0; frame < 100 && map->item_count != 2; ++frame) + { + overlays->update(*test::source, 31, 121, 15); + *map = {}; + overlays->append(*map); + for (unsigned work = 0; work < 150; ++work) tick(); + } + require(map->item_count == 2 && map->header.valid, "direct main map did not load local markers"); + test::source->activate(false); + tick(); + until([&] + { return std::strstr(snapshot(Section::Published).status.data(), "Starting Geocaching"); }, + "direct map session did not close"); + } const auto installed_gpx = std::find_if(disk.begin(), disk.end(), [](const auto& file) { return file.first.find("/.state/") == std::string::npos && file.first.size() >= 4 && file.first.substr(file.first.size() - 4) == ".gpx"; }); require(installed_gpx != disk.end(), "restart test requires an installed GPX"); diff --git a/modules/core_geocaching/tests/test_local_map_overlay.cpp b/modules/core_geocaching/tests/test_local_map_overlay.cpp index 8df442eb..88191c24 100644 --- a/modules/core_geocaching/tests/test_local_map_overlay.cpp +++ b/modules/core_geocaching/tests/test_local_map_overlay.cpp @@ -5,6 +5,19 @@ #include using namespace ui::geocaching; +namespace +{ +enum class TrackOverlayFileKind +{ + Track, + Route +}; +bool s_track_overlay_active = false; +bool s_route_image_strip_visible = false; +TrackOverlayFileKind s_track_overlay_kind = TrackOverlayFileKind::Track; +// Compile the actual shared Map filter, rather than duplicating its rules. +#include "geocaching_map_filter.inc" +} // namespace struct LocalSource : Source { std::vector drafts, downloaded; @@ -68,6 +81,8 @@ int main() projection->append(*out); assert(out->item_count == 10); // Includes drafts beyond the first four rows. assert(out->header.valid); // Local markers render even without a GPS fix. + keep_only_current_position_overlay(*out); + assert(out->item_count == 10); // Hiding map chrome must retain saved places. assert(out->items[0].style == ui::map::MapOverlayStyle::Warning); assert(out->items[9].style == ui::map::MapOverlayStyle::Default); const auto requests = source.requests; diff --git a/modules/ui_shared/src/ui/screens/gps/gps_page_runtime.cpp b/modules/ui_shared/src/ui/screens/gps/gps_page_runtime.cpp index 416366c3..0a3139ff 100644 --- a/modules/ui_shared/src/ui/screens/gps/gps_page_runtime.cpp +++ b/modules/ui_shared/src/ui/screens/gps/gps_page_runtime.cpp @@ -3025,6 +3025,9 @@ void keep_only_current_position_overlay(::ui::map::MapOverlaySnapshot& snapshot) const auto& item = snapshot.items[read]; const bool keep_item = item.kind == ::ui::map::MapOverlayKind::CurrentPosition || + // Saved places remain visible like Agenda markers and POIs when + // map chrome is hidden; this toggle only hides transient info. + item.kind == ::ui::map::MapOverlayKind::Geocache || (keep_route_points && item.kind == ::ui::map::MapOverlayKind::RoutePoint) || (keep_selected_route_image && item.kind == ::ui::map::MapOverlayKind::SelectedTarget);