Skip to content
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

Fix inverted calculation of RTL text percentage in bidi #7948

Merged
merged 1 commit into from
Jan 12, 2017

Conversation

Skaty
Copy link
Contributor

@Skaty Skaty commented Jan 11, 2017

While I was doing up unit tests for the Unicode bi-directional function, I realised that the fraction to calculate the percentage of RTL text in the document is swapped (i.e. it was calculating the inverse of the percentage).

Due to this bug, all bidi strings passed will be tagged as predominantly RTL, despite meeting the requirements listed.

@Skaty Skaty changed the title Fix inverted calculation of RTL text percentage in bidi. Fix inverted calculation of RTL text percentage in bidi Jan 11, 2017
@brendandahl
Copy link
Contributor

Looks good, but do you have a unit test you can add so we don't regress this?

@Skaty
Copy link
Contributor Author

Skaty commented Jan 12, 2017

Do you want me to add the unit test just for this first?

I have been doing up the basic unit tests for bidi, but I feel that this needs to be address as it's a breaking bug.

@yurydelendik
Copy link
Contributor

Do you want me to add the unit test just for this first?

I have been doing up the basic unit tests for bidi, but I feel that this needs to be address as it's a breaking bug.

Having tests will help to avoid breaking your fix in the future. Unit tests will be great to have.

@yurydelendik
Copy link
Contributor

btw, bidi.js is one of the two core files that don't have unit tests (see #7261).

@Skaty
Copy link
Contributor Author

Skaty commented Jan 12, 2017

@yurydelendik

I agree with that. I'm sorry if the question was not clear. I was resolving #7261 for bidi.js, but I found this particular issue that seems to break.

So, should I add the full suite of unit tests that was meant to resolve #7261, or as an interim, just tests to ensure that this particular logic (percentage of RTL text) doesn't regress?

@brendandahl
Copy link
Contributor

So, should I add the full suite of unit tests that was meant to resolve #7261, or as an interim, just tests to ensure that this particular logic (percentage of RTL text) doesn't regress?

The single test is fine as a starting point. Besides regressions, it helps prove the validity of the patch.

@Skaty Skaty force-pushed the fix-bidi-fraction branch from 25784be to c65aa66 Compare January 12, 2017 03:22
@Skaty
Copy link
Contributor Author

Skaty commented Jan 12, 2017

Unit test for this patch has been added.

Copy link
Contributor

@yurydelendik yurydelendik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests looks good. Can you check if you can add bidi.js to the test/unit/clitools.js list?

@yurydelendik
Copy link
Contributor

/botio unittest

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_unittest from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/33c90dd6fab2884/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_unittest from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/fbf95518ce69b65/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/33c90dd6fab2884/output.txt

Total script time: 2.04 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/fbf95518ce69b65/output.txt

Total script time: 2.88 mins

  • Unit Tests: Passed

@Skaty
Copy link
Contributor Author

Skaty commented Jan 12, 2017

@yurydelendik Do you mean test/unit/clitests.json?

@yurydelendik
Copy link
Contributor

Do you mean test/unit/clitests.json?

Yes.

@Skaty Skaty force-pushed the fix-bidi-fraction branch from c65aa66 to 857a5da Compare January 12, 2017 15:54
@Skaty
Copy link
Contributor Author

Skaty commented Jan 12, 2017

@yurydelendik Done.

@yurydelendik
Copy link
Contributor

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.21.233.14:8877/6aefd21f0930c61/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/1ae1fc1582cbe94/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/1ae1fc1582cbe94/output.txt

Total script time: 25.92 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/6aefd21f0930c61/output.txt

Total script time: 26.93 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Regression tests: Passed

@yurydelendik yurydelendik merged commit 1af35a6 into mozilla:master Jan 12, 2017
@yurydelendik
Copy link
Contributor

Thank you for the patch

movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Fix inverted calculation of RTL text percentage in bidi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants