Add a test for the link group.
This commit is contained in:
parent
15f349049c
commit
7e2b1b1d8d
@ -261,7 +261,7 @@ bool SolveSpaceUI::SaveToFile(const std::string &filename) {
|
|||||||
// will be exported. We reload the linked files because that rewrites
|
// will be exported. We reload the linked files because that rewrites
|
||||||
// the linkFileRel for our possibly-new filename.
|
// the linkFileRel for our possibly-new filename.
|
||||||
SS.ScheduleShowTW();
|
SS.ScheduleShowTW();
|
||||||
SS.ReloadAllImported();
|
SS.ReloadAllImported(filename);
|
||||||
SS.GenerateAll(SolveSpaceUI::Generate::ALL);
|
SS.GenerateAll(SolveSpaceUI::Generate::ALL);
|
||||||
|
|
||||||
fh = ssfopen(filename, "wb");
|
fh = ssfopen(filename, "wb");
|
||||||
|
@ -55,6 +55,7 @@ set(testsuite_SOURCES
|
|||||||
request/datum_point/test.cpp
|
request/datum_point/test.cpp
|
||||||
request/line_segment/test.cpp
|
request/line_segment/test.cpp
|
||||||
request/ttf_text/test.cpp
|
request/ttf_text/test.cpp
|
||||||
|
group/link/test.cpp
|
||||||
group/translate_asy/test.cpp
|
group/translate_asy/test.cpp
|
||||||
group/translate_nd/test.cpp
|
group/translate_nd/test.cpp
|
||||||
)
|
)
|
||||||
|
BIN
test/group/link/normal.png
Normal file
BIN
test/group/link/normal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
BIN
test/group/link/normal.slvs
Normal file
BIN
test/group/link/normal.slvs
Normal file
Binary file not shown.
BIN
test/group/link/normal_v20.slvs
Normal file
BIN
test/group/link/normal_v20.slvs
Normal file
Binary file not shown.
BIN
test/group/link/normal_v22.slvs
Normal file
BIN
test/group/link/normal_v22.slvs
Normal file
Binary file not shown.
BIN
test/group/link/rect_v20.slvs
Normal file
BIN
test/group/link/rect_v20.slvs
Normal file
Binary file not shown.
17
test/group/link/test.cpp
Normal file
17
test/group/link/test.cpp
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include "harness.h"
|
||||||
|
|
||||||
|
TEST_CASE(normal_roundtrip) {
|
||||||
|
CHECK_LOAD("normal.slvs");
|
||||||
|
CHECK_RENDER("normal.png");
|
||||||
|
CHECK_SAVE("normal.slvs");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE(normal_migrate_from_v20) {
|
||||||
|
CHECK_LOAD("normal_v20.slvs");
|
||||||
|
CHECK_SAVE("normal.slvs");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE(normal_migrate_from_v22) {
|
||||||
|
CHECK_LOAD("normal_v22.slvs");
|
||||||
|
CHECK_SAVE("normal.slvs");
|
||||||
|
}
|
@ -116,6 +116,7 @@ static std::string PrepareSavefile(std::string data) {
|
|||||||
if(eqPos < nextLineBegin) {
|
if(eqPos < nextLineBegin) {
|
||||||
std::string key = data.substr(lineBegin, eqPos - lineBegin),
|
std::string key = data.substr(lineBegin, eqPos - lineBegin),
|
||||||
value = data.substr(eqPos + 1, nextLineBegin - eqPos - 2);
|
value = data.substr(eqPos + 1, nextLineBegin - eqPos - 2);
|
||||||
|
|
||||||
for(int i = 0; SolveSpaceUI::SAVED[i].type != 0; i++) {
|
for(int i = 0; SolveSpaceUI::SAVED[i].type != 0; i++) {
|
||||||
if(SolveSpaceUI::SAVED[i].fmt != 'f') continue;
|
if(SolveSpaceUI::SAVED[i].fmt != 'f') continue;
|
||||||
if(SolveSpaceUI::SAVED[i].desc != key) continue;
|
if(SolveSpaceUI::SAVED[i].desc != key) continue;
|
||||||
@ -126,6 +127,11 @@ static std::string PrepareSavefile(std::string data) {
|
|||||||
std::copy(newValue.begin(), newValue.end(),
|
std::copy(newValue.begin(), newValue.end(),
|
||||||
data.begin() + eqPos + 1);
|
data.begin() + eqPos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(key == "Group.impFile") {
|
||||||
|
data.erase(lineBegin, nextLineBegin - lineBegin);
|
||||||
|
nextLineBegin = lineBegin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t spPos = data.find(' ', lineBegin);
|
size_t spPos = data.find(' ', lineBegin);
|
||||||
|
Loading…
Reference in New Issue
Block a user