summaryrefslogtreecommitdiff
path: root/Tests
AgeCommit message (Collapse)Author
2023-03-08AK: Make String::contains(code_point) handle non-ASCIITimothy Flynn
We currently only accept a char, instead of a full code point.
2023-03-08AK: Make String::{starts,ends}_with(code_point) handle non-ASCIITimothy Flynn
We currently pass the code point to StringView::{starts,ends}_with, which actually accepts a single char, thus cannot handle non-ASCII code points.
2023-03-06Everywhere: Remove NonnullOwnPtr.h includesAndreas Kling
2023-03-06Everywhere: Stop using NonnullOwnPtrVectorAndreas Kling
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06Everywhere: Stop using NonnullRefPtrVectorAndreas Kling
This class had slightly confusing semantics and the added weirdness doesn't seem worth it just so we can say "." instead of "->" when iterating over a vector of NNRPs. This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-05Tests: Migrate to Directory::for_each_entry()Sam Atkins
2023-03-05LibUnicode: Detect ZWJ sequences when filtering by emoji presentationTimothy Flynn
This was preventing some unqualified emoji sequences from rendering properly, such as the custom SerenityOS flag. We rendered the flag correctly when given the fully qualified sequence: U+1F3F3 U+FEOF U+200D U+1F41E But were not detecting the unqualified sequence as an emoji when also filtering for emoji-presentation sequences: U+1F3F3 U+200D U+1F41E
2023-03-04AK: Implement Knuth's algorithm D for dividing UFixedBigInt'sDan Klishch
2023-03-04AK: Delete unused and untested sqrt, pow and pow_mod from UFixedBigIntDan Klishch
2023-03-04Tests: Replace test image with my own creationLucas CHOLLET
2023-03-04Tests: Add a test for SOF2 images with only spectral selectionLucas CHOLLET
You can generate one by using `cjpeg` with the -scan argument. This image has been generated with the following scan file: 0 1 2: 0 0 0 0; 0: 1 9 0 0; 2: 1 63 0 0 ; 1: 1 63 0 0 ; 0: 10 63 0 0;
2023-03-03AK: Ensure short String instances are valid UTF-8Timothy Flynn
We are currently only validating long strings.
2023-03-03AK: Invalidate overlong UTF-8 code point encodingsTimothy Flynn
For example, the code point U+002F could be encoded as UTF-8 with the bytes 0x80 0xAF. This trick has historically been used to bypass security checks.
2023-03-03AK: Make FixedPoint(FloatingPoint) ctor round instead of truncatingNico Weber
This is needed to have code for creating an in-memory sRGB profile using the (floating-ppoint) numbers from the sRGB spec and having the fixed-point values in the profile match what they are in other software (such as GIMP). It has the side effect of making the FixedPoint ctor no longer constexpr (which seems fine; nothing was currently relying on that). Some of FixedPoint's member functions don't round yet, which requires tweaking a test.
2023-03-01LibCore+Everywhere: Remove ArgsParser::add*(char const*&)Ali Mohammad Pur
This is not guaranteed to always work correctly as ArgsParser deals in StringViews and might have a non-properly-null-terminated string as a value. As a bonus, using StringView (and DeprecatedString where necessary) leads to nicer looking code too :^)
2023-02-28AK+Everywhere: Make GenericLexer::ignore_until() stop before the valueSam Atkins
`consume_until(foo)` stops before foo, and so does `ignore_until(Predicate)`, so let's make the other `ignore_until()` overloads consistent with that so they're less confusing.
2023-02-28Userland+AK: Stop using getopt() for ArgsParserAli Mohammad Pur
This commit moves the implementation of getopt into AK, and converts its API to understand and use StringView instead of char*. Everything else is caught in the crossfire of making Option::accept_value() take a StringView instead of a char const*. With this, we must now pass a Span<StringView> to ArgsParser::parse(), applications using LibMain are unaffected, but anything not using that or taking its own argc/argv has to construct a Vector<StringView> for this method.
2023-02-28LibWeb: Rename Layout::InitialContainingBlock to Layout::ViewportAndreas Kling
The name "initial containing block" was wrong for this, as it doesn't correspond to the HTML element, and that's specifically what it's supposed to do! :^)
2023-02-27Tests: Add a test for SOF0 images with several scansLucas CHOLLET
This type of image isn't common, and you can probably only find one by generating it yourself. It can be done using `cjpeg` with the -scan argument. This image has been generated with the following scan file: 0: 0 63 0 0; 1: 0 63 0 0; 2: 0 63 0 0;
2023-02-27Tests: Rename "test_jpg" to "test_jpeg_sof0_one_scan"Lucas CHOLLET
2023-02-26LibGfx: Return bool not ErrorOr<bool> from ImageDecoderPlugin::sniff()MacDue
Nobody made use of the ErrorOr return value and it just added more chance of confusion, since it was not clear if failing to sniff an image should return an error or false. The answer was false, if you returned Error you'd crash the ImageDecoder.
2023-02-26AK: Fix DeprecatedString::bijective_base_from for large numbersTim Ledbetter
The output of the DeprecatedString::bijective_base_from() is now correct for numbers larger than base^2. This makes column names display correctly in Spreadsheet.
2023-02-26LibGfx: Implement WebPImageDecoderPlugin::loop_count()Nico Weber
Turns out extended-lossless-animated.webp did have a loop count of 0. So I opened it in Hex Fiend and changed the byte at position 42 (which is the first byte of the little-endian u16 storing the loop count) to 0x2A, so that the test can compare the loop count to something not 0.
2023-02-26LibGfx: Implement is_animated() and frame_count() for webp pluginNico Weber
2023-02-26Tests: Add webp size decoding tests for webpNico Weber
2023-02-26Tests: Add one more webp test fileNico Weber
This is "Lossless animated WebP (5 KB) 4" from https://developers.google.com/speed/webp/faq
2023-02-26Tests: Add one more webp test fileNico Weber
This is Discord's reencoded version of my profile picture, which is GitHub's auto-generated avatar for my github profile.
2023-02-26Tests: Add one more webp test fileNico Weber
It's a simple lossless file from: https://developers.google.com/speed/webp/gallery2#webp_links > "baby tux for my user page" > Image Author: Fizyplankton > This file is in the public domain.
2023-02-26Tests: Implement multi-value returns in test-wasmAli Mohammad Pur
2023-02-26LibWasm+LibWeb: Sneak a JS::Completion into Wasm::ResultAli Mohammad Pur
Imported functions in Wasm may throw JS exceptions, and we need to preserve these exceptions so we can pass them to the calling JS code. This also adds a `assert_wasm_result()` API to Result for cases where only Wasm traps or values are expected (e.g. internal uses) to avoid making LibWasm (pointlessly) handle JS exceptions that will never show up in reality.
2023-02-26Tests: Use MUST more in TestImageDecoderNico Weber
No behavior change.
2023-02-25LibUnicode: Add a unit test for Unicode grapheme and word segmentationTimothy Flynn
These include tests for previously broken boundary conditions.
2023-02-25Everywhere: Use _{short_,}string to create Strings from literalsLinus Groh
2023-02-24LibGfx: Remove single-code point Font::glyph_or_emoji_width APITimothy Flynn
All callers are now aware of multi-code point emoji (and must remain so going forward).
2023-02-24LibGfx+Tests: Add test for webp ICC loading and fix bugNico Weber
I drew the two webp files in Photoshop and saved them using the "Save a Copy..." dialog, with ICC profile and all other boxes checked. (I also tried saving with all the boxes unchecked, but it still wrote an extended webp instead of a basic file.) The lossless file exposed a bug: I didn't handle chunk padding correctly before this patch.
2023-02-24LibUnicode: Add a method to check if a code point could start an emojiTimothy Flynn
2023-02-21AK: Add `take_first` to HashTable and rename `pop` to `take_last`Hediadyoin1
This naming scheme matches Vector. This also changes `take_last` to move the value it takes, and delete by known pointer, avoiding a full lookup and potential copies.
2023-02-21AK: Add String::from_stream methodAndrew Kaster
The caller is responsible for determining how long the string is that they want to read.
2023-02-21LibJS: Make RefPtr and NonnullRefPtr usage const-correctAndreas Kling
This mainly affected the AST, which is now const throughout.
2023-02-19LibTextCodec+Everywhere: Port Decoders to new StringsSam Atkins
2023-02-19Tests: Add a test for Gfx::ICC::encode()Nico Weber
The test verifies that loading an icc file and serializing it again produces exactly the same output as the input. That's not always the case, but often. It requires the input file either not having any padding or using null bytes as padding, it requires the input file putting tag data in the order the tag data is referenced in in the tag table, and it requires the input file only using known tag types (which at the moment means it only works for v4 profiles, but that part will change in the future). The new file p3-v4.icc was extracted from a jpeg taken by an iPhone Mini.
2023-02-18LibGfx: Rename `JPGLoader` to `JPEGLoader`Lucas CHOLLET
The patch also contains modifications on several classes, functions or files that are related to the `JPGLoader`. Renaming include: - JPGLoader{.h, .cpp} - JPGImageDecoderPlugin - JPGLoadingContext - JPG_DEBUG - decode_jpg - FuzzJPGLoader.cpp - Few string literals or texts
2023-02-18AK: Fix printing of negative FixedPoint valuesNico Weber
Fixes #17514 by comparing to 0 before truncating the fractional part.
2023-02-18AK: Fix 64-bit alignment issue in shared-superstring substringsAndreas Kling
Thanks to Timothy Flynn for the test! Fixes #17141
2023-02-17AK: Remove unused `rehash_for_collision`Jelle Raaijmakers
2023-02-17AK: Reimplement `HashTable` with smart linear probingJelle Raaijmakers
Instead of rehashing on collisions, we use Robin Hood hashing: a simple linear probe where we keep track of the distance between the bucket and its ideal position. On insertion, we allow a new bucket to "steal" the position of "rich" buckets (those near their ideal position) and move them further down. On removal, we shift buckets back up into the freed slot, decrementing their distance while doing so. This behavior automatically optimizes the number of required probes for any value, and removes the need for periodic rehashing (except when expanding the capacity).
2023-02-18AK: Add `AK::SIMD::exp_approximate`Jelle Raaijmakers
This approximation tries to generate values within 0.1% of their actual expected value. Microbenchmarks indicate that this iterative SIMD version can be up to 60x faster than `AK::SIMD::exp`.
2023-02-17LibJS+Everywhere: Convert JS::Error to StringTimothy Flynn
This includes an Error::create overload to create an Error from a UTF-8 StringView. If creating a String from that view fails, the factory will return an OOM InternalError instead. VM::throw_completion can also make use of this overload via its perfect forwarding.
2023-02-16LibJS: Convert remaining usages of Value::TDSWOSE to Value::TSWOSETimothy Flynn
Note the couple of cases using MUST are just debugging statements.
2023-02-16LibJS+Everywhere: Deprecate Value::to_string_without_side_effectsTimothy Flynn