aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-05-24 19:31:06 +1000
committerNeil <nyamatongwe@gmail.com>2021-05-24 19:31:06 +1000
commit92290868cf9753d2df0d494cb44e2ff62a570b58 (patch)
tree001e6cfce84372a03997de3138d630751ee8d38a /test
parentee1886079d0a5cd350ee8e3379be347943ba93ae (diff)
downloadscintilla-mirror-92290868cf9753d2df0d494cb44e2ff62a570b58.tar.gz
Define C++ version of the Scintilla API in ScintillaTypes.h, ScintillaMessages.h
and ScintillaStructures.h using scoped enumerations. Use these headers instead of Scintilla.h internally. External definitions go in the Scintilla namespace and internal definitio0ns in Scintilla::Internal.
Diffstat (limited to 'test')
-rw-r--r--test/unit/UnitTester.cxx2
-rw-r--r--test/unit/testCellBuffer.cxx274
-rw-r--r--test/unit/testCharClassify.cxx2
-rw-r--r--test/unit/testContractionState.cxx2
-rw-r--r--test/unit/testDecoration.cxx2
-rw-r--r--test/unit/testPartitioning.cxx2
-rw-r--r--test/unit/testPerLine.cxx31
-rw-r--r--test/unit/testRunStyles.cxx4
-rw-r--r--test/unit/testSparseVector.cxx2
-rw-r--r--test/unit/testSplitVector.cxx2
-rw-r--r--test/unit/testUniConversion.cxx2
-rw-r--r--test/unit/unitTest.cxx2
12 files changed, 166 insertions, 161 deletions
diff --git a/test/unit/UnitTester.cxx b/test/unit/UnitTester.cxx
index d83a803b5..e498add10 100644
--- a/test/unit/UnitTester.cxx
+++ b/test/unit/UnitTester.cxx
@@ -20,7 +20,7 @@
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Needed for PLATFORM_ASSERT in code being tested
diff --git a/test/unit/testCellBuffer.cxx b/test/unit/testCellBuffer.cxx
index 22f8a616c..b48e44bb9 100644
--- a/test/unit/testCellBuffer.cxx
+++ b/test/unit/testCellBuffer.cxx
@@ -11,9 +11,10 @@
#include <algorithm>
#include <memory>
+#include "ScintillaTypes.h"
+
#include "Debugging.h"
-#include "Scintilla.h"
#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
@@ -23,6 +24,7 @@
#include "catch.hpp"
using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test CellBuffer.
@@ -132,11 +134,11 @@ TEST_CASE("CellBuffer") {
}
SECTION("LineEndTypes") {
- REQUIRE(cb.GetLineEndTypes() == 0);
- cb.SetLineEndTypes(1);
- REQUIRE(cb.GetLineEndTypes() == 1);
- cb.SetLineEndTypes(0);
- REQUIRE(cb.GetLineEndTypes() == 0);
+ REQUIRE(cb.GetLineEndTypes() == LineEndType::Default);
+ cb.SetLineEndTypes(LineEndType::Unicode);
+ REQUIRE(cb.GetLineEndTypes() == LineEndType::Unicode);
+ cb.SetLineEndTypes(LineEndType::Default);
+ REQUIRE(cb.GetLineEndTypes() == LineEndType::Default);
}
SECTION("ReadOnly") {
@@ -155,122 +157,122 @@ TEST_CASE("CharacterIndex") {
CellBuffer cb(true, false);
SECTION("Setup") {
- REQUIRE(cb.LineCharacterIndex() == SC_LINECHARACTERINDEX_NONE);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 0);
+ REQUIRE(cb.LineCharacterIndex() == LineCharacterIndexType::None);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 0);
cb.SetUTF8Substance(true);
- cb.AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16);
- REQUIRE(cb.LineCharacterIndex() == SC_LINECHARACTERINDEX_UTF16);
+ cb.AllocateLineCharacterIndex(LineCharacterIndexType::Utf16);
+ REQUIRE(cb.LineCharacterIndex() == LineCharacterIndexType::Utf16);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 0);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 0);
- cb.ReleaseLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16);
- REQUIRE(cb.LineCharacterIndex() == SC_LINECHARACTERINDEX_NONE);
+ cb.ReleaseLineCharacterIndex(LineCharacterIndexType::Utf16);
+ REQUIRE(cb.LineCharacterIndex() == LineCharacterIndexType::None);
}
SECTION("Insertion") {
cb.SetUTF8Substance(true);
- cb.AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16 | SC_LINECHARACTERINDEX_UTF32);
+ cb.AllocateLineCharacterIndex(LineCharacterIndexType::Utf16 | LineCharacterIndexType::Utf32);
bool startSequence = false;
cb.InsertString(0, "a", 1, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 1);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 1);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 1);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 1);
const char *hwair = "\xF0\x90\x8D\x88";
cb.InsertString(0, hwair, strlen(hwair), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 3);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 2);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 3);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 2);
}
SECTION("Deletion") {
cb.SetUTF8Substance(true);
- cb.AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16 | SC_LINECHARACTERINDEX_UTF32);
+ cb.AllocateLineCharacterIndex(LineCharacterIndexType::Utf16 | LineCharacterIndexType::Utf32);
bool startSequence = false;
const char *hwair = "a\xF0\x90\x8D\x88z";
cb.InsertString(0, hwair, strlen(hwair), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 4);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 3);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 4);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 3);
cb.DeleteChars(5, 1, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 3);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 2);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 3);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 2);
cb.DeleteChars(1, 4, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 1);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 1);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 1);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 1);
}
SECTION("Insert Complex") {
cb.SetUTF8Substance(true);
- cb.SetLineEndTypes(1);
- cb.AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16 | SC_LINECHARACTERINDEX_UTF32);
+ cb.SetLineEndTypes(LineEndType::Unicode);
+ cb.AllocateLineCharacterIndex(LineCharacterIndexType::Utf16 | LineCharacterIndexType::Utf32);
bool startSequence = false;
// 3 lines of text containing 8 bytes
const char *data = "a\n\xF0\x90\x8D\x88\nz";
cb.InsertString(0, data, strlen(data), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 5);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 6);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 5);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 6);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 4);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF32) == 5);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 4);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf32) == 5);
// Insert a new line at end -> "a\n\xF0\x90\x8D\x88\nz\n" 4 lines
// Last line empty
cb.InsertString(strlen(data), "\n", 1, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 5);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 7);
- REQUIRE(cb.IndexLineStart(4, SC_LINECHARACTERINDEX_UTF16) == 7);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 5);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 7);
+ REQUIRE(cb.IndexLineStart(4, LineCharacterIndexType::Utf16) == 7);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 4);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF32) == 6);
- REQUIRE(cb.IndexLineStart(4, SC_LINECHARACTERINDEX_UTF32) == 6);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 4);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf32) == 6);
+ REQUIRE(cb.IndexLineStart(4, LineCharacterIndexType::Utf32) == 6);
// Insert a new line before end -> "a\n\xF0\x90\x8D\x88\nz\n\n" 5 lines
cb.InsertString(strlen(data), "\n", 1, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 5);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 7);
- REQUIRE(cb.IndexLineStart(4, SC_LINECHARACTERINDEX_UTF16) == 8);
- REQUIRE(cb.IndexLineStart(5, SC_LINECHARACTERINDEX_UTF16) == 8);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 5);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 7);
+ REQUIRE(cb.IndexLineStart(4, LineCharacterIndexType::Utf16) == 8);
+ REQUIRE(cb.IndexLineStart(5, LineCharacterIndexType::Utf16) == 8);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 4);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF32) == 6);
- REQUIRE(cb.IndexLineStart(4, SC_LINECHARACTERINDEX_UTF32) == 7);
- REQUIRE(cb.IndexLineStart(5, SC_LINECHARACTERINDEX_UTF32) == 7);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 4);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf32) == 6);
+ REQUIRE(cb.IndexLineStart(4, LineCharacterIndexType::Utf32) == 7);
+ REQUIRE(cb.IndexLineStart(5, LineCharacterIndexType::Utf32) == 7);
// Insert a valid 3-byte UTF-8 character at start ->
// "\xE2\x82\xACa\n\xF0\x90\x8D\x88\nz\n\n" 5 lines
@@ -278,19 +280,19 @@ TEST_CASE("CharacterIndex") {
const char *euro = "\xE2\x82\xAC";
cb.InsertString(0, euro, strlen(euro), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 6);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 8);
- REQUIRE(cb.IndexLineStart(4, SC_LINECHARACTERINDEX_UTF16) == 9);
- REQUIRE(cb.IndexLineStart(5, SC_LINECHARACTERINDEX_UTF16) == 9);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 6);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 8);
+ REQUIRE(cb.IndexLineStart(4, LineCharacterIndexType::Utf16) == 9);
+ REQUIRE(cb.IndexLineStart(5, LineCharacterIndexType::Utf16) == 9);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 5);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF32) == 7);
- REQUIRE(cb.IndexLineStart(4, SC_LINECHARACTERINDEX_UTF32) == 8);
- REQUIRE(cb.IndexLineStart(5, SC_LINECHARACTERINDEX_UTF32) == 8);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 5);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf32) == 7);
+ REQUIRE(cb.IndexLineStart(4, LineCharacterIndexType::Utf32) == 8);
+ REQUIRE(cb.IndexLineStart(5, LineCharacterIndexType::Utf32) == 8);
// Insert a lone lead byte implying a 3 byte character at start of line 2 ->
// "\xE2\x82\xACa\n\EF\xF0\x90\x8D\x88\nz\n\n" 5 lines
@@ -299,15 +301,15 @@ TEST_CASE("CharacterIndex") {
const char *lead = "\xEF";
cb.InsertString(5, lead, strlen(lead), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 7);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 9);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 7);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 9);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 6);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF32) == 8);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 6);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf32) == 8);
// Insert an ASCII lead byte inside the 3-byte initial character ->
// "\xE2!\x82\xACa\n\EF\xF0\x90\x8D\x88\nz\n\n" 5 lines
@@ -318,13 +320,13 @@ TEST_CASE("CharacterIndex") {
const char *ascii = "!";
cb.InsertString(1, ascii, strlen(ascii), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 6);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 10);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 6);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 10);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 6);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 9);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 6);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 9);
// Insert a NEL after the '!' to trigger the utf8 line end case ->
// "\xE2!\xC2\x85 \x82\xACa\n \EF\xF0\x90\x8D\x88\n z\n\n" 5 lines
@@ -332,20 +334,20 @@ TEST_CASE("CharacterIndex") {
const char *nel = "\xC2\x85";
cb.InsertString(2, nel, strlen(nel), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 7);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 11);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 7);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 11);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 7);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF32) == 10);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 7);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf32) == 10);
}
SECTION("Delete Multiple lines") {
cb.SetUTF8Substance(true);
- cb.AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16 | SC_LINECHARACTERINDEX_UTF32);
+ cb.AllocateLineCharacterIndex(LineCharacterIndexType::Utf16 | LineCharacterIndexType::Utf32);
bool startSequence = false;
// 3 lines of text containing 8 bytes
@@ -355,18 +357,18 @@ TEST_CASE("CharacterIndex") {
// Delete first 2 new lines -> "az\nc"
cb.DeleteChars(1, strlen(data) - 4, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 4);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 4);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 4);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 4);
}
SECTION("Delete Complex") {
cb.SetUTF8Substance(true);
- cb.AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16 | SC_LINECHARACTERINDEX_UTF32);
+ cb.AllocateLineCharacterIndex(LineCharacterIndexType::Utf16 | LineCharacterIndexType::Utf32);
bool startSequence = false;
// 3 lines of text containing 8 bytes
@@ -378,28 +380,28 @@ TEST_CASE("CharacterIndex") {
// line 1 becomes 4 single byte characters
cb.DeleteChars(2, 1, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 6);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 7);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 6);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 7);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 6);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF32) == 7);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 6);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf32) == 7);
// Delete first new line ->
// "a\x90\x8D\x88\nz"
// Only 2 lines with line 0 containing 5 single byte characters
cb.DeleteChars(1, 1, startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 5);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 6);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 5);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 6);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 5);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 6);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 5);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 6);
// Restore lead byte from character on line 0 making a 4-byte character ->
// "a\xF0\x90\x8D\x88\nz"
@@ -407,18 +409,18 @@ TEST_CASE("CharacterIndex") {
const char *lead4 = "\xF0";
cb.InsertString(1, lead4, strlen(lead4), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 4);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 5);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 4);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 5);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF32) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF32) == 3);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF32) == 4);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf32) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf32) == 3);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf32) == 4);
}
SECTION("Insert separates new line bytes") {
cb.SetUTF8Substance(true);
- cb.AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF16 | SC_LINECHARACTERINDEX_UTF32);
+ cb.AllocateLineCharacterIndex(LineCharacterIndexType::Utf16 | LineCharacterIndexType::Utf32);
bool startSequence = false;
// 2 lines of text containing 4 bytes
@@ -430,9 +432,9 @@ TEST_CASE("CharacterIndex") {
const char *ascii = "!";
cb.InsertString(2, ascii, strlen(ascii), startSequence);
- REQUIRE(cb.IndexLineStart(0, SC_LINECHARACTERINDEX_UTF16) == 0);
- REQUIRE(cb.IndexLineStart(1, SC_LINECHARACTERINDEX_UTF16) == 2);
- REQUIRE(cb.IndexLineStart(2, SC_LINECHARACTERINDEX_UTF16) == 4);
- REQUIRE(cb.IndexLineStart(3, SC_LINECHARACTERINDEX_UTF16) == 5);
+ REQUIRE(cb.IndexLineStart(0, LineCharacterIndexType::Utf16) == 0);
+ REQUIRE(cb.IndexLineStart(1, LineCharacterIndexType::Utf16) == 2);
+ REQUIRE(cb.IndexLineStart(2, LineCharacterIndexType::Utf16) == 4);
+ REQUIRE(cb.IndexLineStart(3, LineCharacterIndexType::Utf16) == 5);
}
}
diff --git a/test/unit/testCharClassify.cxx b/test/unit/testCharClassify.cxx
index 185681c5b..0dd75c514 100644
--- a/test/unit/testCharClassify.cxx
+++ b/test/unit/testCharClassify.cxx
@@ -17,7 +17,7 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test CharClassify.
diff --git a/test/unit/testContractionState.cxx b/test/unit/testContractionState.cxx
index 91672fe27..64f300a87 100644
--- a/test/unit/testContractionState.cxx
+++ b/test/unit/testContractionState.cxx
@@ -23,7 +23,7 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test ContractionState.
diff --git a/test/unit/testDecoration.cxx b/test/unit/testDecoration.cxx
index bd0b1cd58..023b44163 100644
--- a/test/unit/testDecoration.cxx
+++ b/test/unit/testDecoration.cxx
@@ -24,7 +24,7 @@
const int indicator=4;
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test Decoration.
diff --git a/test/unit/testPartitioning.cxx b/test/unit/testPartitioning.cxx
index fb70380e9..e28ef318e 100644
--- a/test/unit/testPartitioning.cxx
+++ b/test/unit/testPartitioning.cxx
@@ -20,7 +20,7 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
const int growSize = 4;
diff --git a/test/unit/testPerLine.cxx b/test/unit/testPerLine.cxx
index 669a047db..5209c194e 100644
--- a/test/unit/testPerLine.cxx
+++ b/test/unit/testPerLine.cxx
@@ -12,9 +12,10 @@
#include <algorithm>
#include <memory>
+#include "ScintillaTypes.h"
+
#include "Debugging.h"
-#include "Scintilla.h"
#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
@@ -24,7 +25,9 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
+
+constexpr int FoldBase = static_cast<int>(Scintilla::FoldLevel::Base);
// Test MarkerHandleSet.
@@ -170,41 +173,41 @@ TEST_CASE("LineLevels") {
SECTION("Initial") {
// Initial State
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(0));
+ REQUIRE(FoldBase == ll.GetLevel(0));
}
SECTION("SetLevel") {
- REQUIRE(SC_FOLDLEVELBASE == ll.SetLevel(1, 200, 5));
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(0));
+ REQUIRE(FoldBase == ll.SetLevel(1, 200, 5));
+ REQUIRE(FoldBase == ll.GetLevel(0));
REQUIRE(200 == ll.GetLevel(1));
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(2));
+ REQUIRE(FoldBase == ll.GetLevel(2));
ll.ClearLevels();
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(1));
+ REQUIRE(FoldBase == ll.GetLevel(1));
ll.ExpandLevels(5);
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(7));
+ REQUIRE(FoldBase == ll.GetLevel(7));
}
SECTION("InsertRemoveLine") {
ll.SetLevel(1, 1, 5);
ll.SetLevel(2, 2, 5);
ll.InsertLine(2);
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(0));
+ REQUIRE(FoldBase == ll.GetLevel(0));
REQUIRE(1 == ll.GetLevel(1));
REQUIRE(2 == ll.GetLevel(2));
REQUIRE(2 == ll.GetLevel(3));
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(4));
+ REQUIRE(FoldBase == ll.GetLevel(4));
ll.RemoveLine(2);
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(0));
+ REQUIRE(FoldBase == ll.GetLevel(0));
REQUIRE(1 == ll.GetLevel(1));
REQUIRE(2 == ll.GetLevel(2));
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(3));
+ REQUIRE(FoldBase == ll.GetLevel(3));
ll.InsertLines(2, 2);
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(0));
+ REQUIRE(FoldBase == ll.GetLevel(0));
REQUIRE(1 == ll.GetLevel(1));
REQUIRE(2 == ll.GetLevel(2));
REQUIRE(2 == ll.GetLevel(3));
REQUIRE(2 == ll.GetLevel(4));
- REQUIRE(SC_FOLDLEVELBASE == ll.GetLevel(5));
+ REQUIRE(FoldBase == ll.GetLevel(5));
}
}
diff --git a/test/unit/testRunStyles.cxx b/test/unit/testRunStyles.cxx
index 43d9d5b0f..92e6b9ae8 100644
--- a/test/unit/testRunStyles.cxx
+++ b/test/unit/testRunStyles.cxx
@@ -21,11 +21,11 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test RunStyles.
-namespace Scintilla { // Xcode clang 9.0 doesn't like this when in the unnamed namespace
+namespace Scintilla::Internal { // Xcode clang 9.0 doesn't like this when in the unnamed namespace
bool operator==(const FillResult<int> &fra, const FillResult<int> &frb) {
return fra.changed == frb.changed &&
fra.position == frb.position &&
diff --git a/test/unit/testSparseVector.cxx b/test/unit/testSparseVector.cxx
index ce84fb8da..0bc8f9093 100644
--- a/test/unit/testSparseVector.cxx
+++ b/test/unit/testSparseVector.cxx
@@ -23,7 +23,7 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test SparseVector.
diff --git a/test/unit/testSplitVector.cxx b/test/unit/testSplitVector.cxx
index 3f5cec3c5..8320d5bcb 100644
--- a/test/unit/testSplitVector.cxx
+++ b/test/unit/testSplitVector.cxx
@@ -19,7 +19,7 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test SplitVector.
diff --git a/test/unit/testUniConversion.cxx b/test/unit/testUniConversion.cxx
index 7bbf808ad..eabb46442 100644
--- a/test/unit/testUniConversion.cxx
+++ b/test/unit/testUniConversion.cxx
@@ -17,7 +17,7 @@
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Test UniConversion.
// Use examples from Wikipedia:
diff --git a/test/unit/unitTest.cxx b/test/unit/unitTest.cxx
index 8bcc570ac..c629b6b5d 100644
--- a/test/unit/unitTest.cxx
+++ b/test/unit/unitTest.cxx
@@ -56,7 +56,7 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include "catch.hpp"
-using namespace Scintilla;
+using namespace Scintilla::Internal;
// Needed for PLATFORM_ASSERT in code being tested