fixing some unused imports
This commit is contained in:
parent
ed9693c27b
commit
7bdd8225cb
4 changed files with 48 additions and 8 deletions
|
@ -4,7 +4,7 @@ mod image_model {
|
||||||
use crate::schema::images::dsl::*;
|
use crate::schema::images::dsl::*;
|
||||||
use diesel::sqlite::SqliteConnection;
|
use diesel::sqlite::SqliteConnection;
|
||||||
use diesel::{delete, insert_into, prelude::*, update};
|
use diesel::{delete, insert_into, prelude::*, update};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::PathBuf;
|
||||||
|
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
mod presentation_model {
|
mod presentation_model {
|
||||||
use crate::models::*;
|
|
||||||
use crate::presentation_model::presentation_model::Presentation;
|
use crate::presentation_model::presentation_model::Presentation;
|
||||||
use crate::reveal_js;
|
use crate::reveal_js;
|
||||||
use crate::schema::presentations::dsl::*;
|
use crate::schema::presentations::dsl::*;
|
||||||
use diesel::sqlite::SqliteConnection;
|
use diesel::sqlite::SqliteConnection;
|
||||||
use diesel::{delete, insert_into, prelude::*, update};
|
use diesel::{delete, insert_into, prelude::*, update};
|
||||||
// use sqlx::Connection;
|
// use sqlx::Connection;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::PathBuf;
|
||||||
use tracing::{debug, debug_span, error, info, instrument};
|
use tracing::debug;
|
||||||
|
|
||||||
unsafe extern "C++" {
|
unsafe extern "C++" {
|
||||||
include!(< QAbstractListModel >);
|
include!(< QAbstractListModel >);
|
||||||
|
@ -228,7 +227,7 @@ mod presentation_model {
|
||||||
);
|
);
|
||||||
actual_page_count =
|
actual_page_count =
|
||||||
reveal_js::count_slides_and_fragments(
|
reveal_js::count_slides_and_fragments(
|
||||||
actual_path,
|
&actual_path,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
debug!(
|
debug!(
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// use dirs;
|
// use dirs;
|
||||||
use std::{fs::read_to_string, path::PathBuf};
|
use std::{fs::read_to_string, path::Path};
|
||||||
use tracing::{debug, debug_span, error, info, instrument};
|
use tracing::debug;
|
||||||
|
|
||||||
pub fn count_slides_and_fragments(html_file_path: PathBuf) -> i32 {
|
pub fn count_slides_and_fragments(html_file_path: &Path) -> i32 {
|
||||||
debug!(path = ?html_file_path, "Starting slide counter");
|
debug!(path = ?html_file_path, "Starting slide counter");
|
||||||
// Read the HTML file
|
// Read the HTML file
|
||||||
let html_content = read_to_string(html_file_path)
|
let html_content = read_to_string(html_file_path)
|
||||||
|
@ -31,3 +31,15 @@ pub fn count_slides_and_fragments(html_file_path: PathBuf) -> i32 {
|
||||||
|
|
||||||
total as i32
|
total as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn count_slides_test() {
|
||||||
|
let html_file = Path::new("/home/chris/org/lessons/2023_24_1_adam_and_eve_lesson.html");
|
||||||
|
assert_eq!(count_slides_and_fragments(html_file), 33);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1055,3 +1055,32 @@ pub mod song_model {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use cxx_qt_lib::QStringList; // Replace 'some_module' with the actual module where QModelIndex is defined.
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_get_lyric_list() {
|
||||||
|
// Create a test instance of your struct (you might need to adjust this based on your actual struct).
|
||||||
|
let mut song_model = SongModel {
|
||||||
|
highest_id: 0,
|
||||||
|
songs: Vec::<song_model::Song>::new(),
|
||||||
|
};
|
||||||
|
|
||||||
|
// this sets up the songmodel with the database
|
||||||
|
// song_model.setup_wrapper(self);
|
||||||
|
|
||||||
|
// Call the get_lyric_list function with specific inputs.
|
||||||
|
let index = 0; // Replace with your desired test index.
|
||||||
|
|
||||||
|
let result = song_model.get_lyric_list(index);
|
||||||
|
|
||||||
|
// Define your expected result here. For simplicity, let's assume an empty QStringList.
|
||||||
|
let expected_result = QStringList::default();
|
||||||
|
|
||||||
|
// Compare the actual result with the expected result using an assertion.
|
||||||
|
assert_eq!(result, expected_result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue