mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
change version info generation
This commit is contained in:
parent
47b9296756
commit
7efcce4624
@ -32,21 +32,18 @@ add_subdirectory(tests)
|
||||
|
||||
execute_process(
|
||||
COMMAND git describe --tags --abbrev=0
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE LATEST_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git rev-parse --short ${LATEST_TAG}
|
||||
OUTPUT_VARIABLE LAST_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND git rev-list --count HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git rev-list --count ${LATEST_TAG}
|
||||
OUTPUT_VARIABLE COMMIT_COUNT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
@ -55,7 +52,7 @@ if(LATEST_TAG)
|
||||
else()
|
||||
set(VERSION "0.0.1-${COMMIT_COUNT}-${LAST_COMMIT_HASH}")
|
||||
endif()
|
||||
message("Generated Version: ${VERSION}")
|
||||
message("Generated Version: ${VERSION} LATEST_TAG=${LATEST_TAG}")
|
||||
|
||||
string(TIMESTAMP COMPILE_TIME "%Y%m%d_%H%M%S")
|
||||
set(CPACK_PACKAGE_NAME "CDROID-${COMPILE_TIME}-${GIT_COMMIT_HASH}")
|
||||
|
@ -136,7 +136,7 @@ int DrawableContainer::DrawableContainerState::addChild(Drawable* dr){
|
||||
dr->setVisible(false, true);
|
||||
dr->setCallback(mOwner);
|
||||
|
||||
LOGV("%p addChild(%d:%p)",this,mDrawables.size(),dr);
|
||||
LOGV("addChild(%p)[%d] to %p",dr,mDrawables.size(),this);
|
||||
mDrawables.push_back(dr);
|
||||
mChildrenChangingConfigurations |= dr->getChangingConfigurations();
|
||||
|
||||
|
@ -9,7 +9,7 @@ DECLARE_WIDGET(ImageView)
|
||||
ImageView::ImageView(Context*ctx,const AttributeSet& attrs)
|
||||
:View(ctx,attrs){
|
||||
initImageView();
|
||||
mBaselineAlignBottom =attrs.getBoolean("baselineAlignBottom",false);
|
||||
mBaselineAlignBottom = attrs.getBoolean("baselineAlignBottom",false);
|
||||
mBaseline = attrs.getDimensionPixelSize("baseline",-1);
|
||||
setAdjustViewBounds(attrs.getBoolean("adjustViewBounds",false));
|
||||
mCropToPadding = attrs.getBoolean("cropToPadding",false);
|
||||
@ -20,7 +20,7 @@ ImageView::ImageView(Context*ctx,const AttributeSet& attrs)
|
||||
{"centerCrop",ScaleType::CENTER_CROP},{"centerInside",ScaleType::CENTER_INSIDE}
|
||||
},-1);
|
||||
if(scaleType>=0)setScaleType(scaleType);
|
||||
Drawable*d=attrs.getDrawable("src");
|
||||
Drawable*d = attrs.getDrawable("src");
|
||||
if(d)setImageDrawable(d);
|
||||
mDrawableTintList = attrs.getColorStateList("tint");
|
||||
mHasDrawableTint = mDrawableTintList!=nullptr;
|
||||
|
@ -55,6 +55,14 @@ TEST_F(ASSETS,drawable){
|
||||
ASSERT_EQ((uint32_t)cl->getColor(),0);
|
||||
app.exec();
|
||||
}
|
||||
|
||||
TEST_F(ASSETS,animation_list){
|
||||
App app;
|
||||
AnimationDrawable*ad=(AnimationDrawable*)app.getDrawable("@cdroid:drawable/progress_indeterminate_horizontal");
|
||||
ASSERT_EQ(ad->getChildCount(),3);
|
||||
for(int i=0;i<ad->getChildCount();i++) ASSERT_NE(dynamic_cast<BitmapDrawable*>(ad->getChild(i)),nullptr);
|
||||
}
|
||||
|
||||
TEST_F(ASSETS,state_layerlist){
|
||||
App app;
|
||||
StateListDrawable* st = (StateListDrawable*)app.getDrawable("@cdroid:drawable/list_selector_background");
|
||||
@ -105,3 +113,44 @@ TEST_F(ASSETS,animated_selector){
|
||||
for(int i=0;i<ad2->getChildCount();i++) ASSERT_NE(dynamic_cast<NinePatchDrawable*>(ad2->getChild(i)),nullptr);
|
||||
app.exec();
|
||||
}
|
||||
TEST_F(ASSETS,animatedselector){
|
||||
App app;
|
||||
AnimatedStateListDrawable* asd = (AnimatedStateListDrawable*)app.getDrawable("@cdroid:drawable/switch_thumb_material_anim_test");
|
||||
ASSERT_NE(asd,nullptr);
|
||||
ASSERT_EQ(asd->getChildCount(),3);
|
||||
ASSERT_NE(dynamic_cast<NinePatchDrawable*>(asd->getStateDrawable(0)),nullptr);
|
||||
ASSERT_NE(dynamic_cast<TransitionDrawable*>(asd->getStateDrawable(1)),nullptr);
|
||||
ASSERT_NE(dynamic_cast<TransitionDrawable*>(asd->getStateDrawable(2)),nullptr);
|
||||
|
||||
LOGD("AnimatedStateListDrawable %p",asd);
|
||||
LOGD(" %p NinePatchDrawable",asd->getStateDrawable(0));
|
||||
LOGD(" %p TransitionDrawable",asd->getStateDrawable(1));
|
||||
TransitionDrawable*td = dynamic_cast<TransitionDrawable*>(asd->getStateDrawable(1));
|
||||
AnimationDrawable*ad = dynamic_cast<AnimationDrawable*>(td->getDrawable(0));
|
||||
LOGD(" %p AnimationDrawable",ad);
|
||||
LOGD(" %p[%p] NinePatchDrawable",ad->getChild(0),dynamic_cast<NinePatchDrawable*>(ad->getChild(0)));
|
||||
LOGD(" %p[%p] NinePatchDrawable",ad->getChild(1),dynamic_cast<NinePatchDrawable*>(ad->getChild(1)));
|
||||
LOGD(" %p TransitionDrawable",asd->getStateDrawable(2));
|
||||
td = dynamic_cast<TransitionDrawable*>(asd->getStateDrawable(2));
|
||||
ad = dynamic_cast<AnimationDrawable*>(td->getDrawable(0));
|
||||
LOGD(" %p AnimationDrawable",ad);
|
||||
LOGD(" %p[%p] NinePatchDrawable",ad->getChild(0),dynamic_cast<NinePatchDrawable*>(ad->getChild(0)));
|
||||
LOGD(" %p[%p] NinePatchDrawable",ad->getChild(1),dynamic_cast<NinePatchDrawable*>(ad->getChild(1)));
|
||||
|
||||
TransitionDrawable*td1 = dynamic_cast<TransitionDrawable*>(asd->getStateDrawable(1));
|
||||
ASSERT_NE(td1,nullptr);
|
||||
ASSERT_EQ(td1->getNumberOfLayers(),1);
|
||||
ASSERT_NE(dynamic_cast<AnimationDrawable*>(td1->getDrawable(0)),nullptr);
|
||||
AnimationDrawable*ad1 = dynamic_cast<AnimationDrawable*>(td1->getDrawable(0));
|
||||
ASSERT_EQ(ad1->getChildCount(),2);
|
||||
for(int i=0;i<ad1->getChildCount();i++) ASSERT_NE(dynamic_cast<NinePatchDrawable*>(ad1->getChild(i)),nullptr);
|
||||
TransitionDrawable* td2 = dynamic_cast<TransitionDrawable*>(asd->getStateDrawable(2));
|
||||
ASSERT_NE(td2,nullptr);
|
||||
ASSERT_EQ(td2->getNumberOfLayers(),1);
|
||||
ASSERT_NE(dynamic_cast<AnimationDrawable*>(td2->getDrawable(0)),nullptr);
|
||||
AnimationDrawable*ad2 = dynamic_cast<AnimationDrawable*>(td2->getDrawable(0));
|
||||
ASSERT_EQ(ad2->getChildCount(),2);
|
||||
for(int i=0;i<ad2->getChildCount();i++) ASSERT_NE(dynamic_cast<NinePatchDrawable*>(ad2->getChild(i)),nullptr);
|
||||
app.exec();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user