-
-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flexbox: initial attempt to add support for RTL direction #1225
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2511579
added rtl flexbox test
malnajdi 1e35ab3
flexbox: initial attempt to support flex with rtl
malnajdi ecb97b1
Kozea/WeasyPrint#601: handle flex-direction column
malnajdi 2a01aef
Kozea/WeasyPrint#601: add flex rtl tests row & col
malnajdi 0c2e7b2
Kozea/WeasyPrint#601: remove TODO:handle RTL
malnajdi a81a82d
Kozea/WeasyPrint#601: fix indentation
malnajdi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,9 @@ def test_flex_direction_row_rtl(): | |
div_2.position_y == | ||
div_3.position_y == | ||
article.position_y) | ||
assert div_1.position_x == article.width - div_1.padding_width() | ||
assert ( | ||
div_1.position_x + div_1.width == | ||
article.position_x + article.width) | ||
assert div_1.position_x > div_2.position_x > div_3.position_x | ||
|
||
|
||
|
@@ -111,10 +113,7 @@ def test_flex_direction_row_reverse_rtl(): | |
div_2.position_y == | ||
div_3.position_y == | ||
article.position_y) | ||
# below assert needs to be fixed | ||
assert ( | ||
div_3.position_x + div_3.width == | ||
article.position_x + article.width) | ||
assert div_3.position_x == article.position_x | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @liZe please verify if this test is correct. |
||
assert div_1.position_x > div_2.position_x > div_3.position_x | ||
|
||
|
||
|
@@ -143,6 +142,32 @@ def test_flex_direction_column(): | |
assert div_1.position_y < div_2.position_y < div_3.position_y | ||
|
||
|
||
@assert_no_logs | ||
def test_flex_direction_column_rtl(): | ||
page, = render_pages(''' | ||
<article style="display: flex; flex-direction: column; | ||
direction: rtl"> | ||
<div>A</div> | ||
<div>B</div> | ||
<div>C</div> | ||
</article> | ||
''') | ||
html, = page.children | ||
body, = html.children | ||
article, = body.children | ||
div_1, div_2, div_3 = article.children | ||
assert div_1.children[0].children[0].text == 'A' | ||
assert div_2.children[0].children[0].text == 'B' | ||
assert div_3.children[0].children[0].text == 'C' | ||
assert ( | ||
div_1.position_x == | ||
div_2.position_x == | ||
div_3.position_x == | ||
article.position_x) | ||
assert div_1.position_y == article.position_y | ||
assert div_1.position_y < div_2.position_y < div_3.position_y | ||
|
||
|
||
@assert_no_logs | ||
def test_flex_direction_column_reverse(): | ||
page, = render_pages(''' | ||
|
@@ -170,6 +195,34 @@ def test_flex_direction_column_reverse(): | |
assert div_1.position_y < div_2.position_y < div_3.position_y | ||
|
||
|
||
@assert_no_logs | ||
def test_flex_direction_column_reverse_rtl(): | ||
page, = render_pages(''' | ||
<article style="display: flex; flex-direction: column-reverse; | ||
direction: rtl"> | ||
<div>A</div> | ||
<div>B</div> | ||
<div>C</div> | ||
</article> | ||
''') | ||
html, = page.children | ||
body, = html.children | ||
article, = body.children | ||
div_1, div_2, div_3 = article.children | ||
assert div_1.children[0].children[0].text == 'C' | ||
assert div_2.children[0].children[0].text == 'B' | ||
assert div_3.children[0].children[0].text == 'A' | ||
assert ( | ||
div_1.position_x == | ||
div_2.position_x == | ||
div_3.position_x == | ||
article.position_x) | ||
assert ( | ||
div_3.position_y + div_3.height == | ||
article.position_y + article.height) | ||
assert div_1.position_y < div_2.position_y < div_3.position_y | ||
|
||
|
||
@assert_no_logs | ||
def test_flex_row_wrap(): | ||
page, = render_pages(''' | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@liZe please verify if this test is correct.