mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -348,13 +348,6 @@ impl AmfHandoff for AmfD3D11Handoff {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn sdk_not_found_when_dll_missing() {
|
||||
let dummy_path = "/this/path/does/not/exist/fake-amfrt64.dll";
|
||||
let result = unsafe { Library::new(dummy_path) };
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn amf_status_constants_match_spec() {
|
||||
assert_eq!(AMF_OK, 0);
|
||||
|
||||
@@ -411,31 +411,3 @@ impl KeyedMutexBackend for D3D11KeyedMutexBackend {
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn mark_consumed(&mut self, _slot: &D3D11SharedHandle) {}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn instance_creation_fails_on_non_windows() {
|
||||
let err = D3D11KeyedMutexBackend::new().err();
|
||||
assert!(matches!(
|
||||
err,
|
||||
Some(BackendError::PlatformUnsupported { .. })
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn handle_clones_preserve_index() {
|
||||
let h = D3D11SharedHandle {
|
||||
raw_handle: 0xdead,
|
||||
slot_index: 3,
|
||||
width: 1920,
|
||||
height: 1080,
|
||||
};
|
||||
let h2 = h.clone();
|
||||
assert_eq!(h2.slot_index, 3);
|
||||
assert_eq!(h2.raw_handle, 0xdead);
|
||||
}
|
||||
}
|
||||
@@ -595,93 +595,16 @@ impl_not_implemented_for_trait!(QsvHandoff, "QsvHandoff");
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
struct NoopCallback;
|
||||
impl EncoderCompletionCallback for NoopCallback {
|
||||
fn on_complete(&mut self, _sequence: u64, _encoded_bytes: u32) {}
|
||||
}
|
||||
|
||||
fn submission() -> EncoderSubmission {
|
||||
EncoderSubmission::new(0xfeed_face, 7, EncoderDims::new(1920, 1080), 42)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nvenc_stub_returns_not_implemented() {
|
||||
let mut h = NotImplementedHandoff::nvenc();
|
||||
let mut cb = NoopCallback;
|
||||
let err = NvencHandoff::encode_shared(&mut h, submission(), &mut cb).err();
|
||||
assert!(matches!(err, Some(RingError::NotImplemented { what })
|
||||
if what.contains("Nvenc")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn amf_stub_returns_not_implemented() {
|
||||
let mut h = NotImplementedHandoff::amf();
|
||||
let mut cb = NoopCallback;
|
||||
let err = AmfHandoff::encode_shared(&mut h, submission(), &mut cb).err();
|
||||
assert!(matches!(err, Some(RingError::NotImplemented { what })
|
||||
if what.contains("Amf")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn qsv_stub_returns_not_implemented() {
|
||||
let mut h = NotImplementedHandoff::qsv();
|
||||
let mut cb = NoopCallback;
|
||||
let err = QsvHandoff::encode_shared(&mut h, submission(), &mut cb).err();
|
||||
assert!(matches!(err, Some(RingError::NotImplemented { what })
|
||||
if what.contains("Qsv")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn encoder_dims_rejects_zero_width_via_assert() {
|
||||
let result = std::panic::catch_unwind(|| EncoderDims::new(0, 1080));
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nvenc_stub_register_returns_not_implemented() {
|
||||
let mut h = NotImplementedHandoff::nvenc();
|
||||
let dims = EncoderDims::new(1920, 1080);
|
||||
let err = NvencHandoff::register_slot(&mut h, 0xabc, 0, dims).err();
|
||||
assert!(matches!(err, Some(EncoderError::NotImplemented { what })
|
||||
if what.contains("Nvenc")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn amf_stub_register_returns_not_implemented() {
|
||||
let mut h = NotImplementedHandoff::amf();
|
||||
let dims = EncoderDims::new(1920, 1080);
|
||||
let err = AmfHandoff::register_slot(&mut h, 0xabc, 0, dims).err();
|
||||
assert!(matches!(err, Some(EncoderError::NotImplemented { what })
|
||||
if what.contains("Amf")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn qsv_stub_register_returns_not_implemented() {
|
||||
let mut h = NotImplementedHandoff::qsv();
|
||||
let dims = EncoderDims::new(1920, 1080);
|
||||
let err = QsvHandoff::register_slot(&mut h, 0xabc, 0, dims).err();
|
||||
assert!(matches!(err, Some(EncoderError::NotImplemented { what })
|
||||
if what.contains("Qsv")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stub_poll_completed_returns_none() {
|
||||
let mut h_nv = NotImplementedHandoff::nvenc();
|
||||
let mut h_amf = NotImplementedHandoff::amf();
|
||||
let mut h_qsv = NotImplementedHandoff::qsv();
|
||||
let slot = HandoffSlot::new(0, 0xdead);
|
||||
assert!(NvencHandoff::poll_completed(&mut h_nv, slot).is_none());
|
||||
assert!(AmfHandoff::poll_completed(&mut h_amf, slot).is_none());
|
||||
assert!(QsvHandoff::poll_completed(&mut h_qsv, slot).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stub_unregister_does_not_panic() {
|
||||
let mut h = NotImplementedHandoff::nvenc();
|
||||
let slot = HandoffSlot::new(0, 0xdead);
|
||||
NvencHandoff::unregister_slot(&mut h, slot);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn encoded_bitstream_rejects_empty() {
|
||||
let result = std::panic::catch_unwind(|| EncodedBitstream::new(vec![], 0, 0, true));
|
||||
|
||||
@@ -373,28 +373,6 @@ impl KeyedMutexBackend for MetalSharedTextureBackend {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn off_macos_returns_platform_unsupported() {
|
||||
let mut backend = MetalSharedTextureBackend::new();
|
||||
let result = backend.create_slots(1920, 1080, TextureFormat::Nv12);
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(BackendError::PlatformUnsupported { .. })
|
||||
));
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let slots = result.expect("macos create_slots ok");
|
||||
assert_eq!(slots.len(), 8);
|
||||
for (idx, s) in slots.iter().enumerate() {
|
||||
assert_eq!(s.slot_index(), idx as u32);
|
||||
assert!(s.iosurface_handle() != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn create_slots_rejects_zero_dims() {
|
||||
let mut backend = MetalSharedTextureBackend::new();
|
||||
|
||||
@@ -1188,13 +1188,6 @@ impl NvencD3D11Handoff {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn sdk_not_found_when_dll_missing() {
|
||||
let dummy_path = "/this/path/does/not/exist/fake-nvencodeAPI64.dll";
|
||||
let result = unsafe { Library::new(dummy_path) };
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_version_layout_is_stable() {
|
||||
assert_eq!(NV_ENC_OPEN_ENCODE_SESSION_EX_PARAMS_VER, struct_version(1));
|
||||
|
||||
@@ -842,13 +842,6 @@ impl QsvHandoff for QsvD3D11Handoff {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn sdk_not_found_when_dll_missing() {
|
||||
let dummy_path = "/this/path/does/not/exist/fake-libmfxhw64.dll";
|
||||
let result = unsafe { Library::new(dummy_path) };
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fourcc_nv12_packs_correctly() {
|
||||
assert_eq!(MFX_FOURCC_NV12, 0x3231564E);
|
||||
@@ -934,31 +927,4 @@ mod tests {
|
||||
value_u32: u32,
|
||||
variant_type: u32,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mock_set_filter_records_property_and_value() {
|
||||
let mut record = FilterRecord::default();
|
||||
let property = FILTER_PROPERTY_ACCEL;
|
||||
let variant = MfxVariant {
|
||||
version: MfxStructVersion {
|
||||
minor: MFX_VARIANT_VERSION_MINOR,
|
||||
major: MFX_VARIANT_VERSION_MAJOR,
|
||||
},
|
||||
type_: MFX_VARIANT_TYPE_U32,
|
||||
data: MfxVariantData {
|
||||
u32_: MFX_ACCEL_MODE_VIA_D3D11,
|
||||
},
|
||||
};
|
||||
let mut len: usize = 0;
|
||||
while *property.get(len).unwrap_or(&1) != 0 {
|
||||
len += 1;
|
||||
}
|
||||
record.property.extend_from_slice(&property[..len]);
|
||||
record.variant_type = variant.type_;
|
||||
record.value_u32 = unsafe { variant.data.u32_ };
|
||||
assert_eq!(record.property, b"mfxImplDescription.AccelerationMode");
|
||||
assert_eq!(record.variant_type, MFX_VARIANT_TYPE_U32);
|
||||
assert_eq!(record.value_u32, MFX_ACCEL_MODE_VIA_D3D11);
|
||||
assert_eq!(record.value_u32, 0x0300);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user