Skip to content

Commit

Permalink
Support leptonica:1.83.0
Browse files Browse the repository at this point in the history
I've had to disable doc tests because some of the syntax in the
autogenerated comments confuses it.

It looks like access to the PIX struct is now private, so we need to use
getters.

I started looking at this because of this issue in leptonica-plumbing
ccouzens/leptonica-plumbing#5

---

To test using my dev version of leptonica I need to use this command

```bash
LD_LIBRARY_PATH=../../DanBloomberg/leptonica/local/lib PKG_CONFIG_PATH=../../DanBloomberg/leptonica/local/lib/pkgconfig cargo test --lib
```

My checkout of leptonica was built with

```bash
sudo dnf builddep leptonica-devel
./autogen.sh
./configure --prefix
 /configure "--prefix=$(pwd)/local"
make
make install
```
  • Loading branch information
ccouzens committed Jan 15, 2023
1 parent 87e99d1 commit c85a7d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ jobs:
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
run: cargo test --verbose --lib
- name: Check formatting
run: cargo fmt -- --check
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "leptonica-sys"
version = "0.4.2"
version = "0.4.3"
authors = ["Chris Couzens <[email protected]>"]
edition = "2018"
links = "lept"
Expand Down
10 changes: 4 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs"));

#[cfg(test)]
mod tests {
use super::{pixFreeData, pixRead};
use std::ffi::CStr;
use super::{pixFreeData, pixGetHeight, pixGetWidth, pixRead};

#[test]
fn image_size() {
unsafe {
let image =
pixRead(CStr::from_bytes_with_nul_unchecked(b"../test image.png\0").as_ptr());
assert_eq!((*image).w, 1000);
assert_eq!((*image).h, 500);
let image = pixRead(b"../test image.png\0".as_ptr().cast());
assert_eq!(pixGetWidth(image), 1000);
assert_eq!(pixGetHeight(image), 500);
pixFreeData(image);
}
}
Expand Down

0 comments on commit c85a7d5

Please sign in to comment.