Commit graph

1014 commits

Author SHA1 Message Date
Ali Mohammad Pur 1e022295c4 Tests: Use .is_flag_set() instead of bitwise & in Regex flag tests
The default flag might not be zero, so don't assume masking off flags
will yield zero.
2023-02-15 10:14:26 +01:00
Tim Schumacher 43f98ac6e1 Everywhere: Remove the AK:: qualifier from Stream usages 2023-02-13 00:50:07 +00:00
Tim Schumacher 874c7bba28 LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
Tim Schumacher 606a3982f3 LibCore: Move Stream-based file into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher a96339b72b LibCore: Move Stream-based sockets into the Core namespace 2023-02-13 00:50:07 +00:00
Tim Schumacher d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Aliaksandr Kalenik 92cb32b905 LibWeb: Add tests for flex formatting context 2023-02-11 10:42:52 +01:00
MacDue 654950eaf7 Tests: Add a few tests to verify vectors are using inline storage 2023-02-11 00:03:14 +01:00
Luke Wilde d9d556fbab AK: Allow Vector<ByteBuffer>::contains_slow to accept (Readonly)Bytes
This is done by providing Traits<ByteBuffer>::equals functions for
(Readonly)Bytes, as the base GenericTraits<T>::equals is unable to
convert the ByteBuffer to (Readonly)Bytes to then use Span::operator==

This allows us to check if a Vector<ByteBuffer> contains a
(Readonly)Bytes without having to making a copy of it into a ByteBuffer
first. The initial use of this is in LibWeb with CORS-preflight, where
we check the split contents of the Access-Control headers with
Fetch::Infrastructure::Request::method() and static StringViews
such as "*"sv.bytes().
2023-02-10 22:18:19 +00:00
Aliaksandr Kalenik 2ed5415750 LibWeb: Fix clearance to update y offset within current block
If a box has clearance and margin bottom of preceding box is greater
than static y of the box then it should also affect y offset in current
block container so subsequent boxes will get correct y position too.
2023-02-10 20:55:33 +01:00
Tim Schumacher e8d5e938de AK: Remove the deprecated Stream implementation :^) 2023-02-08 19:18:26 +00:00
MacDue 63b11030f0 Everywhere: Use ReadonlySpan<T> instead of Span<T const> 2023-02-08 19:15:45 +00:00
Zaggy1024 25c9dfbf90 Tests/LibVideo: Test to ensure that VP9 reference vector clamping works
The test file is a short clip from Big Buck Bunny, so a license file
was added to the directory to attribute it.
2023-02-08 18:56:42 +00:00
Tim Schumacher 220fbcaa7e AK: Remove the fallible constructor from FixedMemoryStream 2023-02-08 17:44:32 +00:00
Tim Schumacher 8b2f23d016 AK: Remove the fallible constructor from LittleEndianOutputBitStream 2023-02-08 17:44:32 +00:00
Tim Schumacher 0fee97916b AK: Remove the fallbile constructor from BigEndianOutputBitStream 2023-02-08 17:44:32 +00:00
Tim Schumacher 261d62438f AK: Remove the fallible constructor from LittleEndianInputBitStream 2023-02-08 17:44:32 +00:00
Tim Schumacher fa09152e23 AK: Remove the fallible constructor from BigEndianInputBitStream 2023-02-08 17:44:32 +00:00
Aliaksandr Kalenik f43f4feb1e LibWeb: Table wrappers should not be ignored in auto height calculation
Though table wrappers are anonymous block containers (because
TableWrapper is inherited from BlockContainer) with no lines they
should not be skipped in block auto height calculation.
2023-02-07 17:04:38 +01:00
Aliaksandr Kalenik 900cd78121 LibWeb: Add layout tests for floats, margins collapsing and positioning
Those are copied from 'Base/res/html/misc/'.
2023-02-06 20:42:14 +01:00
Aliaksandr Kalenik 12eca612bc Ladybird: Specify window size in layout dump mode 2023-02-06 20:42:14 +01:00
Aliaksandr Kalenik 1f4106842d LibGfx: Pass font width to FontDatabase::get()
Width need to be passed to `FontDatabase::get()` to resolve font name
unambiguously.
2023-02-05 08:06:06 +00:00
Tim Schumacher 47531a42a9 AK: Make LEB128 decoding work with read_value 2023-02-04 18:41:27 -07:00
Tim Schumacher 787f4d639a AK: Port LEB128 to the new AK::Stream 2023-02-04 18:41:27 -07:00
Staubfinger da1023fcc5 AK: Add thresholds to quickselect_inline and Statistics::Median
I did a bit of Profiling and made the quickselect and median algorithms
use the best of option for the respective input size.
2023-02-03 19:04:15 +01:00
Staubfinger becd6d106f AK: Testing for AK::quickselect_inline
The testing code found here is mainly derived from the Tests for
`AK::quick_sort`.
2023-02-03 19:04:15 +01:00
Timothy Flynn 2af7447dfd AK: Define HashMap::take to find and remove a value from the map 2023-02-02 19:14:00 +00:00
Timothy Flynn f31bd190b0 AK: Ensure string types are actually considered hash-compatible
The AnyString concept is currently broken because it checks whether a
StringView is constructible from a type T. The StringView constructors,
however, only accept constant rvalue references - i.e. `T const&`.

