Remove date button from Scene demo, so as not to fail tests each day (#5657)
This commit is contained in:
parent
ee5f0d6d52
commit
04fca9c324
|
|
@ -11,7 +11,7 @@ pub struct SceneDemo {
|
||||||
impl Default for SceneDemo {
|
impl Default for SceneDemo {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
widget_gallery: Default::default(),
|
widget_gallery: widget_gallery::WidgetGallery::default().with_date_button(false), // disable date button so that we don't fail the snapshot test
|
||||||
scene_rect: Rect::ZERO, // `egui::Scene` will initialize this to something valid
|
scene_rect: Rect::ZERO, // `egui::Scene` will initialize this to something valid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ pub struct WidgetGallery {
|
||||||
#[cfg(feature = "chrono")]
|
#[cfg(feature = "chrono")]
|
||||||
#[cfg_attr(feature = "serde", serde(skip))]
|
#[cfg_attr(feature = "serde", serde(skip))]
|
||||||
date: Option<chrono::NaiveDate>,
|
date: Option<chrono::NaiveDate>,
|
||||||
|
|
||||||
|
with_date_button: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for WidgetGallery {
|
impl Default for WidgetGallery {
|
||||||
|
|
@ -38,10 +40,23 @@ impl Default for WidgetGallery {
|
||||||
animate_progress_bar: false,
|
animate_progress_bar: false,
|
||||||
#[cfg(feature = "chrono")]
|
#[cfg(feature = "chrono")]
|
||||||
date: None,
|
date: None,
|
||||||
|
#[cfg(feature = "chrono")]
|
||||||
|
with_date_button: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl WidgetGallery {
|
||||||
|
#[inline]
|
||||||
|
pub fn with_date_button(mut self, _with_date_button: bool) -> Self {
|
||||||
|
#[cfg(feature = "chrono")]
|
||||||
|
{
|
||||||
|
self.with_date_button = _with_date_button;
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl crate::Demo for WidgetGallery {
|
impl crate::Demo for WidgetGallery {
|
||||||
fn name(&self) -> &'static str {
|
fn name(&self) -> &'static str {
|
||||||
"🗄 Widget Gallery"
|
"🗄 Widget Gallery"
|
||||||
|
|
@ -124,6 +139,8 @@ impl WidgetGallery {
|
||||||
animate_progress_bar,
|
animate_progress_bar,
|
||||||
#[cfg(feature = "chrono")]
|
#[cfg(feature = "chrono")]
|
||||||
date,
|
date,
|
||||||
|
#[cfg(feature = "chrono")]
|
||||||
|
with_date_button,
|
||||||
} = self;
|
} = self;
|
||||||
|
|
||||||
ui.add(doc_link_label("Label", "label"));
|
ui.add(doc_link_label("Label", "label"));
|
||||||
|
|
@ -226,7 +243,7 @@ impl WidgetGallery {
|
||||||
ui.end_row();
|
ui.end_row();
|
||||||
|
|
||||||
#[cfg(feature = "chrono")]
|
#[cfg(feature = "chrono")]
|
||||||
{
|
if *with_date_button {
|
||||||
let date = date.get_or_insert_with(|| chrono::offset::Utc::now().date_naive());
|
let date = date.get_or_insert_with(|| chrono::offset::Utc::now().date_naive());
|
||||||
ui.add(doc_link_label_with_crate(
|
ui.add(doc_link_label_with_crate(
|
||||||
"egui_extras",
|
"egui_extras",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:d076f5365bfa87b7e61d3808b8b9b367157ea6e55ccf665720cbd2237d53793d
|
oid sha256:93f2bf32b0607b56a9eebefdc07b55d66988251eeb0ccf7799c2836281d5d5fb
|
||||||
size 35563
|
size 35573
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue