Skip to content

Commit 129c5ea

Browse files
committed
Fix unit tests
* SetText has to be invoked after window is shown. Otherwise font styles won't get updated and Scintilla will crash when trying to measure widths. This is a workaround and it should eventually be fixed in Scintilla port.
1 parent 27bc799 commit 129c5ea

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

test/TestFindReplace.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ FindReplaceTest::SetUp()
3434
fApplication = new BApplication("application/x-vnd.KapiX-KoderFindReplaceTest");
3535
fWindow = new BWindow(BRect(100, 100, 400, 400), "FindReplaceTest", B_DOCUMENT_WINDOW, 0);
3636
fEditor = new BScintillaView("EditorView", 0, true, true, B_NO_BORDER);
37+
fFindReplaceHandler = new FindReplaceHandler(fEditor, fWindow);
38+
fWindow->AddHandler(fFindReplaceHandler);
39+
BGroupLayout *layout = new BGroupLayout(B_VERTICAL, 0);
40+
fWindow->SetLayout(layout);
41+
fWindow->Show();
42+
layout->AddView(fEditor);
43+
fMessenger = new BMessenger(fFindReplaceHandler, fWindow);
44+
45+
fEditor->LockLooper();
3746
fEditor->SetText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
3847
"Duis congue aliquam eros eget rhoncus. Mauris ultricies ipsum urna, "
3948
"vitae scelerisque lacus facilisis molestie. Curabitur pulvinar "
@@ -42,13 +51,7 @@ FindReplaceTest::SetUp()
4251
"Pellentesque quis lectus dolor. Vestibulum ante ipsum primis in "
4352
"faucibus orci luctus et ultrices posuere cubilia Curae; Cras ac purus "
4453
"auctor, mattis risus eu, ultricies lectus.");
45-
fFindReplaceHandler = new FindReplaceHandler(fEditor, fWindow);
46-
fWindow->AddHandler(fFindReplaceHandler);
47-
BGroupLayout *layout = new BGroupLayout(B_VERTICAL, 0);
48-
fWindow->SetLayout(layout);
49-
fWindow->Show();
50-
layout->AddView(fEditor);
51-
fMessenger = new BMessenger(fFindReplaceHandler, fWindow);
54+
fEditor->UnlockLooper();
5255
}
5356

5457

0 commit comments

Comments
 (0)