blob: 983074daf4ed8605663517aa637355f38bfe28d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/** @file testDocument.cxx
** Unit Tests for Scintilla internal data structures
**/
#include <cstddef>
#include <cstring>
#include <stdexcept>
#include <string_view>
#include <vector>
#include <optional>
#include <algorithm>
#include <memory>
#include "ScintillaTypes.h"
#include "ILoader.h"
#include "ILexer.h"
#include "Debugging.h"
#include "CharacterCategoryMap.h"
#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
#include "catch.hpp"
using namespace Scintilla;
using namespace Scintilla::Internal;
// Test Document.
TEST_CASE("Document") {
const char sText[] = "Scintilla";
const Sci::Position sLength = static_cast<Sci::Position>(strlen(sText));
Document doc(DocumentOption::Default);
SECTION("InsertOneLine") {
const Sci::Position length = doc.InsertString(0, sText, sLength);
REQUIRE(sLength == doc.Length());
REQUIRE(length == sLength);
REQUIRE(1 == doc.LinesTotal());
REQUIRE(0 == doc.LineStart(0));
REQUIRE(0 == doc.LineFromPosition(0));
REQUIRE(sLength == doc.LineStart(1));
REQUIRE(0 == doc.LineFromPosition(static_cast<int>(sLength)));
REQUIRE(doc.CanUndo());
REQUIRE(!doc.CanRedo());
}
}
|