Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/gtests')
-rw-r--r--tests/gtests/blenlib/BLI_path_util_test.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_path_util_test.cc b/tests/gtests/blenlib/BLI_path_util_test.cc
index 41fad661ea9..1cd1cbc345d 100644
--- a/tests/gtests/blenlib/BLI_path_util_test.cc
+++ b/tests/gtests/blenlib/BLI_path_util_test.cc
@@ -462,3 +462,25 @@ TEST(path_util, SplitDirfile)
EXPECT_STREQ("", file);
}
}
+
+#define PATH_FRAME_STRIP(input_path, expect_path, expect_ext) \
+{ \
+ char path[FILE_MAX]; \
+ char ext[FILE_MAX]; \
+ BLI_strncpy(path, (input_path), FILE_MAX); \
+ BLI_path_frame_strip(path, ext); \
+ EXPECT_STREQ(path, expect_path); \
+ EXPECT_STREQ(ext, expect_ext); \
+}
+
+/* BLI_path_frame_strip */
+TEST(path_util, PathFrameStrip)
+{
+ PATH_FRAME_STRIP("", "", "");
+ PATH_FRAME_STRIP("nonum.abc", "nonum", ".abc");
+ PATH_FRAME_STRIP("fileonly.001.abc", "fileonly.###", ".abc");
+ PATH_FRAME_STRIP("/abspath/to/somefile.001.abc", "/abspath/to/somefile.###", ".abc");
+ PATH_FRAME_STRIP("/ext/longer/somefile.001.alembic", "/ext/longer/somefile.###", ".alembic");
+ PATH_FRAME_STRIP("/ext/shorter/somefile.123001.abc", "/ext/shorter/somefile.######", ".abc");
+}
+#undef PATH_FRAME_STRIP