-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
//fbandroid/libraries/textlayoutbuilder/library/src/test/java/com/fac…
…ebook/fbui/textlayoutbuilder/shadows:shadows Differential Revision: D64034471 fbshipit-source-id: 29027659c3141e2d34bfe295a6903c50db29c5d2
- Loading branch information
1 parent
52bbff6
commit d23bb7f
Showing
3 changed files
with
54 additions
and
60 deletions.
There are no files selected for viewing
43 changes: 0 additions & 43 deletions
43
library/src/test/java/com/facebook/fbui/textlayoutbuilder/shadows/ShadowLayout.java
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
library/src/test/java/com/facebook/fbui/textlayoutbuilder/shadows/ShadowLayout.kt
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.facebook.fbui.textlayoutbuilder.shadows | ||
|
||
import android.text.Layout | ||
import android.text.TextPaint | ||
import org.robolectric.annotation.Implementation | ||
import org.robolectric.annotation.Implements | ||
|
||
@Implements(Layout::class) | ||
object ShadowLayout { | ||
|
||
const val LONG_TEXT: String = "ZzZzZzZzZzZzZzZzZzZzZz" | ||
const val SHORT_TEXT: String = "Z" | ||
const val LONG_TEXT_LENGTH: Int = 100 | ||
const val SHORT_TEXT_LENGTH: Int = 5 | ||
|
||
@JvmStatic | ||
@Implementation | ||
fun getDesiredWidth(source: CharSequence, paint: TextPaint?): Float { | ||
if (LONG_TEXT == source) { | ||
return LONG_TEXT_LENGTH.toFloat() | ||
} else if (SHORT_TEXT == source) { | ||
return SHORT_TEXT_LENGTH.toFloat() | ||
} | ||
return 0f | ||
} | ||
} |
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