diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2019-08-13 16:35:48 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2019-08-14 17:59:37 +0300 |
commit | 05417b22206c479b5ebe8ac8e7dd73ae154c8c96 (patch) | |
tree | aa11344ee7e5fa0bf8c95ce380e347d11a3df16f /tests | |
parent | 72eb70f93328e4e19a319aa199f6c46a0c8ab420 (diff) |
Text editor: syntax highlighting + line numbers on by default
The most common use of the text editor seems to be for scripting. Having
line numbers and syntax highlighting enabled by default seems sensible.
Syntax highlighting is now enabled by default, but is automatically
disabled when the datablock has a non-highlighted extension.
Highlighting is enabled for filenames like:
- Text
- Text.001
- somefile.py
and is automatically disabled when the datablock has an extension for
which Blender has no syntax highlighter registered.
Reviewers: billreynish, campbellbarton
Subscribers: brecht, billreynish
Differential Revision: https://developer.blender.org/D5472
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gtests/blenlib/BLI_path_util_test.cc | 15 | ||||
-rw-r--r-- | tests/gtests/blenlib/BLI_string_test.cc | 21 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_path_util_test.cc b/tests/gtests/blenlib/BLI_path_util_test.cc index c07ff2b0b05..c9a7436df31 100644 --- a/tests/gtests/blenlib/BLI_path_util_test.cc +++ b/tests/gtests/blenlib/BLI_path_util_test.cc @@ -618,3 +618,18 @@ TEST(path_util, PathFrameGet) PATH_FRAME_GET("", -1, -1, false); } #undef PATH_FRAME_GET + + +/* BLI_path_extension */ +TEST(path_util, PathExtension) +{ + EXPECT_EQ(NULL, BLI_path_extension("some.def/file")); + EXPECT_EQ(NULL, BLI_path_extension("Text")); + EXPECT_EQ(NULL, BLI_path_extension("Text…001")); + + EXPECT_STREQ(".", BLI_path_extension("some/file.")); + EXPECT_STREQ(".gz", BLI_path_extension("some/file.tar.gz")); + EXPECT_STREQ(".abc", BLI_path_extension("some.def/file.abc")); + EXPECT_STREQ(".abc", BLI_path_extension("C:\\some.def\\file.abc")); + EXPECT_STREQ(".001", BLI_path_extension("Text.001")); +} diff --git a/tests/gtests/blenlib/BLI_string_test.cc b/tests/gtests/blenlib/BLI_string_test.cc index b63b591b39a..c79afdfb92c 100644 --- a/tests/gtests/blenlib/BLI_string_test.cc +++ b/tests/gtests/blenlib/BLI_string_test.cc @@ -12,6 +12,7 @@ extern "C" { #include "BLI_utildefines.h" #include "BLI_string.h" #include "BLI_string_utf8.h" +#include "BLI_string_utils.h" } using std::initializer_list; @@ -588,3 +589,23 @@ TEST(string, StringStrncasestr) res = BLI_strncasestr(str_test0, "not there", 9); EXPECT_EQ(res, (void *)NULL); } + + +/* BLI_string_is_decimal */ +TEST(string, StrIsDecimal) +{ + EXPECT_FALSE(BLI_string_is_decimal("")); + EXPECT_FALSE(BLI_string_is_decimal("je moeder")); + EXPECT_FALSE(BLI_string_is_decimal("je møder")); + EXPECT_FALSE(BLI_string_is_decimal("Agent 327")); + EXPECT_FALSE(BLI_string_is_decimal("Agent\000327")); + EXPECT_FALSE(BLI_string_is_decimal("\000327")); + EXPECT_FALSE(BLI_string_is_decimal("0x16")); + EXPECT_FALSE(BLI_string_is_decimal("16.4")); + EXPECT_FALSE(BLI_string_is_decimal("-1")); + + EXPECT_TRUE(BLI_string_is_decimal("0")); + EXPECT_TRUE(BLI_string_is_decimal("1")); + EXPECT_TRUE(BLI_string_is_decimal("001")); + EXPECT_TRUE(BLI_string_is_decimal("11342908713948713498745980171334059871345098713405981734")); +} |