Actually run doctests in CI, fix failing ones

This commit is contained in:
Thom Chiovoloni 2021-03-06 06:57:59 -08:00
parent 955bbf214e
commit 1c5d8c368c
3 changed files with 8 additions and 7 deletions

View File

@ -130,6 +130,7 @@ jobs:
${{ runner.os }}-target-test-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-target-test-${{ matrix.rust }}-
- run: cargo test --workspace --all-targets
- run: cargo test --workspace --doc
# - run: cargo test --manifest-path imgui-gfx-examples/Cargo.toml --no-default-features --features directx
# if: runner.os == 'Windows'
- run: cargo test --manifest-path imgui-winit-support/Cargo.toml --no-default-features --features winit-19

View File

@ -20,15 +20,15 @@ create_token!(
/// # use imgui::*;
/// # let mut imgui = Context::create();
/// # let ui = imgui.frame();
/// if ui.button(im_str!("Show modal"), [0.0, 0.0]) {
/// if ui.button(im_str!("Show modal")) {
/// ui.open_popup(im_str!("modal"));
/// }
/// if let Some(_token) = PopupModal::new(im_str!("modal")).begin_popup() {
/// if let Some(_token) = PopupModal::new(im_str!("modal")).begin_popup(&ui) {
/// ui.text("Content of my modal");
/// if ui.button(im_str!("OK"), [0.0, 0.0]) {
/// if ui.button(im_str!("OK")) {
/// ui.close_current_popup();
/// }
/// });
/// };
/// ```
#[must_use]
pub struct PopupModal<'p> {

View File

@ -32,7 +32,7 @@ impl<'ui> Ui<'ui> {
/// // During UI construction
/// let font = ui.push_font(my_custom_font);
/// ui.text("I use the custom font!");
/// font.pop(&ui);
/// font.pop();
/// ```
#[doc(alias = "PushFont")]
pub fn push_font(&self, id: FontId) -> FontStackToken<'_> {
@ -56,7 +56,7 @@ impl<'ui> Ui<'ui> {
/// const RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0];
/// let color = ui.push_style_color(StyleColor::Text, RED);
/// ui.text("I'm red!");
/// color.pop(&ui);
/// color.pop();
/// ```
#[doc(alias = "PushStyleColorVec4")]
pub fn push_style_color(&self, style_color: StyleColor, color: [f32; 4]) -> ColorStackToken {
@ -112,7 +112,7 @@ impl<'ui> Ui<'ui> {
/// # let ui = ctx.frame();
/// let style = ui.push_style_var(StyleVar::Alpha(0.2));
/// ui.text("I'm transparent!");
/// style.pop(&ui);
/// style.pop();
/// ```
#[doc(alias = "PushStyleVar")]
pub fn push_style_var(&self, style_var: StyleVar) -> StyleStackToken {