From 9341589f1eb03da10e7b6861ac5e74be191db678 Mon Sep 17 00:00:00 2001
From: Jean Fechter <jean.fechter@kitware.com>
Date: Fri, 7 Feb 2025 10:42:38 +0100
Subject: [PATCH] Add test AxisAlignedReflectionFilter composite dataset with
 null input

---
 Filters/General/Testing/CMakeLists.txt            |  1 +
 .../Cxx/TestAxisAlignedReflectionFilter.cxx       | 15 ++++++++++++++-
 .../Data/mb_single_piece_empty_data.vtm.sha512    |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 Testing/Data/mb_single_piece_empty_data.vtm.sha512

diff --git a/Filters/General/Testing/CMakeLists.txt b/Filters/General/Testing/CMakeLists.txt
index d2a50043f20..fa060d26043 100644
--- a/Filters/General/Testing/CMakeLists.txt
+++ b/Filters/General/Testing/CMakeLists.txt
@@ -13,6 +13,7 @@ vtk_module_test_data(
   Data/fullhead15.png
   Data/hexa.vtk
   Data/mb-of-mps.vtm
+  Data/mb_single_piece_empty_data.vtm
   Data/mine_with_dates.vtp
   Data/quadraticTetra01.vtu
   Data/rectGrid.vtr
diff --git a/Filters/General/Testing/Cxx/TestAxisAlignedReflectionFilter.cxx b/Filters/General/Testing/Cxx/TestAxisAlignedReflectionFilter.cxx
index bacda5b883e..97582e58614 100644
--- a/Filters/General/Testing/Cxx/TestAxisAlignedReflectionFilter.cxx
+++ b/Filters/General/Testing/Cxx/TestAxisAlignedReflectionFilter.cxx
@@ -395,6 +395,19 @@ int TestMultiBlockOnlyDataSets(int argc, char* argv[])
   return EXIT_SUCCESS;
 }
 
+int TestMultiBlockEmptyPiece(int argc, char* argv[])
+{
+  ReadFileMacro("Data/mb_single_piece_empty_data.vtm", vtkXMLMultiBlockDataReader);
+
+  vtkSmartPointer<vtkPartitionedDataSetCollection> output =
+    Reflect(reader->GetOutputPort(), true, true, vtkAxisAlignedReflectionFilter::X_MIN);
+
+  AssertMacro(output->GetNumberOfPartitionedDataSets() == 2, output->GetClassName(),
+    "Incorrect number of partitioned datasets")
+
+    return EXIT_SUCCESS;
+}
+
 // This function tests all the input types, and each input type will test a different plane mode.
 int TestAxisAlignedReflectionFilter(int argc, char* argv[])
 {
@@ -402,5 +415,5 @@ int TestAxisAlignedReflectionFilter(int argc, char* argv[])
     TestRectilinearGrid(argc, argv) || TestExplicitStructuredGrid(argc, argv) ||
     TestStructuredGrid(argc, argv) || TestPolyData(argc, argv) || TestHyperTreeGrid(argc, argv) ||
     TestPartitionedDataSetCollection(argc, argv) || TestMultiBlockMultiPiece(argc, argv) ||
-    TestMultiBlockOnlyDataSets(argc, argv);
+    TestMultiBlockOnlyDataSets(argc, argv) || TestMultiBlockEmptyPiece(argc, argv);
 }
diff --git a/Testing/Data/mb_single_piece_empty_data.vtm.sha512 b/Testing/Data/mb_single_piece_empty_data.vtm.sha512
new file mode 100644
index 00000000000..7bdb8145e75
--- /dev/null
+++ b/Testing/Data/mb_single_piece_empty_data.vtm.sha512
@@ -0,0 +1 @@
+4aa443c77a1817d8a115465ec00759c3cc1664a3f1973d9ebc938511e827d34604f5f1412b1f12face3c7987c0dd1ffd47552b7a6a5cf8c5bd955421c9af8eb7
-- 
GitLab