Fix source repetition in debug traces.
This fix appeared in prior CL patchsets, but got lost through rebases and CL splits. Change-Id: I1befff3830b40740f1e52e3e88f74484122027ce Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481680 Reviewed-by: Julia Lavrova <jlavrova@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
parent
97f89808d1
commit
0ee3e0c959
@ -19,6 +19,7 @@ void SkVMDebugTrace::setTraceCoord(const SkIPoint& coord) {
|
||||
}
|
||||
|
||||
void SkVMDebugTrace::setSource(std::string source) {
|
||||
fSource.clear();
|
||||
std::stringstream stream{std::move(source)};
|
||||
while (stream.good()) {
|
||||
fSource.push_back({});
|
||||
|
@ -23,6 +23,16 @@ DEF_TEST(SkVMDebugTraceSetSource, r) {
|
||||
REPORTER_ASSERT(r, i.fSource[3] == "\t// third line");
|
||||
}
|
||||
|
||||
DEF_TEST(SkVMDebugTraceSetSourceReplacesExistingText, r) {
|
||||
SkSL::SkVMDebugTrace i;
|
||||
i.setSource("One");
|
||||
i.setSource("Two");
|
||||
i.setSource("Three");
|
||||
|
||||
REPORTER_ASSERT(r, i.fSource.size() == 1);
|
||||
REPORTER_ASSERT(r, i.fSource[0] == "Three");
|
||||
}
|
||||
|
||||
DEF_TEST(SkVMDebugTraceWrite, r) {
|
||||
SkSL::SkVMDebugTrace i;
|
||||
i.fSource = {
|
||||
|
Loading…
Reference in New Issue
Block a user