This also adds a test to ensure this continues to work.
2023-02-02 19:14:00 +00:00
Nico Weber fb79fc0ba6 Tests: Add a basic ICC profile test
icc-v4.jpg is Meta/Websites/serenityos.org/happy/3rd/bgianf.jpg.
There are a whole bunch of jpgs with v4 color profiles and I just picked
one fairly arbitrarily. It looks like a fairly standard v4 matrix
profile that in this form is also present in many jpgs taken by mobile
phone cameras. It uses parametric curves.

icc-v2.png is based on ./Documentation/WebServer_localhost.jpg since
that is the only image in the repo with a v2 color profile. It also has
all kinds of interesting and somewhat exotic tags, such as an 'dscm' (an
Apple extension to have a description of type 'mluc', since normal
'desc' is required ot have type 'desc' in v2 files -- in v4, 'desc' has
type 'mluc') tag of type 'mluc' that actually contains data in several
languages and that exercises the non-BMP UTF-16BE decoder. It's however
still also a fairly standard v2 matrix profile, which uses 'curv'
instead of 'para' for its curves ('para' is v4-only).

I converted that jpeg file to png, and cropped most of the image
data to save on file size by running:

    sips -s format png --cropToHeightWidth 21 42 in.jpg --out out.png
2023-02-01 19:19:30 +01:00
Timothy Flynn 9f9b8e7273 CI: Move running LibWeb layout tests to Azure
The current config on GitHub Actions does not use ccache, so it takes
quite a while to build. Instead, let's just run these tests on Azure
where we already build Ladybird and have ccache enabled. This also lets
us sanitize LibWeb on both Linux and macOS.

The script changes here are to A) handle differences between Azure and
GitHub Actions and B) to support running on macOS.
2023-02-01 14:04:44 +00:00
Nico Weber c8832807d6 LibGfx+Tests: Remove code unnecessary after 9e7c16d0a4 2023-02-01 08:56:56 -05:00
Nico Weber bea3f3fc46 LibGfx: Move TestImageDecoder over to input file approach in 8cfabbcd93
Rather than reading files out of /res, put them in a subfolder of
Tests/LibGfx/ and pick the path based on AK_OS_SERENITY.

That way, the tests can also pass when run under lagom.

(I just `cp`d all the files that the test previously read from
random places into Tests/LibGfx/test-inputs.)
2023-02-01 08:56:56 -05:00
Nico Weber b8b5e0f680 LibGfx: Move TestFontHandling over to input file approach in 8cfabbcd93
Rather than reading files out of /res, put them in a subfolder of
Tests/LibGfx/ and pick the path based on AK_OS_SERENITY.

That way, the tests can also pass when run under lagom.
2023-02-01 08:56:56 -05:00
Ben Wiederhake e147d0b572 AK: Fix all quadratic-time append-loops over ByteBuffer 2023-01-31 16:58:25 +01:00
Tim Schumacher 093cf428a3 AK: Move memory streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher 11550f582b Tests: Remove the 10KB file read test for AllocatingMemoryStream
When we move the test to AK (together with the actual stream
implementation), finding the input file to read from is going to become
significantly harder, since the test also runs outside of SerenityOS.

Since this was just a smoke test during early development (and we should
now have reasonable coverage with actual usages in the other parts of
the OS), let's just remove that test instead of trying to make input
file lookups work.
2023-01-29 19:16:44 -07:00
Tim Schumacher 2470dd3bb5 AK: Move bit streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher 8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Tim Schumacher 5f2ea31816 AK: Move Handle from LibCore and name it MaybeOwned
The new name should make it abundantly clear what it does.
2023-01-29 19:16:44 -07:00
Tim Schumacher ae64b68717 AK: Deprecate the old AK::Stream
This also removes a few cases where the respective header wasn't
actually required to be included.
2023-01-29 19:16:44 -07:00
Nico Weber f4c1269d4c Tests: Modernize TestImageDecoder a bit
- Use MUST() instead of checking plugin_decoder_or_error.is_error()
- Use MappedFile::bytes()
- Don't use EXPECT_EQ when comparing to fixed bools

No intended behavior change.
2023-01-29 22:37:37 +00:00
Nico Weber 10ae570ac5 Tests: Make LibGfx tests not depend on LibGUI
As far as I can tell, that's not needed and never was.
2023-01-29 22:36:13 +00:00
Aliaksandr Kalenik 78b503946c Tests: Add LibWeb layout tests 2023-01-29 11:33:33 +00:00
Timothy Flynn b75b7f0c0d LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate
Callers that are already in a fallible context will now TRY to allocate
cells. Callers in infallible contexts get a FIXME.
2023-01-29 00:02:45 +00:00
Timothy Flynn 2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
2023-01-29 00:02:45 +00:00
Linus Groh ee0297d9ec LibAudio: Remove try_ prefix from fallible LoaderPlugin methods 2023-01-28 22:41:36 +01:00
Linus Groh 108ea2b921 LibCore: Remove try_ prefix from fallible SharedCircularQueue methods 2023-01-28 22:41:36 +01:00
Linus Groh 9c08bb9555 AK: Remove try_ prefix from FixedArray creation functions 2023-01-28 22:41:36 +01:00
Timothy Flynn c59268d15b AK: Add String::trim 2023-01-28 00:13:46 +00:00
Timothy Flynn cccaa94767 AK: Add String::join 2023-01-28 00:13:46 +00:00