Match world-list search hints and detail placement
This commit is contained in:
@@ -839,13 +839,15 @@ impl Title {
|
||||
self.search_focused,
|
||||
self.started,
|
||||
);
|
||||
if self.search.is_empty() {
|
||||
batch.text(
|
||||
if self.search.is_empty() && !self.search_focused {
|
||||
batch.text_styled(
|
||||
atlas,
|
||||
&lang::get_or("gui.selectWorld.search", "Search..."),
|
||||
&Text::literal(lang::get_or("gui.selectWorld.search", "Search..."))
|
||||
.italic()
|
||||
.with_color(crate::text::GRAY),
|
||||
(w / 2.0).floor() - 96.0,
|
||||
27.0,
|
||||
rgba(128, 128, 128, 255),
|
||||
u32::MAX,
|
||||
true,
|
||||
);
|
||||
}
|
||||
@@ -921,7 +923,7 @@ impl Title {
|
||||
atlas,
|
||||
&details,
|
||||
x + 35.0,
|
||||
y + 22.0,
|
||||
y + 21.0,
|
||||
rgba(128, 128, 128, 255),
|
||||
true,
|
||||
);
|
||||
|
||||
@@ -625,6 +625,34 @@ fn delete_removes_links_without_following_them() {
|
||||
assert!(outside.join("keep.txt").is_file());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn world_search_hint_is_gray_and_only_shown_empty_and_unfocused() {
|
||||
let mut f = Fixture::new();
|
||||
f.world("World", "World");
|
||||
f.select();
|
||||
let atlas = crate::hud::HudAtlas::build(Path::new("/nonexistent/horizon-test-assets")).unwrap();
|
||||
let draw = |title: &Title| {
|
||||
let mut batch = HudBatch::new([480, 262]);
|
||||
title.draw(&atlas, &mut batch, (0.0, 0.0), true);
|
||||
batch
|
||||
};
|
||||
let has_hint = |batch: &HudBatch| {
|
||||
batch
|
||||
.vertices
|
||||
.iter()
|
||||
.any(|v| v.color == rgba(170, 170, 170, 255) && (21.0..41.0).contains(&v.pos[1]))
|
||||
};
|
||||
assert!(has_hint(&draw(&f.title)));
|
||||
|
||||
f.title.click(240.0, 31.0, (480.0, 262.0));
|
||||
assert!(f.title.search_focused);
|
||||
assert!(!has_hint(&draw(&f.title)));
|
||||
f.title.type_text("World");
|
||||
f.title.click(240.0, 60.0, (480.0, 262.0));
|
||||
assert!(!f.title.search_focused);
|
||||
assert!(!has_hint(&draw(&f.title)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn scrolled_world_list_draws_inside_the_list_and_drags_its_scroller() {
|
||||
let mut f = Fixture::new();
|
||||
|
||||
Reference in New Issue
Block a user