1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 01:47:25 +08:00
Commit Graph

184 Commits

Author SHA1 Message Date
Dean Herbert
01c0b61b20 Fix incorrect test names 2020-09-08 01:52:31 +09:00
Dean Herbert
fba253f131 Take user argument in CreateNew method parameters 2020-09-04 13:17:43 +09:00
Dean Herbert
d3fbc7cc53 Use more direct reference in tests 2020-09-04 13:16:35 +09:00
Dean Herbert
c9a73926a6 Add basic test coverage 2020-09-03 19:38:01 +09:00
Dean Herbert
880a127228 Use async overload 2020-06-10 00:08:48 +09:00
smoogipoo
88aed1d504 Merge branch 'master' into update-inspectcode-version 2020-06-09 20:12:39 +09:00
smoogipoo
8a021e0beb Use save method in test 2020-06-08 22:35:01 +09:00
Dean Herbert
b41384dde8
Merge branch 'master' into multiplayer-beatmap-checksum 2020-06-07 18:05:33 +09:00
Dean Herbert
66ec2afe5c Remove broken import test 2020-06-03 23:38:40 +09:00
Dean Herbert
5ed3cd205f Simplify reuse check using FileInfo IDs 2020-06-03 23:35:56 +09:00
Dean Herbert
25160dc220 Fix test name 2020-06-03 19:15:52 +09:00
Dean Herbert
012933545e Add test coverage 2020-06-03 18:33:41 +09:00
smoogipoo
f3b5149648 Move some suggestions to warnings, resolve issues 2020-06-03 16:48:44 +09:00
smoogipoo
dfb9687fb5 Extract update into PreUpdate(), add test 2020-06-02 17:22:09 +09:00
Dean Herbert
f989f1aa00 Change event flow to avoid firing store delete events on update 2020-05-27 16:08:47 +09:00
Dean Herbert
052ad79fc6 Convert dangerous events to IBindables 2020-05-19 16:44:22 +09:00
alex
0e2ccac33b Add spaces to comments 2020-05-04 18:36:24 -07:00
Dean Herbert
370ff70dd4 Fix incorrect host name specification 2020-03-17 18:32:30 +09:00
smoogipoo
363d7d724a Use old ctor params 2020-01-15 14:02:29 +09:00
smoogipoo
0e844b3039 Cleanup / re-protect file store 2020-01-14 19:24:53 +09:00
smoogipoo
4b8d628000 Remove file addition test 2020-01-14 19:24:53 +09:00
smoogipoo
524ff41931 Add more assertions 2020-01-14 19:24:53 +09:00
smoogipoo
b592b6d80d Improve robustness by always creating a new file 2020-01-14 19:24:53 +09:00
smoogipoo
000fc836b2 Remove unused class 2020-01-14 19:24:53 +09:00
smoogipoo
dce93dfe7c Split test 2020-01-14 19:24:53 +09:00
smoogipoo
609102bea3 Initial file updating implementation 2020-01-14 19:24:53 +09:00
smoogipoo
681a43a318 Refactor to support beatmap updates 2020-01-14 19:24:53 +09:00
Dean Herbert
9f62ec869a Add failing test 2019-11-14 19:38:20 +09:00
Dan Balasescu
26a33bfa4e
Merge branch 'master' into fix-resume-from-player-audio 2019-10-11 19:21:14 +09:00
Dean Herbert
c7eb0b401b
Merge branch 'master' into ignore-macosx-folder-in-archives 2019-10-11 14:36:52 +09:00
Bartłomiej Dach
11acd177f1 Add import test with files to be filtered out
Add a test case reproducing the conditions encountered "in the wild"
wherein a skin import would be performed incorrectly due to a __MACOSX
resource fork directory present next to a directory with the actual skin
files in the archive.
2019-10-10 23:54:17 +02:00
Bartłomiej Dach
c8ffc134d4 Use nameof when instantiating headless game hosts
As a purely cosmetic code improvement, substitute string literals
in constructor calls of HeadlessGameHost in ImportBeatmapTest for nameof
operator usages.
2019-10-10 22:36:43 +02:00
Bartłomiej Dach
cb1f7e2dc7 Fix platform dependency in buffered reader test
Tests for the line-buffered reader added in 7b1ff38 were subtly
dependent on the execution environment due to differing end-of-line
markers on Windows and Unix-based systems.

Because StreamReader discards all newlines when reading line-by-line,
LineBufferedReader used a StringBuilder to patch the peeked lines
back together with the remaining contents of the file being read.
As StringBuilder.AppendLine uses the environment-specific newline
delimiter, the delimiters after the peeked-but-unconsumed lines can
therefore be substituted by the platform-specific variants, causing
the test failures due to the overly-simplified way they were written.

