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

Test CI with screenshot diffs #216

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.util.Log;

import com.github.mikephil.charting.formatter.DefaultAxisValueFormatter;
Expand Down Expand Up @@ -524,6 +525,33 @@ public String getLongestLabel() {
return longest;
}

/**
* Returns the longest formatted label (in terms of px), this axis
* contains.
* If paint is null, then returns the longest formatted label (in terms of characters), this axis contains.
*
* @return
*/
public String getLongestLabel(Paint p) {
if (p == null) {
return getLongestLabel();
}
String longest = "";
float max = 0f;

for (int i = 0; i < mEntries.length; i++) {
String text = getFormattedLabel(i);
if (text != null) {
float width = p.measureText(text);
if (max < width) {
longest = text;
}
}
}

return longest;
}

public String getFormattedLabel(int index) {

if (index < 0 || index >= mEntries.length)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public float getRequiredWidthSpace(Paint p) {

p.setTextSize(mTextSize);

String label = getLongestLabel();
String label = getLongestLabel(p);
float width = (float) Utils.calcTextWidth(p, label) + getXOffset() * 2f;

float minWidth = getMinWidth();
Expand All @@ -371,7 +371,7 @@ public float getRequiredHeightSpace(Paint p) {

p.setTextSize(mTextSize);

String label = getLongestLabel();
String label = getLongestLabel(p);
return (float) Utils.calcTextHeight(p, label) + getYOffset() * 2f;
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified screenshotsToCompare/ViewPagerTest_smokeTestViewPager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading