Commit graph

7 commits

Author SHA1 Message Date
ebbit1q
e1e9caf0ef Load plain improvements (#3422)
* improve loading from plain text

Fixes the loadFromStream_Plain function that is used to load plain text
decklists.
The rewritten function uses more regexes and is a bit cleaner.
This fixes multiple bugs with loading the various sources of decklists.
Note that the new function still has a few issues that are shared with
the original version like creating duplicate cards.

* clang format comments

apparently clang-format even complains about the spacing in your
comments

* refactor loading_from_clipboard tests

Remove all heap allocation and use references.
Use std::pair and std::string so gtest will show the cardnames in error messages.
(note that using QPair or QString does not work with gtest)
Improve the last two testcases to include weird names; and name and
comments testing.
Remove empty header file.

* fix compatibility with more formats

skip "sideboard" line
include everything in mainboard when there are multiple empty lines
add removal of the mwdeck cardversion selector in round braces
add replacal of lowercase ae combination that should never occur
Set cardname to lowercase as apparently our checks are hardcoded to only
accept lowercase.

* remove bugged test

The current load from plain is simply broken, removed checking the
comments for correct contents.

* rework load_from_clipboard tests again

rework the test to have less code duplication
add more tests and more special cases
note that text is still all lowercase

* improve loading from plain text

Fixes the loadFromStream_Plain function that is used to load plain text
decklists.
The rewritten function uses more regexes and is a bit cleaner.
This fixes multiple bugs with loading the various sources of decklists.
Note that the new function still has a few issues that are shared with
the original version like creating duplicate cards.

* clang format comments

apparently clang-format even complains about the spacing in your
comments

* refactor loading_from_clipboard tests

Remove all heap allocation and use references.
Use std::pair and std::string so gtest will show the cardnames in error messages.
(note that using QPair or QString does not work with gtest)
Improve the last two testcases to include weird names; and name and
comments testing.
Remove empty header file.

* fix compatibility with more formats

skip "sideboard" line
include everything in mainboard when there are multiple empty lines
add removal of the mwdeck cardversion selector in round braces
add replacal of lowercase ae combination that should never occur
Set cardname to lowercase as apparently our checks are hardcoded to only
accept lowercase.

* remove bugged test

The current load from plain is simply broken, removed checking the
comments for correct contents.

* rework load_from_clipboard tests again

rework the test to have less code duplication
add more tests and more special cases
note that text is still all lowercase

* remove forcing of lowercase cardnames

Cardnames in DeckList::loadFromStream_Plain will no longer be forced
lowercase if they aren't found in the database.
Empty lines in the comments of plaintext decklists will not be skipped.
The loading_from_clipboard_test gets its functions declared in a
separate header "clipboard_testing.h".
Add more edgecase tests.
Refactor code.

* add old QHash version support

QT 5.5 does not support using initializer lists for QHash.
Implement a preprocessor version check for conditionally using inserts
instead of a const with initializer list.

* add old QHash version support

QT 5.5 does not support using initializer lists for QHash.
Implement a preprocessor version check for conditionally using [] access
instead of a const with initializer list.

* add qHash on QRegularExpression below QT 5.6

Apparently QRegularExpression can't be hashed in lower QT versions,
so we add our own hash function, and everyone lived happily ever after,
and none the wiser.

* add header guards to clipboard_testing.h
2018-11-07 06:05:25 -05:00
Dane Johnson
bc2cb59c50 Fix blank line between comments issue (#3407)
* Added failing test to demonstrate issue with dec loading

* Prevents empty lines between comments from being interpreted as the start of the sideboard
2018-10-08 11:26:08 -04:00
ctrlaltca
f97959febc
fix #3257 (#3258) 2018-05-24 15:46:02 +02:00
Zach H
35159ef61a
Clang script (#3085) 2018-02-06 08:45:13 -05:00
Zach H
b53cd33eed Smarter Clipboard Pasting/Parsing (#2706) 2017-05-14 14:35:40 -04:00
Fabio Bas
36f6907fa3 Improved token loading 2017-05-04 23:28:51 -04:00
Mark McDonald
9cbae8c707 Decklist testing (#2537) 2017-04-01 01:24:16 -04:00