Reformulate the test to avoid such issues from resurfacing again
by splitting lines by \r or \n and then testing each line individually.
Additionally remove all raw literals in favour of explicitly mixing
various line delimiter character sequences for additional coverage.
2019-10-10 15:33:18 +02:00
Dean Herbert
8df2e359c4 Fix tests on CI 2019-10-10 17:42:15 +09:00
Dean Herbert
6268bbcfc8
Merge branch 'master' into beatmap-parsing-fallback-v2 2019-10-03 15:12:21 +08:00
Dean Herbert
a06cb54732
Merge branch 'master' into beatmap-parsing-fallback-v2 2019-09-20 15:28:08 +09:00
Dean Herbert
f306fe27d8 Add test to cover corruption case 2019-09-20 15:05:48 +09:00
Dean Herbert
ddff9882cf Fix importing archives which are nested in a single folder within a zip 2019-09-19 19:11:04 +09:00
Bartłomiej Dach
86588778b1 Implement fallback decoder registration
After the preparatory introduction of LineBufferedReader, it is now
possible to introduce registration of fallback decoders that won't drop
input supplied in the first line of the file.

A fallback decoder is used when the magic in the first line of the file
does not match any of the other known decoders. In such a case,
the fallback decoder is constructed and provided a LineBufferedReader
instance. The process of matching magic only peeks the first non-empty
line, so it is available for re-reading in Decode() using ReadLine().

There can be only one fallback decoder per type; a second attempt of
registering a fallback will result in an exception to avoid bugs.

To address the issue of parsing failing on badly or non-headered files,
set the legacy decoders for Beatmaps and Storyboards as the fallbacks.

Due to non-trivial logic, several new, passing unit tests with possible
edge cases also included.
2019-09-15 01:28:07 +02:00
Bartłomiej Dach
11eda44d34 Migrate decoding to line-buffered reader
Migrate all usages of StreamReader in the context of decoding beatmaps,
storyboards or skins to the new LineBufferedReader.
2019-09-15 01:28:07 +02:00
Bartłomiej Dach
7b1ff38df7 Implement line-buffered reader
Add a line-buffered reader decorator operating on StreamReader
instances. The decorator has two main operations - PeekLine(), which
allows to see the next line in the stream without consuming it,
ReadLine(), which consumes and returns the next line in the stream, and
ReadToEnd() which reads all the remaining text in the stream (including
the unconsumed peeked line). Peeking line-per-line uses an internal
queue of lines that have been read ahead from the underlying stream.

The addition of the line-buffered reader is a workaround solution to
a problem with decoding. At current selecting a decoder works by
irreversibly reading the first line from the stream and looking for
a magic string that indicates the type of decoder to use.

It might however be possible for a file to be valid in format, just
missing a header. In such a case a lack of a line-buffered reader makes
it impossible to reparse the content of that first line. Introducing it
will however allow to peek the first line for magic first.

 - If magic is found in the first line, GetDecoder() will peek it and
   use it to return the correct Decoder instance. Note that in the case
   of JsonBeatmapDecoder the magic is the opening JSON object brace,
   and therefore must not be consumed.

 - If magic is not found, the fallback decoder will be able to consume
   it using ReadLine() in Decode().

This commit additionally contains basic unit tests for the reader.

Suggested-by: Aergwyn <aergwyn@t-online.de>
2019-09-15 01:26:15 +02:00
Dean Herbert
9e1cb90dd8 Remove existing argument for ItemAdded event
For all usages, it looks like this was unnecessary.
2019-06-26 11:40:41 +09:00
Dean Herbert
12aa264657 Consolidate tests and check for file reference counts 2019-06-10 18:35:23 +09:00
Dean Herbert
28b2a516e3 Ensure exception is only thrown once on rollback 2019-06-10 18:13:33 +09:00
Dean Herbert
dcdb806120 Catch newly thrown exception in test 2019-06-10 17:26:56 +09:00
Dean Herbert
5b75060b94 Add test for rollback logic correctly dereferencing files 2019-06-10 16:45:45 +09:00
smoogipoo
f090e292c9 Move ArchiveModelManager import process to async flow 2019-06-10 13:42:22 +09:00
Dean Herbert
c39c37a18d Apply more missed cases 2019-04-01 12:44:46 +09:00
smoogipoo
00191ca940 Actually set the beatmap difficulty 2019-03-12 15:24:35 +09:00
smoogipoo
059397ac50 Remove unnecessary early return for maching beatmap IDs 2019-03-12 14:40:13 +09:00